summaryrefslogtreecommitdiff
path: root/sound/isa
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-09-11 10:12:14 +0200
committerJaroslav Kysela <perex@perex.cz>2007-10-16 16:52:12 +0200
commitb875d650527e1980cc88b2731ac4c209d2e4a0ca (patch)
tree6625ab415821399bd031122fff59fb0e526e9d68 /sound/isa
parent56f91585b48bb3ca8ec38b84c92d3df2a2f2bf66 (diff)
[ALSA] Fix thinko in cs4231 mce down check
The last patches to replace with schedule_timeout() don't work as expected. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/cs423x/cs4231_lib.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c
index 72cf7715908..a5eb9659b51 100644
--- a/sound/isa/cs423x/cs4231_lib.c
+++ b/sound/isa/cs423x/cs4231_lib.c
@@ -313,6 +313,7 @@ void snd_cs4231_mce_up(struct snd_cs4231 *chip)
void snd_cs4231_mce_down(struct snd_cs4231 *chip)
{
unsigned long flags;
+ unsigned long end_time;
int timeout;
snd_cs4231_busy_wait(chip);
@@ -344,28 +345,28 @@ void snd_cs4231_mce_down(struct snd_cs4231 *chip)
snd_printdd("(1) jiffies = %lu\n", jiffies);
/* check condition up to 250 ms */
- timeout = msecs_to_jiffies(250);
+ end_time = jiffies + msecs_to_jiffies(250);
while (snd_cs4231_in(chip, CS4231_TEST_INIT) &
CS4231_CALIB_IN_PROGRESS) {
- if (timeout <= 0) {
+ if (time_after(jiffies, end_time)) {
snd_printk(KERN_ERR "mce_down - "
"auto calibration time out (2)\n");
return;
}
- timeout = schedule_timeout(timeout);
+ msleep(1);
}
snd_printdd("(2) jiffies = %lu\n", jiffies);
/* check condition up to 100 ms */
- timeout = msecs_to_jiffies(100);
+ end_time = jiffies + msecs_to_jiffies(100);
while (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) {
- if (timeout <= 0) {
+ if (time_after(jiffies, end_time)) {
snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n");
return;
}
- timeout = schedule_timeout(timeout);
+ msleep(1);
}
snd_printdd("(3) jiffies = %lu\n", jiffies);