aboutsummaryrefslogtreecommitdiffstats
path: root/sound/sparc
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-09-11 04:12:14 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 10:52:12 -0400
commitb875d650527e1980cc88b2731ac4c209d2e4a0ca (patch)
tree6625ab415821399bd031122fff59fb0e526e9d68 /sound/sparc
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/sparc')
-rw-r--r--sound/sparc/cs4231.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index ab39860e2404..9785382a5f39 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -401,6 +401,7 @@ static void snd_cs4231_mce_up(struct snd_cs4231 *chip)
401static void snd_cs4231_mce_down(struct snd_cs4231 *chip) 401static void snd_cs4231_mce_down(struct snd_cs4231 *chip)
402{ 402{
403 unsigned long flags; 403 unsigned long flags;
404 unsigned long end_time;
404 int timeout; 405 int timeout;
405 406
406 spin_lock_irqsave(&chip->lock, flags); 407 spin_lock_irqsave(&chip->lock, flags);
@@ -431,30 +432,30 @@ static void snd_cs4231_mce_down(struct snd_cs4231 *chip)
431 msleep(1); 432 msleep(1);
432 433
433 /* check condition up to 250ms */ 434 /* check condition up to 250ms */
434 timeout = msecs_to_jiffies(250); 435 end_time = jiffies + msecs_to_jiffies(250);
435 while (snd_cs4231_in(chip, CS4231_TEST_INIT) & 436 while (snd_cs4231_in(chip, CS4231_TEST_INIT) &
436 CS4231_CALIB_IN_PROGRESS) { 437 CS4231_CALIB_IN_PROGRESS) {
437 438
438 spin_unlock_irqrestore(&chip->lock, flags); 439 spin_unlock_irqrestore(&chip->lock, flags);
439 if (timeout <= 0) { 440 if (time_after(jiffies, end_time)) {
440 snd_printk("mce_down - " 441 snd_printk("mce_down - "
441 "auto calibration time out (2)\n"); 442 "auto calibration time out (2)\n");
442 return; 443 return;
443 } 444 }
444 timeout = schedule_timeout(timeout); 445 msleep(1);
445 spin_lock_irqsave(&chip->lock, flags); 446 spin_lock_irqsave(&chip->lock, flags);
446 } 447 }
447 448
448 /* check condition up to 100ms */ 449 /* check condition up to 100ms */
449 timeout = msecs_to_jiffies(100); 450 end_time = jiffies + msecs_to_jiffies(100);
450 while (__cs4231_readb(chip, CS4231U(chip, REGSEL)) & CS4231_INIT) { 451 while (__cs4231_readb(chip, CS4231U(chip, REGSEL)) & CS4231_INIT) {
451 spin_unlock_irqrestore(&chip->lock, flags); 452 spin_unlock_irqrestore(&chip->lock, flags);
452 if (timeout <= 0) { 453 if (time_after(jiffies, end_time)) {
453 snd_printk("mce_down - " 454 snd_printk("mce_down - "
454 "auto calibration time out (3)\n"); 455 "auto calibration time out (3)\n");
455 return; 456 return;
456 } 457 }
457 timeout = schedule_timeout(timeout); 458 msleep(1);
458 spin_lock_irqsave(&chip->lock, flags); 459 spin_lock_irqsave(&chip->lock, flags);
459 } 460 }
460 spin_unlock_irqrestore(&chip->lock, flags); 461 spin_unlock_irqrestore(&chip->lock, flags);