diff options
Diffstat (limited to 'sound/isa/cs423x')
-rw-r--r-- | sound/isa/cs423x/cs4231_lib.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index 72cf77159083..a5eb9659b519 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) | |||
313 | void snd_cs4231_mce_down(struct snd_cs4231 *chip) | 313 | void snd_cs4231_mce_down(struct snd_cs4231 *chip) |
314 | { | 314 | { |
315 | unsigned long flags; | 315 | unsigned long flags; |
316 | unsigned long end_time; | ||
316 | int timeout; | 317 | int timeout; |
317 | 318 | ||
318 | snd_cs4231_busy_wait(chip); | 319 | snd_cs4231_busy_wait(chip); |
@@ -344,28 +345,28 @@ void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
344 | snd_printdd("(1) jiffies = %lu\n", jiffies); | 345 | snd_printdd("(1) jiffies = %lu\n", jiffies); |
345 | 346 | ||
346 | /* check condition up to 250 ms */ | 347 | /* check condition up to 250 ms */ |
347 | timeout = msecs_to_jiffies(250); | 348 | end_time = jiffies + msecs_to_jiffies(250); |
348 | while (snd_cs4231_in(chip, CS4231_TEST_INIT) & | 349 | while (snd_cs4231_in(chip, CS4231_TEST_INIT) & |
349 | CS4231_CALIB_IN_PROGRESS) { | 350 | CS4231_CALIB_IN_PROGRESS) { |
350 | 351 | ||
351 | if (timeout <= 0) { | 352 | if (time_after(jiffies, end_time)) { |
352 | snd_printk(KERN_ERR "mce_down - " | 353 | snd_printk(KERN_ERR "mce_down - " |
353 | "auto calibration time out (2)\n"); | 354 | "auto calibration time out (2)\n"); |
354 | return; | 355 | return; |
355 | } | 356 | } |
356 | timeout = schedule_timeout(timeout); | 357 | msleep(1); |
357 | } | 358 | } |
358 | 359 | ||
359 | snd_printdd("(2) jiffies = %lu\n", jiffies); | 360 | snd_printdd("(2) jiffies = %lu\n", jiffies); |
360 | 361 | ||
361 | /* check condition up to 100 ms */ | 362 | /* check condition up to 100 ms */ |
362 | timeout = msecs_to_jiffies(100); | 363 | end_time = jiffies + msecs_to_jiffies(100); |
363 | while (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) { | 364 | while (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) { |
364 | if (timeout <= 0) { | 365 | if (time_after(jiffies, end_time)) { |
365 | snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); | 366 | snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); |
366 | return; | 367 | return; |
367 | } | 368 | } |
368 | timeout = schedule_timeout(timeout); | 369 | msleep(1); |
369 | } | 370 | } |
370 | 371 | ||
371 | snd_printdd("(3) jiffies = %lu\n", jiffies); | 372 | snd_printdd("(3) jiffies = %lu\n", jiffies); |