[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>
This commit is contained in:
Nishanth Aravamudan
2005-10-24 15:02:37 +02:00
committed by Jaroslav Kysela
父節點 d78bec210f
當前提交 8433a509c0
共有 28 個文件被更改,包括 51 次插入112 次删除

查看文件

@@ -243,8 +243,7 @@ static void snd_ad1848_mce_down(ad1848_t *chip)
snd_printk(KERN_ERR "mce_down - auto calibration time out (2)\n");
return;
}
set_current_state(TASK_INTERRUPTIBLE);
time = schedule_timeout(time);
time = schedule_timeout_interruptible(time);
spin_lock_irqsave(&chip->reg_lock, flags);
}
#if 0
@@ -257,8 +256,7 @@ static void snd_ad1848_mce_down(ad1848_t *chip)
snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n");
return;
}
set_current_state(TASK_INTERRUPTIBLE);
time = schedule_timeout(time);
time = schedule_timeout_interruptible(time);
spin_lock_irqsave(&chip->reg_lock, flags);
}
spin_unlock_irqrestore(&chip->reg_lock, flags);

查看文件

@@ -333,8 +333,7 @@ static int snd_gf1_pcm_poke_block(snd_gus_card_t *gus, unsigned char *buf,
}
}
if (count > 0 && !in_interrupt()) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
schedule_timeout_interruptible(1);
if (signal_pending(current))
return -EAGAIN;
}

查看文件

@@ -135,8 +135,7 @@ static void __init
snd_emu8000_read_wait(emu8000_t *emu)
{
while ((EMU8000_SMALR_READ(emu) & 0x80000000) != 0) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
schedule_timeout_interruptible(1);
if (signal_pending(current))
break;
}
@@ -148,8 +147,7 @@ static void __init
snd_emu8000_write_wait(emu8000_t *emu)
{
while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
schedule_timeout_interruptible(1);
if (signal_pending(current))
break;
}
@@ -437,8 +435,7 @@ size_dram(emu8000_t *emu)
for (i = 0; i < 10000; i++) {
if ((EMU8000_SMALW_READ(emu) & 0x80000000) == 0)
break;
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
schedule_timeout_interruptible(1);
if (signal_pending(current))
break;
}

查看文件

@@ -109,8 +109,7 @@ static void
snd_emu8000_write_wait(emu8000_t *emu)
{
while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
schedule_timeout_interruptible(1);
if (signal_pending(current))
break;
}

查看文件

@@ -117,8 +117,7 @@ snd_emu8000_write_wait(emu8000_t *emu, int can_schedule)
{
while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
if (can_schedule) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
schedule_timeout_interruptible(1);
if (signal_pending(current))
break;
}

查看文件

@@ -342,19 +342,6 @@ static void soundscape_free(snd_card_t * c)
free_dma(sscape->chip->dma1);
}
/*
* Put this process into an idle wait-state for a certain number
* of "jiffies". The process can almost certainly be rescheduled
* while we're waiting, and so we must NOT be holding any spinlocks
* when we call this function. If we are then we risk DEADLOCK in
* SMP (Ha!) or pre-emptible kernels.
*/
static inline void sleep(long jiffs, int state)
{
set_current_state(state);
schedule_timeout(jiffs);
}
/*
* Tell the SoundScape to begin a DMA tranfer using the given channel.
* All locking issues are left to the caller.
@@ -392,7 +379,7 @@ static int obp_startup_ack(struct soundscape *s, unsigned timeout)
unsigned long flags;
unsigned char x;
sleep(1, TASK_INTERRUPTIBLE);
schedule_timeout_interruptible(1);
spin_lock_irqsave(&s->lock, flags);
x = inb(HOST_DATA_IO(s->io_base));
@@ -419,7 +406,7 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout)
unsigned long flags;
unsigned char x;
sleep(1, TASK_INTERRUPTIBLE);
schedule_timeout_interruptible(1);
spin_lock_irqsave(&s->lock, flags);
x = inb(HOST_DATA_IO(s->io_base));

查看文件

@@ -275,8 +275,7 @@ static int
wavefront_sleep (int limit)
{
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(limit);
schedule_timeout_interruptible(limit);
return signal_pending(current);
}
@@ -1788,8 +1787,7 @@ wavefront_should_cause_interrupt (snd_wavefront_t *dev,
outb (val,port);
spin_unlock_irq(&dev->irq_lock);
while (1) {
set_current_state(TASK_INTERRUPTIBLE);
if ((timeout = schedule_timeout(timeout)) == 0)
if ((timeout = schedule_timeout_interruptible(timeout)) == 0)
return;
if (dev->irq_ok)
return;