diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-01-18 09:32:32 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:30:05 -0500 |
commit | 28a0d9df0706c523d3bb8de18892c76b78c2e428 (patch) | |
tree | 0bc6757b150a8350a419fd6dd5b884bd53d410ee /sound/pci/hda/hda_intel.c | |
parent | 7cda8ba9f4e471dfba914ecf67fd14ebffb17c16 (diff) |
[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: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index fe07bdff60d0..be5cbbcb6ec3 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -551,7 +551,7 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec) | |||
551 | 551 | ||
552 | again: | 552 | again: |
553 | timeout = jiffies + msecs_to_jiffies(1000); | 553 | timeout = jiffies + msecs_to_jiffies(1000); |
554 | do { | 554 | for (;;) { |
555 | if (chip->polling_mode) { | 555 | if (chip->polling_mode) { |
556 | spin_lock_irq(&chip->reg_lock); | 556 | spin_lock_irq(&chip->reg_lock); |
557 | azx_update_rirb(chip); | 557 | azx_update_rirb(chip); |
@@ -559,13 +559,15 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec) | |||
559 | } | 559 | } |
560 | if (!chip->rirb.cmds) | 560 | if (!chip->rirb.cmds) |
561 | return chip->rirb.res; /* the last value */ | 561 | return chip->rirb.res; /* the last value */ |
562 | if (time_after(jiffies, timeout)) | ||
563 | break; | ||
562 | if (codec->bus->needs_damn_long_delay) | 564 | if (codec->bus->needs_damn_long_delay) |
563 | msleep(2); /* temporary workaround */ | 565 | msleep(2); /* temporary workaround */ |
564 | else { | 566 | else { |
565 | udelay(10); | 567 | udelay(10); |
566 | cond_resched(); | 568 | cond_resched(); |
567 | } | 569 | } |
568 | } while (time_after_eq(timeout, jiffies)); | 570 | } |
569 | 571 | ||
570 | if (chip->msi) { | 572 | if (chip->msi) { |
571 | snd_printk(KERN_WARNING "hda_intel: No response from codec, " | 573 | snd_printk(KERN_WARNING "hda_intel: No response from codec, " |