Commit 28a0d9df authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] hda-intel - Make azx_get_response() a bit more robust

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: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 7cda8ba9
...@@ -551,7 +551,7 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec) ...@@ -551,7 +551,7 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)
again: again:
timeout = jiffies + msecs_to_jiffies(1000); timeout = jiffies + msecs_to_jiffies(1000);
do { for (;;) {
if (chip->polling_mode) { if (chip->polling_mode) {
spin_lock_irq(&chip->reg_lock); spin_lock_irq(&chip->reg_lock);
azx_update_rirb(chip); azx_update_rirb(chip);
...@@ -559,13 +559,15 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec) ...@@ -559,13 +559,15 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)
} }
if (!chip->rirb.cmds) if (!chip->rirb.cmds)
return chip->rirb.res; /* the last value */ return chip->rirb.res; /* the last value */
if (time_after(jiffies, timeout))
break;
if (codec->bus->needs_damn_long_delay) if (codec->bus->needs_damn_long_delay)
msleep(2); /* temporary workaround */ msleep(2); /* temporary workaround */
else { else {
udelay(10); udelay(10);
cond_resched(); cond_resched();
} }
} while (time_after_eq(timeout, jiffies)); }
if (chip->msi) { if (chip->msi) {
snd_printk(KERN_WARNING "hda_intel: No response from codec, " snd_printk(KERN_WARNING "hda_intel: No response from codec, "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment