aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@us.ibm.com>2005-10-24 09:02:37 -0400
committerJaroslav Kysela <perex@suse.cz>2005-11-04 07:19:49 -0500
commit8433a509c0eb6bb1f33ce39c82c580b8901619ee (patch)
treef1554905dee5da4e840dfd674d5b004124496a22
parentd78bec210f07b06f406b877b9179e0cc281ae8e6 (diff)
[ALSA] Fix schedule_timeout usage
Use schedule_timeout_{,un}interruptible() instead of set_current_state()/schedule_timeout() to reduce kernel size. Also use human-time conversion functions instead of hard-coded division to avoid rounding issues. Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/core/seq/seq_instr.c12
-rw-r--r--sound/core/seq/seq_lock.c3
-rw-r--r--sound/core/seq/seq_memory.c3
-rw-r--r--sound/i2c/cs8427.c3
-rw-r--r--sound/isa/ad1848/ad1848_lib.c6
-rw-r--r--sound/isa/gus/gus_pcm.c3
-rw-r--r--sound/isa/sb/emu8000.c9
-rw-r--r--sound/isa/sb/emu8000_patch.c3
-rw-r--r--sound/isa/sb/emu8000_pcm.c3
-rw-r--r--sound/isa/sscape.c17
-rw-r--r--sound/isa/wavefront/wavefront_synth.c6
-rw-r--r--sound/pci/ac97/ac97_codec.c15
-rw-r--r--sound/pci/ali5451/ali5451.c12
-rw-r--r--sound/pci/atiixp.c3
-rw-r--r--sound/pci/atiixp_modem.c3
-rw-r--r--sound/pci/cs4281.c6
-rw-r--r--sound/pci/ens1370.c3
-rw-r--r--sound/pci/fm801.c9
-rw-r--r--sound/pci/ice1712/pontis.c3
-rw-r--r--sound/pci/intel8x0.c3
-rw-r--r--sound/pci/intel8x0m.c3
-rw-r--r--sound/pci/maestro3.c9
-rw-r--r--sound/pci/mixart/mixart.c3
-rw-r--r--sound/pci/trident/trident_main.c3
-rw-r--r--sound/pci/via82xx.c6
-rw-r--r--sound/pci/via82xx_modem.c6
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c5
-rw-r--r--sound/usb/usbaudio.c3
28 files changed, 51 insertions, 112 deletions
diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c
index 019d43a462d7..1d525b13ebb6 100644
--- a/sound/core/seq/seq_instr.c
+++ b/sound/core/seq/seq_instr.c
@@ -109,8 +109,7 @@ void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr)
109 spin_lock_irqsave(&list->lock, flags); 109 spin_lock_irqsave(&list->lock, flags);
110 while (instr->use) { 110 while (instr->use) {
111 spin_unlock_irqrestore(&list->lock, flags); 111 spin_unlock_irqrestore(&list->lock, flags);
112 set_current_state(TASK_INTERRUPTIBLE); 112 schedule_timeout_interruptible(1);
113 schedule_timeout(1);
114 spin_lock_irqsave(&list->lock, flags); 113 spin_lock_irqsave(&list->lock, flags);
115 } 114 }
116 spin_unlock_irqrestore(&list->lock, flags); 115 spin_unlock_irqrestore(&list->lock, flags);
@@ -199,10 +198,8 @@ int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list,
199 while (flist) { 198 while (flist) {
200 instr = flist; 199 instr = flist;
201 flist = instr->next; 200 flist = instr->next;
202 while (instr->use) { 201 while (instr->use)
203 set_current_state(TASK_INTERRUPTIBLE); 202 schedule_timeout_interruptible(1);
204 schedule_timeout(1);
205 }
206 if (snd_seq_instr_free(instr, atomic)<0) 203 if (snd_seq_instr_free(instr, atomic)<0)
207 snd_printk(KERN_WARNING "instrument free problem\n"); 204 snd_printk(KERN_WARNING "instrument free problem\n");
208 instr = next; 205 instr = next;
@@ -554,8 +551,7 @@ static int instr_free(snd_seq_kinstr_ops_t *ops,
554 instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE); 551 instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE);
555 while (instr->use) { 552 while (instr->use) {
556 spin_unlock_irqrestore(&list->lock, flags); 553 spin_unlock_irqrestore(&list->lock, flags);
557 set_current_state(TASK_INTERRUPTIBLE); 554 schedule_timeout_interruptible(1);
558 schedule_timeout(1);
559 spin_lock_irqsave(&list->lock, flags); 555 spin_lock_irqsave(&list->lock, flags);
560 } 556 }
561 spin_unlock_irqrestore(&list->lock, flags); 557 spin_unlock_irqrestore(&list->lock, flags);
diff --git a/sound/core/seq/seq_lock.c b/sound/core/seq/seq_lock.c
index b09cee058fa7..a837a94b2d2a 100644
--- a/sound/core/seq/seq_lock.c
+++ b/sound/core/seq/seq_lock.c
@@ -39,8 +39,7 @@ void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
39 snd_printk(KERN_WARNING "seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line); 39 snd_printk(KERN_WARNING "seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line);
40 break; 40 break;
41 } 41 }
42 set_current_state(TASK_UNINTERRUPTIBLE); 42 schedule_timeout_uninterruptible(1);
43 schedule_timeout(1);
44 max_count--; 43 max_count--;
45 } 44 }
46} 45}
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index d4d7d326c4b1..8416bcffa091 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -423,8 +423,7 @@ int snd_seq_pool_done(pool_t *pool)
423 snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter)); 423 snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter));
424 break; 424 break;
425 } 425 }
426 set_current_state(TASK_UNINTERRUPTIBLE); 426 schedule_timeout_uninterruptible(1);
427 schedule_timeout(1);
428 max_count--; 427 max_count--;
429 } 428 }
430 429
diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c
index 21133eb6e881..1a05cfbdc7c6 100644
--- a/sound/i2c/cs8427.c
+++ b/sound/i2c/cs8427.c
@@ -302,8 +302,7 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427)
302 snd_i2c_unlock(cs8427->bus); 302 snd_i2c_unlock(cs8427->bus);
303 if (!(data & CS8427_UNLOCK)) 303 if (!(data & CS8427_UNLOCK))
304 break; 304 break;
305 set_current_state(TASK_UNINTERRUPTIBLE); 305 schedule_timeout_uninterruptible(1);
306 schedule_timeout(1);
307 } 306 }
308 snd_i2c_lock(cs8427->bus); 307 snd_i2c_lock(cs8427->bus);
309 chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK; 308 chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK;
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index 744b65a35c9c..891bacc94f68 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -243,8 +243,7 @@ static void snd_ad1848_mce_down(ad1848_t *chip)
243 snd_printk(KERN_ERR "mce_down - auto calibration time out (2)\n"); 243 snd_printk(KERN_ERR "mce_down - auto calibration time out (2)\n");
244 return; 244 return;
245 } 245 }
246 set_current_state(TASK_INTERRUPTIBLE); 246 time = schedule_timeout_interruptible(time);
247 time = schedule_timeout(time);
248 spin_lock_irqsave(&chip->reg_lock, flags); 247 spin_lock_irqsave(&chip->reg_lock, flags);
249 } 248 }
250#if 0 249#if 0
@@ -257,8 +256,7 @@ static void snd_ad1848_mce_down(ad1848_t *chip)
257 snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); 256 snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n");
258 return; 257 return;
259 } 258 }
260 set_current_state(TASK_INTERRUPTIBLE); 259 time = schedule_timeout_interruptible(time);
261 time = schedule_timeout(time);
262 spin_lock_irqsave(&chip->reg_lock, flags); 260 spin_lock_irqsave(&chip->reg_lock, flags);
263 } 261 }
264 spin_unlock_irqrestore(&chip->reg_lock, flags); 262 spin_unlock_irqrestore(&chip->reg_lock, flags);
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index 720c0739c3a5..1cc89fb67bf2 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -333,8 +333,7 @@ static int snd_gf1_pcm_poke_block(snd_gus_card_t *gus, unsigned char *buf,
333 } 333 }
334 } 334 }
335 if (count > 0 && !in_interrupt()) { 335 if (count > 0 && !in_interrupt()) {
336 set_current_state(TASK_INTERRUPTIBLE); 336 schedule_timeout_interruptible(1);
337 schedule_timeout(1);
338 if (signal_pending(current)) 337 if (signal_pending(current))
339 return -EAGAIN; 338 return -EAGAIN;
340 } 339 }
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 95540f133199..b09c6575e01a 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -135,8 +135,7 @@ static void __init
135snd_emu8000_read_wait(emu8000_t *emu) 135snd_emu8000_read_wait(emu8000_t *emu)
136{ 136{
137 while ((EMU8000_SMALR_READ(emu) & 0x80000000) != 0) { 137 while ((EMU8000_SMALR_READ(emu) & 0x80000000) != 0) {
138 set_current_state(TASK_INTERRUPTIBLE); 138 schedule_timeout_interruptible(1);
139 schedule_timeout(1);
140 if (signal_pending(current)) 139 if (signal_pending(current))
141 break; 140 break;
142 } 141 }
@@ -148,8 +147,7 @@ static void __init
148snd_emu8000_write_wait(emu8000_t *emu) 147snd_emu8000_write_wait(emu8000_t *emu)
149{ 148{
150 while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { 149 while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
151 set_current_state(TASK_INTERRUPTIBLE); 150 schedule_timeout_interruptible(1);
152 schedule_timeout(1);
153 if (signal_pending(current)) 151 if (signal_pending(current))
154 break; 152 break;
155 } 153 }
@@ -437,8 +435,7 @@ size_dram(emu8000_t *emu)
437 for (i = 0; i < 10000; i++) { 435 for (i = 0; i < 10000; i++) {
438 if ((EMU8000_SMALW_READ(emu) & 0x80000000) == 0) 436 if ((EMU8000_SMALW_READ(emu) & 0x80000000) == 0)
439 break; 437 break;
440 set_current_state(TASK_INTERRUPTIBLE); 438 schedule_timeout_interruptible(1);
441 schedule_timeout(1);
442 if (signal_pending(current)) 439 if (signal_pending(current))
443 break; 440 break;
444 } 441 }
diff --git a/sound/isa/sb/emu8000_patch.c b/sound/isa/sb/emu8000_patch.c
index 26e693078cb3..2fea67e71c78 100644
--- a/sound/isa/sb/emu8000_patch.c
+++ b/sound/isa/sb/emu8000_patch.c
@@ -109,8 +109,7 @@ static void
109snd_emu8000_write_wait(emu8000_t *emu) 109snd_emu8000_write_wait(emu8000_t *emu)
110{ 110{
111 while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { 111 while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
112 set_current_state(TASK_INTERRUPTIBLE); 112 schedule_timeout_interruptible(1);
113 schedule_timeout(1);
114 if (signal_pending(current)) 113 if (signal_pending(current))
115 break; 114 break;
116 } 115 }
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c
index 0209790dc4b5..b323beeeda15 100644
--- a/sound/isa/sb/emu8000_pcm.c
+++ b/sound/isa/sb/emu8000_pcm.c
@@ -117,8 +117,7 @@ snd_emu8000_write_wait(emu8000_t *emu, int can_schedule)
117{ 117{
118 while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { 118 while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
119 if (can_schedule) { 119 if (can_schedule) {
120 set_current_state(TASK_INTERRUPTIBLE); 120 schedule_timeout_interruptible(1);
121 schedule_timeout(1);
122 if (signal_pending(current)) 121 if (signal_pending(current))
123 break; 122 break;
124 } 123 }
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 1036876146c4..11588067fa4f 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -343,19 +343,6 @@ static void soundscape_free(snd_card_t * c)
343} 343}
344 344
345/* 345/*
346 * Put this process into an idle wait-state for a certain number
347 * of "jiffies". The process can almost certainly be rescheduled
348 * while we're waiting, and so we must NOT be holding any spinlocks
349 * when we call this function. If we are then we risk DEADLOCK in
350 * SMP (Ha!) or pre-emptible kernels.
351 */
352static inline void sleep(long jiffs, int state)
353{
354 set_current_state(state);
355 schedule_timeout(jiffs);
356}
357
358/*
359 * Tell the SoundScape to begin a DMA tranfer using the given channel. 346 * Tell the SoundScape to begin a DMA tranfer using the given channel.
360 * All locking issues are left to the caller. 347 * All locking issues are left to the caller.
361 */ 348 */
@@ -392,7 +379,7 @@ static int obp_startup_ack(struct soundscape *s, unsigned timeout)
392 unsigned long flags; 379 unsigned long flags;
393 unsigned char x; 380 unsigned char x;
394 381
395 sleep(1, TASK_INTERRUPTIBLE); 382 schedule_timeout_interruptible(1);
396 383
397 spin_lock_irqsave(&s->lock, flags); 384 spin_lock_irqsave(&s->lock, flags);
398 x = inb(HOST_DATA_IO(s->io_base)); 385 x = inb(HOST_DATA_IO(s->io_base));
@@ -419,7 +406,7 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout)
419 unsigned long flags; 406 unsigned long flags;
420 unsigned char x; 407 unsigned char x;
421 408
422 sleep(1, TASK_INTERRUPTIBLE); 409 schedule_timeout_interruptible(1);
423 410
424 spin_lock_irqsave(&s->lock, flags); 411 spin_lock_irqsave(&s->lock, flags);
425 x = inb(HOST_DATA_IO(s->io_base)); 412 x = inb(HOST_DATA_IO(s->io_base));
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index 0c3c951009d8..abd79b781412 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -275,8 +275,7 @@ static int
275wavefront_sleep (int limit) 275wavefront_sleep (int limit)
276 276
277{ 277{
278 set_current_state(TASK_INTERRUPTIBLE); 278 schedule_timeout_interruptible(limit);
279 schedule_timeout(limit);
280 279
281 return signal_pending(current); 280 return signal_pending(current);
282} 281}
@@ -1788,8 +1787,7 @@ wavefront_should_cause_interrupt (snd_wavefront_t *dev,
1788 outb (val,port); 1787 outb (val,port);
1789 spin_unlock_irq(&dev->irq_lock); 1788 spin_unlock_irq(&dev->irq_lock);
1790 while (1) { 1789 while (1) {
1791 set_current_state(TASK_INTERRUPTIBLE); 1790 if ((timeout = schedule_timeout_interruptible(timeout)) == 0)
1792 if ((timeout = schedule_timeout(timeout)) == 0)
1793 return; 1791 return;
1794 if (dev->irq_ok) 1792 if (dev->irq_ok)
1795 return; 1793 return;
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index bbc409ae7ee9..3b589104510b 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1745,8 +1745,7 @@ static int ac97_reset_wait(ac97_t *ac97, int timeout, int with_modem)
1745 if ((snd_ac97_read(ac97, AC97_REC_GAIN) & 0x7fff) == 0x0a05) 1745 if ((snd_ac97_read(ac97, AC97_REC_GAIN) & 0x7fff) == 0x0a05)
1746 return 0; 1746 return 0;
1747 } 1747 }
1748 set_current_state(TASK_UNINTERRUPTIBLE); 1748 schedule_timeout_uninterruptible(1);
1749 schedule_timeout(1);
1750 } while (time_after_eq(end_time, jiffies)); 1749 } while (time_after_eq(end_time, jiffies));
1751 return -ENODEV; 1750 return -ENODEV;
1752} 1751}
@@ -1992,8 +1991,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
1992 do { 1991 do {
1993 if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) 1992 if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f)
1994 goto __ready_ok; 1993 goto __ready_ok;
1995 set_current_state(TASK_UNINTERRUPTIBLE); 1994 schedule_timeout_uninterruptible(1);
1996 schedule_timeout(1);
1997 } while (time_after_eq(end_time, jiffies)); 1995 } while (time_after_eq(end_time, jiffies));
1998 snd_printk(KERN_WARNING "AC'97 %d analog subsections not ready\n", ac97->num); 1996 snd_printk(KERN_WARNING "AC'97 %d analog subsections not ready\n", ac97->num);
1999 } 1997 }
@@ -2025,8 +2023,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
2025 do { 2023 do {
2026 if ((snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS) & tmp) == tmp) 2024 if ((snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS) & tmp) == tmp)
2027 goto __ready_ok; 2025 goto __ready_ok;
2028 set_current_state(TASK_UNINTERRUPTIBLE); 2026 schedule_timeout_uninterruptible(1);
2029 schedule_timeout(1);
2030 } while (time_after_eq(end_time, jiffies)); 2027 } while (time_after_eq(end_time, jiffies));
2031 snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS)); 2028 snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS));
2032 } 2029 }
@@ -2260,8 +2257,7 @@ void snd_ac97_resume(ac97_t *ac97)
2260 do { 2257 do {
2261 if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101) 2258 if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101)
2262 break; 2259 break;
2263 set_current_state(TASK_UNINTERRUPTIBLE); 2260 schedule_timeout_uninterruptible(1);
2264 schedule_timeout(1);
2265 } while (time_after_eq(end_time, jiffies)); 2261 } while (time_after_eq(end_time, jiffies));
2266 /* FIXME: extra delay */ 2262 /* FIXME: extra delay */
2267 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); 2263 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000);
@@ -2273,8 +2269,7 @@ void snd_ac97_resume(ac97_t *ac97)
2273 unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID); 2269 unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID);
2274 if (val != 0xffff && (val & 1) != 0) 2270 if (val != 0xffff && (val & 1) != 0)
2275 break; 2271 break;
2276 set_current_state(TASK_UNINTERRUPTIBLE); 2272 schedule_timeout_uninterruptible(1);
2277 schedule_timeout(1);
2278 } while (time_after_eq(end_time, jiffies)); 2273 } while (time_after_eq(end_time, jiffies));
2279 } 2274 }
2280__reset_ready: 2275__reset_ready:
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index e33653439cb5..4e76c4a636d9 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -398,10 +398,8 @@ static int snd_ali_codec_ready( ali_t *codec,
398 res = snd_ali_5451_peek(codec,port); 398 res = snd_ali_5451_peek(codec,port);
399 if (! (res & 0x8000)) 399 if (! (res & 0x8000))
400 return 0; 400 return 0;
401 if (sched) { 401 if (sched)
402 set_current_state(TASK_UNINTERRUPTIBLE); 402 schedule_timeout_uninterruptible(1);
403 schedule_timeout(1);
404 }
405 } while (time_after_eq(end_time, jiffies)); 403 } while (time_after_eq(end_time, jiffies));
406 snd_ali_5451_poke(codec, port, res & ~0x8000); 404 snd_ali_5451_poke(codec, port, res & ~0x8000);
407 snd_printdd("ali_codec_ready: codec is not ready.\n "); 405 snd_printdd("ali_codec_ready: codec is not ready.\n ");
@@ -421,10 +419,8 @@ static int snd_ali_stimer_ready(ali_t *codec, int sched)
421 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); 419 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER);
422 if (dwChk2 != dwChk1) 420 if (dwChk2 != dwChk1)
423 return 0; 421 return 0;
424 if (sched) { 422 if (sched)
425 set_current_state(TASK_UNINTERRUPTIBLE); 423 schedule_timeout_uninterruptible(1);
426 schedule_timeout(1);
427 }
428 } while (time_after_eq(end_time, jiffies)); 424 } while (time_after_eq(end_time, jiffies));
429 snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); 425 snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n");
430 return -EIO; 426 return -EIO;
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index a9314363abd8..f5dad9248e39 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -330,8 +330,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
330 330
331/* delay for one tick */ 331/* delay for one tick */
332#define do_delay() do { \ 332#define do_delay() do { \
333 set_current_state(TASK_UNINTERRUPTIBLE); \ 333 schedule_timeout_uninterruptible(1); \
334 schedule_timeout(1); \
335} while (0) 334} while (0)
336 335
337 336
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 210eb676945c..0cf202079571 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -307,8 +307,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
307 307
308/* delay for one tick */ 308/* delay for one tick */
309#define do_delay() do { \ 309#define do_delay() do { \
310 set_current_state(TASK_UNINTERRUPTIBLE); \ 310 schedule_timeout_uninterruptible(1); \
311 schedule_timeout(1); \
312} while (0) 311} while (0)
313 312
314 313
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index dc87e0144b5a..aea2c47712f9 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -523,8 +523,7 @@ static void snd_cs4281_delay(unsigned int delay)
523 delay = 1; 523 delay = 1;
524 end_time = jiffies + delay; 524 end_time = jiffies + delay;
525 do { 525 do {
526 set_current_state(TASK_UNINTERRUPTIBLE); 526 schedule_timeout_uninterruptible(1);
527 schedule_timeout(1);
528 } while (time_after_eq(end_time, jiffies)); 527 } while (time_after_eq(end_time, jiffies));
529 } else { 528 } else {
530 udelay(delay); 529 udelay(delay);
@@ -533,8 +532,7 @@ static void snd_cs4281_delay(unsigned int delay)
533 532
534static inline void snd_cs4281_delay_long(void) 533static inline void snd_cs4281_delay_long(void)
535{ 534{
536 set_current_state(TASK_UNINTERRUPTIBLE); 535 schedule_timeout_uninterruptible(1);
537 schedule_timeout(1);
538} 536}
539 537
540static inline void snd_cs4281_pokeBA0(cs4281_t *chip, unsigned long offset, unsigned int val) 538static inline void snd_cs4281_pokeBA0(cs4281_t *chip, unsigned long offset, unsigned int val)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index b4d0a9c2b0b5..92ff7c510f2b 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -576,8 +576,7 @@ static void snd_es1370_codec_write(ak4531_t *ak4531,
576 outw(ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); 576 outw(ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC));
577 return; 577 return;
578 } 578 }
579 set_current_state(TASK_UNINTERRUPTIBLE); 579 schedule_timeout_uninterruptible(1);
580 schedule_timeout(1);
581 } while (time_after(end_time, jiffies)); 580 } while (time_after(end_time, jiffies));
582 snd_printk(KERN_ERR "codec write timeout, status = 0x%x\n", inl(ES_REG(ensoniq, STATUS))); 581 snd_printk(KERN_ERR "codec write timeout, status = 0x%x\n", inl(ES_REG(ensoniq, STATUS)));
583} 582}
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 47dbe317069f..4c7c8d225c7f 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1303,8 +1303,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
1303 do { 1303 do {
1304 if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8)) 1304 if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8))
1305 goto __ac97_secondary; 1305 goto __ac97_secondary;
1306 set_current_state(TASK_UNINTERRUPTIBLE); 1306 schedule_timeout_uninterruptible(1);
1307 schedule_timeout(1);
1308 } while (time_after(timeout, jiffies)); 1307 } while (time_after(timeout, jiffies));
1309 snd_printk(KERN_ERR "Primary AC'97 codec not found\n"); 1308 snd_printk(KERN_ERR "Primary AC'97 codec not found\n");
1310 snd_fm801_free(chip); 1309 snd_fm801_free(chip);
@@ -1329,8 +1328,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
1329 goto __ac97_ok; 1328 goto __ac97_ok;
1330 } 1329 }
1331 } 1330 }
1332 set_current_state(TASK_UNINTERRUPTIBLE); 1331 schedule_timeout_uninterruptible(1);
1333 schedule_timeout(1);
1334 } while (time_after(timeout, jiffies)); 1332 } while (time_after(timeout, jiffies));
1335 } 1333 }
1336 1334
@@ -1343,8 +1341,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
1343 do { 1341 do {
1344 if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8)) 1342 if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8))
1345 goto __ac97_ok; 1343 goto __ac97_ok;
1346 set_current_state(TASK_UNINTERRUPTIBLE); 1344 schedule_timeout_uninterruptible(1);
1347 schedule_timeout(1);
1348 } while (time_after(timeout, jiffies)); 1345 } while (time_after(timeout, jiffies));
1349 snd_printk(KERN_ERR "Primary AC'97 codec not responding\n"); 1346 snd_printk(KERN_ERR "Primary AC'97 codec not responding\n");
1350 snd_fm801_free(chip); 1347 snd_fm801_free(chip);
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c
index a5f852b1f575..773a1ecb75ce 100644
--- a/sound/pci/ice1712/pontis.c
+++ b/sound/pci/ice1712/pontis.c
@@ -794,8 +794,7 @@ static int __devinit pontis_init(ice1712_t *ice)
794 /* initialize WM8776 codec */ 794 /* initialize WM8776 codec */
795 for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) 795 for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2)
796 wm_put(ice, wm_inits[i], wm_inits[i+1]); 796 wm_put(ice, wm_inits[i], wm_inits[i+1]);
797 set_current_state(TASK_UNINTERRUPTIBLE); 797 schedule_timeout_uninterruptible(1);
798 schedule_timeout(1);
799 for (i = 0; i < ARRAY_SIZE(wm_inits2); i += 2) 798 for (i = 0; i < ARRAY_SIZE(wm_inits2); i += 2)
800 wm_put(ice, wm_inits2[i], wm_inits2[i+1]); 799 wm_put(ice, wm_inits2[i], wm_inits2[i+1]);
801 800
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 383a3ac5ecba..c2f050215321 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2144,8 +2144,7 @@ static void do_ali_reset(intel8x0_t *chip)
2144} 2144}
2145 2145
2146#define do_delay(chip) do {\ 2146#define do_delay(chip) do {\
2147 set_current_state(TASK_UNINTERRUPTIBLE);\ 2147 schedule_timeout_uninterruptible(1);\
2148 schedule_timeout(1);\
2149} while (0) 2148} while (0)
2150 2149
2151static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) 2150static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing)
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 49a9f4d08963..acfb197a833c 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -890,8 +890,7 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
890 */ 890 */
891 891
892#define do_delay(chip) do {\ 892#define do_delay(chip) do {\
893 set_current_state(TASK_UNINTERRUPTIBLE);\ 893 schedule_timeout_uninterruptible(1);\
894 schedule_timeout(1);\
895} while (0) 894} while (0)
896 895
897static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) 896static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index ad77b4145824..99eb76c56f81 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2046,8 +2046,7 @@ static void snd_m3_ac97_reset(m3_t *chip)
2046 outw(0, io + GPIO_DATA); 2046 outw(0, io + GPIO_DATA);
2047 outw(dir | GPO_PRIMARY_AC97, io + GPIO_DIRECTION); 2047 outw(dir | GPO_PRIMARY_AC97, io + GPIO_DIRECTION);
2048 2048
2049 set_current_state(TASK_UNINTERRUPTIBLE); 2049 schedule_timeout_uninterruptible(msecs_to_jiffies(delay1));
2050 schedule_timeout((delay1 * HZ) / 1000);
2051 2050
2052 outw(GPO_PRIMARY_AC97, io + GPIO_DATA); 2051 outw(GPO_PRIMARY_AC97, io + GPIO_DATA);
2053 udelay(5); 2052 udelay(5);
@@ -2055,8 +2054,7 @@ static void snd_m3_ac97_reset(m3_t *chip)
2055 outw(IO_SRAM_ENABLE | SERIAL_AC_LINK_ENABLE, io + RING_BUS_CTRL_A); 2054 outw(IO_SRAM_ENABLE | SERIAL_AC_LINK_ENABLE, io + RING_BUS_CTRL_A);
2056 outw(~0, io + GPIO_MASK); 2055 outw(~0, io + GPIO_MASK);
2057 2056
2058 set_current_state(TASK_UNINTERRUPTIBLE); 2057 schedule_timeout_uninterruptible(msecs_to_jiffies(delay2));
2059 schedule_timeout((delay2 * HZ) / 1000);
2060 2058
2061 if (! snd_m3_try_read_vendor(chip)) 2059 if (! snd_m3_try_read_vendor(chip))
2062 break; 2060 break;
@@ -2101,8 +2099,7 @@ static int __devinit snd_m3_mixer(m3_t *chip)
2101 2099
2102 /* seems ac97 PCM needs initialization.. hack hack.. */ 2100 /* seems ac97 PCM needs initialization.. hack hack.. */
2103 snd_ac97_write(chip->ac97, AC97_PCM, 0x8000 | (15 << 8) | 15); 2101 snd_ac97_write(chip->ac97, AC97_PCM, 0x8000 | (15 << 8) | 15);
2104 set_current_state(TASK_UNINTERRUPTIBLE); 2102 schedule_timeout_uninterruptible(msecs_to_jiffies(100));
2105 schedule_timeout(HZ / 10);
2106 snd_ac97_write(chip->ac97, AC97_PCM, 0); 2103 snd_ac97_write(chip->ac97, AC97_PCM, 0);
2107 2104
2108 memset(&id, 0, sizeof(id)); 2105 memset(&id, 0, sizeof(id));
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 1a62c7f6c52b..c341c99ec783 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -451,8 +451,7 @@ static int mixart_sync_nonblock_events(mixart_mgr_t *mgr)
451 snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n"); 451 snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n");
452 return -EBUSY; 452 return -EBUSY;
453 } 453 }
454 set_current_state(TASK_UNINTERRUPTIBLE); 454 schedule_timeout_uninterruptible(1);
455 schedule_timeout(1);
456 } 455 }
457 return 0; 456 return 0;
458} 457}
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 08226f523eb8..b9b93c7faafd 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -3207,8 +3207,7 @@ static inline void snd_trident_free_gameport(trident_t *chip) { }
3207 */ 3207 */
3208static inline void do_delay(trident_t *chip) 3208static inline void do_delay(trident_t *chip)
3209{ 3209{
3210 set_current_state(TASK_UNINTERRUPTIBLE); 3210 schedule_timeout_uninterruptible(1);
3211 schedule_timeout(1);
3212} 3211}
3213 3212
3214/* 3213/*
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 9b2bea866d1b..523eace250f7 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2027,8 +2027,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
2027 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); 2027 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
2028 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ 2028 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
2029 break; 2029 break;
2030 set_current_state(TASK_UNINTERRUPTIBLE); 2030 schedule_timeout_uninterruptible(1);
2031 schedule_timeout(1);
2032 } while (time_before(jiffies, end_time)); 2031 } while (time_before(jiffies, end_time));
2033 2032
2034 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) 2033 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
@@ -2047,8 +2046,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
2047 chip->ac97_secondary = 1; 2046 chip->ac97_secondary = 1;
2048 goto __ac97_ok2; 2047 goto __ac97_ok2;
2049 } 2048 }
2050 set_current_state(TASK_INTERRUPTIBLE); 2049 schedule_timeout_interruptible(1);
2051 schedule_timeout(1);
2052 } while (time_before(jiffies, end_time)); 2050 } while (time_before(jiffies, end_time));
2053 /* This is ok, the most of motherboards have only one codec */ 2051 /* This is ok, the most of motherboards have only one codec */
2054 2052
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index bc7330ace96a..011f0fb63bf9 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -968,8 +968,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
968 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); 968 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
969 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ 969 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
970 break; 970 break;
971 set_current_state(TASK_UNINTERRUPTIBLE); 971 schedule_timeout_uninterruptible(1);
972 schedule_timeout(1);
973 } while (time_before(jiffies, end_time)); 972 } while (time_before(jiffies, end_time));
974 973
975 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) 974 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
@@ -987,8 +986,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
987 chip->ac97_secondary = 1; 986 chip->ac97_secondary = 1;
988 goto __ac97_ok2; 987 goto __ac97_ok2;
989 } 988 }
990 set_current_state(TASK_INTERRUPTIBLE); 989 schedule_timeout_interruptible(1);
991 schedule_timeout(1);
992 } while (time_before(jiffies, end_time)); 990 } while (time_before(jiffies, end_time));
993 /* This is ok, the most of motherboards have only one codec */ 991 /* This is ok, the most of motherboards have only one codec */
994 992
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index a53117733d51..88a43e091d77 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -92,7 +92,7 @@ static int snd_ymfpci_codec_ready(ymfpci_t *chip, int secondary)
92 if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0) 92 if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0)
93 return 0; 93 return 0;
94 set_current_state(TASK_UNINTERRUPTIBLE); 94 set_current_state(TASK_UNINTERRUPTIBLE);
95 schedule_timeout(1); 95 schedule_timeout_uninterruptible(1);
96 } while (time_before(jiffies, end_time)); 96 } while (time_before(jiffies, end_time));
97 snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg)); 97 snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg));
98 return -EBUSY; 98 return -EBUSY;
@@ -728,8 +728,7 @@ static void snd_ymfpci_irq_wait(ymfpci_t *chip)
728 init_waitqueue_entry(&wait, current); 728 init_waitqueue_entry(&wait, current);
729 add_wait_queue(&chip->interrupt_sleep, &wait); 729 add_wait_queue(&chip->interrupt_sleep, &wait);
730 atomic_inc(&chip->interrupt_sleep_count); 730 atomic_inc(&chip->interrupt_sleep_count);
731 set_current_state(TASK_UNINTERRUPTIBLE); 731 schedule_timeout_uninterruptible(msecs_to_jiffies(50));
732 schedule_timeout(HZ/20);
733 remove_wait_queue(&chip->interrupt_sleep, &wait); 732 remove_wait_queue(&chip->interrupt_sleep, &wait);
734 } 733 }
735} 734}
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index fce6ad62df6c..8818918c4237 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -838,8 +838,7 @@ static int wait_clear_urbs(snd_usb_substream_t *subs)
838 } 838 }
839 if (! alive) 839 if (! alive)
840 break; 840 break;
841 set_current_state(TASK_UNINTERRUPTIBLE); 841 schedule_timeout_uninterruptible(1);
842 schedule_timeout(1);
843 } while (time_before(jiffies, end_time)); 842 } while (time_before(jiffies, end_time));
844 if (alive) 843 if (alive)
845 snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive); 844 snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive);