Update of /cvsroot/alsa/alsa-kernel/core
In directory sc8-pr-cvs1:/tmp/cvs-serv13340/core
Modified Files:
control.c hwdep.c init.c pcm_lib.c pcm_native.c rawmidi.c
timer.c
Log Message:
Revised schedule() and set_current_state() calls.
Replaced need_resched() with cond_resched() call.
Index: control.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/control.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- control.c 25 Sep 2003 18:55:42 -0000 1.37
+++ control.c 30 Sep 2003 09:28:26 -0000 1.38
@@ -822,10 +822,9 @@
}
init_waitqueue_entry(&wait, current);
add_wait_queue(&ctl->change_sleep, &wait);
- spin_unlock_irq(&ctl->read_lock);
set_current_state(TASK_INTERRUPTIBLE);
+ spin_unlock_irq(&ctl->read_lock);
schedule();
- set_current_state(TASK_RUNNING);
remove_wait_queue(&ctl->change_sleep, &wait);
if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS;
Index: hwdep.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/hwdep.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- hwdep.c 25 Sep 2003 18:55:42 -0000 1.21
+++ hwdep.c 30 Sep 2003 09:28:26 -0000 1.22
@@ -129,13 +129,14 @@
} else
break;
set_current_state(TASK_INTERRUPTIBLE);
+ up(&hw->open_mutex);
schedule();
+ down(&hw->open_mutex);
if (signal_pending(current)) {
err = -ERESTARTSYS;
break;
}
}
- set_current_state(TASK_RUNNING);
remove_wait_queue(&hw->open_wait, &wait);
if (err >= 0) {
err = snd_card_file_add(hw->card, file);
Index: init.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/init.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- init.c 6 Jun 2003 09:21:49 -0000 1.38
+++ init.c 30 Sep 2003 09:28:26 -0000 1.39
@@ -697,8 +697,8 @@
}
if (file && (file->f_flags & O_NONBLOCK))
return -EAGAIN;
- snd_power_unlock(card);
set_current_state(TASK_UNINTERRUPTIBLE);
+ snd_power_unlock(card);
schedule_timeout(30 * HZ);
snd_power_lock(card);
}
Index: pcm_lib.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/pcm_lib.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- pcm_lib.c 22 Jul 2003 18:43:18 -0000 1.43
+++ pcm_lib.c 30 Sep 2003 09:28:26 -0000 1.44
@@ -2106,11 +2106,11 @@
init_waitqueue_entry(&wait, current);
add_wait_queue(&runtime->sleep, &wait);
while (1) {
- set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) {
state = SIGNALED;
break;
}
+ set_current_state(TASK_INTERRUPTIBLE);
snd_pcm_stream_unlock_irq(substream);
tout = schedule_timeout(10 * HZ);
snd_pcm_stream_lock_irq(substream);
@@ -2139,7 +2139,6 @@
}
}
_end_loop:
- set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait);
switch (state) {
@@ -2401,11 +2400,11 @@
init_waitqueue_entry(&wait, current);
add_wait_queue(&runtime->sleep, &wait);
while (1) {
- set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) {
state = SIGNALED;
break;
}
+ set_current_state(TASK_INTERRUPTIBLE);
snd_pcm_stream_unlock_irq(substream);
tout = schedule_timeout(10 * HZ);
snd_pcm_stream_lock_irq(substream);
@@ -2435,7 +2434,6 @@
}
}
_end_loop:
- set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait);
switch (state) {
Index: pcm_native.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/pcm_native.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- pcm_native.c 25 Sep 2003 18:55:42 -0000 1.81
+++ pcm_native.c 30 Sep 2003 09:28:26 -0000 1.82
@@ -1237,11 +1237,11 @@
add_wait_queue(&runtime->sleep, &wait);
while (1) {
long tout;
- set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) {
state = SIGNALED;
break;
}
+ set_current_state(TASK_INTERRUPTIBLE);
snd_pcm_stream_unlock_irq(substream);
tout = schedule_timeout(10 * HZ);
snd_pcm_stream_lock_irq(substream);
@@ -1254,7 +1254,6 @@
break;
}
}
- set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait);
switch (state) {
@@ -1961,12 +1960,11 @@
}
init_waitqueue_entry(&wait, current);
add_wait_queue(&pcm->open_wait, &wait);
+ down(&pcm->open_mutex);
while (1) {
- down(&pcm->open_mutex);
err = snd_pcm_open_file(file, pcm, device >= SNDRV_MINOR_PCM_CAPTURE ?
SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK, &pcm_file);
if (err >= 0)
break;
- up(&pcm->open_mutex);
if (err == -EAGAIN) {
if (file->f_flags & O_NONBLOCK) {
err = -EBUSY;
@@ -1975,13 +1973,14 @@
} else
break;
set_current_state(TASK_INTERRUPTIBLE);
+ up(&pcm->open_mutex);
schedule();
+ down(&pcm->open_mutex);
if (signal_pending(current)) {
err = -ERESTARTSYS;
break;
}
}
- set_current_state(TASK_RUNNING);
remove_wait_queue(&pcm->open_wait, &wait);
if (err < 0)
goto __error;
Index: rawmidi.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/rawmidi.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- rawmidi.c 25 Sep 2003 18:55:42 -0000 1.37
+++ rawmidi.c 30 Sep 2003 09:28:26 -0000 1.38
@@ -191,7 +191,8 @@
err = -EFAULT;
goto __error1;
}
- down(&rmidi->open_mutex);
+ if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK))
+ down(&rmidi->open_mutex);
if (mode & SNDRV_RAWMIDI_LFLG_INPUT) {
if (!(rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT)) {
err = -ENXIO;
@@ -320,7 +321,8 @@
} else {
soutput = NULL;
}
- up(&rmidi->open_mutex);
+ if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK))
+ up(&rmidi->open_mutex);
if (rfile) {
rfile->rmidi = rmidi;
rfile->input = sinput;
@@ -338,7 +340,8 @@
kfree(output);
}
module_put(rmidi->card->module);
- up(&rmidi->open_mutex);
+ if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK))
+ up(&rmidi->open_mutex);
__error1:
return err;
}
@@ -392,6 +395,7 @@
fflags = snd_rawmidi_file_flags(file);
if ((file->f_flags & O_APPEND) || maj != CONFIG_SND_MAJOR) /* OSS emul? */
fflags |= SNDRV_RAWMIDI_LFLG_APPEND;
+ fflags |= SNDRV_RAWMIDI_LFLG_NOOPENLOCK;
rawmidi_file = snd_magic_kmalloc(snd_rawmidi_file_t, 0, GFP_KERNEL);
if (rawmidi_file == NULL) {
snd_card_file_remove(card, file);
@@ -399,6 +403,7 @@
}
init_waitqueue_entry(&wait, current);
add_wait_queue(&rmidi->open_wait, &wait);
+ down(&rmidi->open_lock);
while (1) {
subdevice = -1;
down_read(&card->controls_rwsem);
@@ -421,7 +426,9 @@
} else
break;
set_current_state(TASK_INTERRUPTIBLE);
+ up(&rmidi->open_lock);
schedule();
+ down(&rmidi->open_lock);
if (signal_pending(current)) {
err = -ERESTARTSYS;
break;
@@ -433,7 +440,6 @@
if (rawmidi_file->output && rawmidi_file->output->runtime)
rawmidi_file->output->runtime->oss = (maj == SOUND_MAJOR);
#endif
- set_current_state(TASK_RUNNING);
remove_wait_queue(&rmidi->open_wait, &wait);
if (err >= 0) {
file->private_data = rawmidi_file;
@@ -441,6 +447,7 @@
snd_card_file_remove(card, file);
snd_magic_kfree(rawmidi_file);
}
+ up(&rmidi->open_lock);
return err;
}
@@ -950,10 +957,9 @@
}
init_waitqueue_entry(&wait, current);
add_wait_queue(&runtime->sleep, &wait);
- spin_unlock_irq(&runtime->lock);
set_current_state(TASK_INTERRUPTIBLE);
+ spin_unlock_irq(&runtime->lock);
schedule();
- set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait);
if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS;
@@ -1179,10 +1185,9 @@
}
init_waitqueue_entry(&wait, current);
add_wait_queue(&runtime->sleep, &wait);
- spin_unlock_irq(&runtime->lock);
set_current_state(TASK_INTERRUPTIBLE);
+ spin_unlock_irq(&runtime->lock);
timeout = schedule_timeout(30 * HZ);
- set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait);
if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS;
@@ -1207,10 +1212,9 @@
unsigned int last_avail = runtime->avail;
init_waitqueue_entry(&wait, current);
add_wait_queue(&runtime->sleep, &wait);
- spin_unlock_irq(&runtime->lock);
set_current_state(TASK_INTERRUPTIBLE);
+ spin_unlock_irq(&runtime->lock);
timeout = schedule_timeout(30 * HZ);
- set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait);
if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS;
Index: timer.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/timer.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- timer.c 20 Aug 2003 09:10:27 -0000 1.46
+++ timer.c 30 Sep 2003 09:28:26 -0000 1.47
@@ -1678,7 +1678,6 @@
spin_lock_irq(&tu->qlock);
remove_wait_queue(&tu->qchange_sleep, &wait);
- set_current_state(TASK_RUNNING);
if (signal_pending(current)) {
err = -ERESTARTSYS;
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog