diff options
author | Jaroslav Kysela <perex@suse.cz> | 2004-11-11 13:22:49 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2004-11-11 13:22:49 +0100 |
commit | 0b7c1313fd741da9e0a56cc5558b7b81e92e8b15 (patch) | |
tree | d75281a16a7f4acca6f19ba8332bfeefe3cb3af1 /sound | |
parent | f4b1da09c79cb33493e845aec78e3867fe70a7bc (diff) | |
download | history-0b7c1313fd741da9e0a56cc5558b7b81e92e8b15.tar.gz |
[ALSA] replace schedule_timeout() with msleep()
CS4231 driver
Uses msleep() instead of schedule_timeout() to guarantee
the task delays as expected. This lead to several related changes, as
the current code assumes the value of HZ is 100. Use timeout as an
iteration variable to count out how many 10ms delays should be used.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/isa/cs423x/cs4231_lib.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index d323e36378f8a1..c09a6d4193df6d 100644 --- a/sound/isa/cs423x/cs4231_lib.c +++ b/sound/isa/cs423x/cs4231_lib.c @@ -356,7 +356,6 @@ void snd_cs4231_mce_down(cs4231_t *chip) { unsigned long flags; int timeout; - signed long time; snd_cs4231_busy_wait(chip); #if 0 @@ -390,34 +389,26 @@ void snd_cs4231_mce_down(cs4231_t *chip) #if 0 printk("(2) timeout = %i, jiffies = %li\n", timeout, jiffies); #endif - timeout = HZ / 4 / 2; - time = 2; + /* in 10 ms increments, check condition, up to 250 ms */ + timeout = 25; while (snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) { - set_current_state(TASK_INTERRUPTIBLE); - time = schedule_timeout(time); - if (time > 0) - continue; - time = 2; if (--timeout < 0) { snd_printk("mce_down - auto calibration time out (2)\n"); return; } + msleep(10); } #if 0 printk("(3) jiffies = %li\n", jiffies); #endif - timeout = HZ / 10 / 2; - time = 2; + /* in 10 ms increments, check condition, up to 100 ms */ + timeout = 10; while (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) { - set_current_state(TASK_INTERRUPTIBLE); - time = schedule_timeout(time); - if (time > 0) - continue; - time = 2; if (--timeout < 0) { snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); return; } + msleep(10); } #if 0 printk("(4) jiffies = %li\n", jiffies); |