aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2007-09-17 06:52:43 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 10:50:40 -0400
commitf79415207ea60109d34bed89b2f3ed303a18d24b (patch)
treeb6e7fab8229481ef05b9488ae2f5479a5068b141 /sound/isa
parent3a5bdee5fa98bfd7d04c61b37b746eb918472e82 (diff)
[ALSA] ad1848_lib: waiting loops done after cs4231_lib
This patch fixes ad1848_lib waiting loops to be the same as in the cs4231_lib. Acked-by: Rene Herman <rene.herman@gmail.com> Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> 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/ad1848/ad1848_lib.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index eee941be3b74..330b5ced01aa 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -205,7 +205,7 @@ static void snd_ad1848_mce_down(struct snd_ad1848 *chip)
205{ 205{
206 unsigned long flags; 206 unsigned long flags;
207 int timeout; 207 int timeout;
208 signed long time; 208 unsigned long end_time;
209 209
210 spin_lock_irqsave(&chip->reg_lock, flags); 210 spin_lock_irqsave(&chip->reg_lock, flags);
211 for (timeout = 5; timeout > 0; timeout--) 211 for (timeout = 5; timeout > 0; timeout--)
@@ -240,27 +240,27 @@ static void snd_ad1848_mce_down(struct snd_ad1848 *chip)
240 240
241 snd_printdd("(2) jiffies = %lu\n", jiffies); 241 snd_printdd("(2) jiffies = %lu\n", jiffies);
242 242
243 time = msecs_to_jiffies(250); 243 end_time = jiffies + msecs_to_jiffies(250);
244 while (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) { 244 while (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) {
245 spin_unlock_irqrestore(&chip->reg_lock, flags); 245 spin_unlock_irqrestore(&chip->reg_lock, flags);
246 if (time <= 0) { 246 if (time_after(jiffies, end_time)) {
247 snd_printk(KERN_ERR "mce_down - auto calibration time out (2)\n"); 247 snd_printk(KERN_ERR "mce_down - auto calibration time out (2)\n");
248 return; 248 return;
249 } 249 }
250 time = schedule_timeout(time); 250 msleep(1);
251 spin_lock_irqsave(&chip->reg_lock, flags); 251 spin_lock_irqsave(&chip->reg_lock, flags);
252 } 252 }
253 253
254 snd_printdd("(3) jiffies = %lu\n", jiffies); 254 snd_printdd("(3) jiffies = %lu\n", jiffies);
255 255
256 time = msecs_to_jiffies(100); 256 end_time = jiffies + msecs_to_jiffies(100);
257 while (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) { 257 while (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) {
258 spin_unlock_irqrestore(&chip->reg_lock, flags); 258 spin_unlock_irqrestore(&chip->reg_lock, flags);
259 if (time <= 0) { 259 if (time_after(jiffies, end_time)) {
260 snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); 260 snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n");
261 return; 261 return;
262 } 262 }
263 time = schedule_timeout(time); 263 msleep(1);
264 spin_lock_irqsave(&chip->reg_lock, flags); 264 spin_lock_irqsave(&chip->reg_lock, flags);
265 } 265 }
266 spin_unlock_irqrestore(&chip->reg_lock, flags); 266 spin_unlock_irqrestore(&chip->reg_lock, flags);