Skip to content

Commit

Permalink
[ALSA] hda-intel - Make azx_get_response() a bit more robust
Browse files Browse the repository at this point in the history
In azx_[rirb_]get_response(), the timeout is checked at the end of the loop.
It's better to be checked just after the check of the RIRB index to avoid
a bogus error with a too long msleep().

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Jaroslav Kysela <[email protected]>
  • Loading branch information
tiwai authored and perexg committed Jan 31, 2008
1 parent 7cda8ba commit 28a0d9d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,21 +551,23 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)

again:
timeout = jiffies + msecs_to_jiffies(1000);
do {
for (;;) {
if (chip->polling_mode) {
spin_lock_irq(&chip->reg_lock);
azx_update_rirb(chip);
spin_unlock_irq(&chip->reg_lock);
}
if (!chip->rirb.cmds)
return chip->rirb.res; /* the last value */
if (time_after(jiffies, timeout))
break;
if (codec->bus->needs_damn_long_delay)
msleep(2); /* temporary workaround */
else {
udelay(10);
cond_resched();
}
} while (time_after_eq(timeout, jiffies));
}

if (chip->msi) {
snd_printk(KERN_WARNING "hda_intel: No response from codec, "
Expand Down

0 comments on commit 28a0d9d

Please sign in to comment.