aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
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 /sound/isa
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>
Diffstat (limited to 'sound/isa')
-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
7 files changed, 12 insertions, 35 deletions
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;