mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 13:15:57 +00:00
[ALSA] cs4281 - Fix the check of timeout in probe
Fix the check of timeout in probe routines to work properly reagrdless of HZ (ALSA bug#1976). Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
e860f00047
commit
38223daa1a
@ -1416,7 +1416,7 @@ static int __devinit snd_cs4281_create(struct snd_card *card,
|
|||||||
static int snd_cs4281_chip_init(struct cs4281 *chip)
|
static int snd_cs4281_chip_init(struct cs4281 *chip)
|
||||||
{
|
{
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
int timeout;
|
unsigned long end_time;
|
||||||
int retry_count = 2;
|
int retry_count = 2;
|
||||||
|
|
||||||
/* Having EPPMC.FPDN=1 prevent proper chip initialisation */
|
/* Having EPPMC.FPDN=1 prevent proper chip initialisation */
|
||||||
@ -1496,7 +1496,7 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
|
|||||||
/*
|
/*
|
||||||
* Wait for the DLL ready signal from the clock logic.
|
* Wait for the DLL ready signal from the clock logic.
|
||||||
*/
|
*/
|
||||||
timeout = 100;
|
end_time = jiffies + HZ;
|
||||||
do {
|
do {
|
||||||
/*
|
/*
|
||||||
* Read the AC97 status register to see if we've seen a CODEC
|
* Read the AC97 status register to see if we've seen a CODEC
|
||||||
@ -1504,8 +1504,8 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
|
|||||||
*/
|
*/
|
||||||
if (snd_cs4281_peekBA0(chip, BA0_CLKCR1) & BA0_CLKCR1_DLLRDY)
|
if (snd_cs4281_peekBA0(chip, BA0_CLKCR1) & BA0_CLKCR1_DLLRDY)
|
||||||
goto __ok0;
|
goto __ok0;
|
||||||
msleep(1);
|
schedule_timeout_uninterruptible(1);
|
||||||
} while (timeout-- > 0);
|
} while (time_after_eq(end_time, jiffies));
|
||||||
|
|
||||||
snd_printk(KERN_ERR "DLLRDY not seen\n");
|
snd_printk(KERN_ERR "DLLRDY not seen\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
@ -1522,7 +1522,7 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
|
|||||||
/*
|
/*
|
||||||
* Wait for the codec ready signal from the AC97 codec.
|
* Wait for the codec ready signal from the AC97 codec.
|
||||||
*/
|
*/
|
||||||
timeout = 100;
|
end_time = jiffies + HZ;
|
||||||
do {
|
do {
|
||||||
/*
|
/*
|
||||||
* Read the AC97 status register to see if we've seen a CODEC
|
* Read the AC97 status register to see if we've seen a CODEC
|
||||||
@ -1530,20 +1530,20 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
|
|||||||
*/
|
*/
|
||||||
if (snd_cs4281_peekBA0(chip, BA0_ACSTS) & BA0_ACSTS_CRDY)
|
if (snd_cs4281_peekBA0(chip, BA0_ACSTS) & BA0_ACSTS_CRDY)
|
||||||
goto __ok1;
|
goto __ok1;
|
||||||
msleep(1);
|
schedule_timeout_uninterruptible(1);
|
||||||
} while (timeout-- > 0);
|
} while (time_after_eq(end_time, jiffies));
|
||||||
|
|
||||||
snd_printk(KERN_ERR "never read codec ready from AC'97 (0x%x)\n", snd_cs4281_peekBA0(chip, BA0_ACSTS));
|
snd_printk(KERN_ERR "never read codec ready from AC'97 (0x%x)\n", snd_cs4281_peekBA0(chip, BA0_ACSTS));
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
__ok1:
|
__ok1:
|
||||||
if (chip->dual_codec) {
|
if (chip->dual_codec) {
|
||||||
timeout = 100;
|
end_time = jiffies + HZ;
|
||||||
do {
|
do {
|
||||||
if (snd_cs4281_peekBA0(chip, BA0_ACSTS2) & BA0_ACSTS_CRDY)
|
if (snd_cs4281_peekBA0(chip, BA0_ACSTS2) & BA0_ACSTS_CRDY)
|
||||||
goto __codec2_ok;
|
goto __codec2_ok;
|
||||||
msleep(1);
|
schedule_timeout_uninterruptible(1);
|
||||||
} while (timeout-- > 0);
|
} while (time_after_eq(end_time, jiffies));
|
||||||
snd_printk(KERN_INFO "secondary codec doesn't respond. disable it...\n");
|
snd_printk(KERN_INFO "secondary codec doesn't respond. disable it...\n");
|
||||||
chip->dual_codec = 0;
|
chip->dual_codec = 0;
|
||||||
__codec2_ok: ;
|
__codec2_ok: ;
|
||||||
@ -1561,7 +1561,7 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
|
|||||||
* the codec is pumping ADC data across the AC-link.
|
* the codec is pumping ADC data across the AC-link.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
timeout = 100;
|
end_time = jiffies + HZ;
|
||||||
do {
|
do {
|
||||||
/*
|
/*
|
||||||
* Read the input slot valid register and see if input slots 3
|
* Read the input slot valid register and see if input slots 3
|
||||||
@ -1569,8 +1569,8 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
|
|||||||
*/
|
*/
|
||||||
if ((snd_cs4281_peekBA0(chip, BA0_ACISV) & (BA0_ACISV_SLV(3) | BA0_ACISV_SLV(4))) == (BA0_ACISV_SLV(3) | BA0_ACISV_SLV(4)))
|
if ((snd_cs4281_peekBA0(chip, BA0_ACISV) & (BA0_ACISV_SLV(3) | BA0_ACISV_SLV(4))) == (BA0_ACISV_SLV(3) | BA0_ACISV_SLV(4)))
|
||||||
goto __ok2;
|
goto __ok2;
|
||||||
msleep(1);
|
schedule_timeout_uninterruptible(1);
|
||||||
} while (timeout-- > 0);
|
} while (time_after_eq(end_time, jiffies));
|
||||||
|
|
||||||
if (--retry_count > 0)
|
if (--retry_count > 0)
|
||||||
goto __retry;
|
goto __retry;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user