[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    ALSA CVS update
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2003-09-30 10:05:17
[Download RAW message or body]

ChangeSet 1.1267.77.6, 2003/09/30 12:05:17+02:00, perex@suse.cz

	ALSA CVS update
	D:2003/09/30 10:28:26
	C:Control Midlevel,HWDEP Midlevel,ALSA Core,PCM Midlevel,RawMidi Midlevel
	C:Timer Midlevel,ALSA<-OSS emulation,ALSA sequencer,EMU8000 driver
	C:Digigram VX222 driver,USB generic driver
	A:Jaroslav Kysela <perex@suse.cz>
	F:core/control.c:1.37->1.38 
	F:core/hwdep.c:1.21->1.22 
	F:core/init.c:1.38->1.39 
	F:core/pcm_lib.c:1.43->1.44 
	F:core/pcm_native.c:1.81->1.82 
	F:core/rawmidi.c:1.37->1.38 
	F:core/timer.c:1.46->1.47 
	F:core/oss/pcm_oss.c:1.52->1.53 
	F:core/seq/seq_lock.c:1.7->1.8 
	F:include/rawmidi.h:1.10->1.11 
	F:isa/sb/emu8000_patch.c:1.6->1.7 
	F:isa/sb/emu8000_pcm.c:1.10->1.11 
	F:pci/vx222/vx222_ops.c:1.2->1.3 
	F:usb/usbaudio.c:1.65->1.66 
	L:Revised schedule() and set_current_state() calls.
	L:Replaced need_resched() with cond_resched() call.


# This patch includes the following deltas:
#	           ChangeSet	1.1267.77.5 -> 1.1267.77.6
#	sound/pci/vx222/vx222_ops.c	1.1     -> 1.2    
#	  sound/core/hwdep.c	1.17    -> 1.18   
#	sound/isa/sb/emu8000_patch.c	1.2     -> 1.3    
#	sound/core/rawmidi.c	1.29    -> 1.30   
#	sound/core/control.c	1.25    -> 1.26   
#	   sound/core/init.c	1.20    -> 1.21   
#	sound/core/pcm_native.c	1.40    -> 1.41   
#	sound/core/seq/seq_lock.c	1.5     -> 1.6    
#	sound/core/pcm_lib.c	1.23    -> 1.24   
#	  sound/core/timer.c	1.21    -> 1.22   
#	sound/usb/usbaudio.c	1.47    -> 1.48   
#	include/sound/rawmidi.h	1.4     -> 1.5    
#	sound/core/oss/pcm_oss.c	1.31    -> 1.32   
#	sound/isa/sb/emu8000_pcm.c	1.5     -> 1.6    
#

 include/sound/rawmidi.h      |    1 +
 sound/core/control.c         |    3 +--
 sound/core/hwdep.c           |    3 ++-
 sound/core/init.c            |    2 +-
 sound/core/oss/pcm_oss.c     |    1 -
 sound/core/pcm_lib.c         |    6 ++----
 sound/core/pcm_native.c      |    9 ++++-----
 sound/core/rawmidi.c         |   24 ++++++++++++++----------
 sound/core/seq/seq_lock.c    |   38 --------------------------------------
 sound/core/timer.c           |    1 -
 sound/isa/sb/emu8000_patch.c |    6 +-----
 sound/isa/sb/emu8000_pcm.c   |   10 +++-------
 sound/pci/vx222/vx222_ops.c  |    6 +-----
 sound/usb/usbaudio.c         |    1 -
 14 files changed, 30 insertions(+), 81 deletions(-)


diff -Nru a/include/sound/rawmidi.h b/include/sound/rawmidi.h
--- a/include/sound/rawmidi.h	Thu Oct  9 09:06:43 2003
+++ b/include/sound/rawmidi.h	Thu Oct  9 09:06:43 2003
@@ -46,6 +46,7 @@
 #define SNDRV_RAWMIDI_LFLG_INPUT	(1<<1)
 #define SNDRV_RAWMIDI_LFLG_OPEN		(3<<0)
 #define SNDRV_RAWMIDI_LFLG_APPEND	(1<<2)
+#define	SNDRV_RAWMIDI_LFLG_NOOPENLOCK	(1<<3)
 
 typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t;
 typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t;
diff -Nru a/sound/core/control.c b/sound/core/control.c
--- a/sound/core/control.c	Thu Oct  9 09:06:43 2003
+++ b/sound/core/control.c	Thu Oct  9 09:06:43 2003
@@ -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;
diff -Nru a/sound/core/hwdep.c b/sound/core/hwdep.c
--- a/sound/core/hwdep.c	Thu Oct  9 09:06:43 2003
+++ b/sound/core/hwdep.c	Thu Oct  9 09:06:43 2003
@@ -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);
diff -Nru a/sound/core/init.c b/sound/core/init.c
--- a/sound/core/init.c	Thu Oct  9 09:06:43 2003
+++ b/sound/core/init.c	Thu Oct  9 09:06:43 2003
@@ -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);
 	}
diff -Nru a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
--- a/sound/core/oss/pcm_oss.c	Thu Oct  9 09:06:43 2003
+++ b/sound/core/oss/pcm_oss.c	Thu Oct  9 09:06:43 2003
@@ -1814,7 +1814,6 @@
 			break;
 		}
 	}
-	set_current_state(TASK_RUNNING);
 	remove_wait_queue(&pcm->open_wait, &wait);
 	up(&pcm->open_mutex);
 	if (err < 0)
diff -Nru a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
--- a/sound/core/pcm_lib.c	Thu Oct  9 09:06:43 2003
+++ b/sound/core/pcm_lib.c	Thu Oct  9 09:06:43 2003
@@ -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) {
diff -Nru a/sound/core/pcm_native.c b/sound/core/pcm_native.c
--- a/sound/core/pcm_native.c	Thu Oct  9 09:06:43 2003
+++ b/sound/core/pcm_native.c	Thu Oct  9 09:06:43 2003
@@ -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;
diff -Nru a/sound/core/rawmidi.c b/sound/core/rawmidi.c
--- a/sound/core/rawmidi.c	Thu Oct  9 09:06:43 2003
+++ b/sound/core/rawmidi.c	Thu Oct  9 09:06:43 2003
@@ -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;
diff -Nru a/sound/core/seq/seq_lock.c b/sound/core/seq/seq_lock.c
--- a/sound/core/seq/seq_lock.c	Thu Oct  9 09:06:43 2003
+++ b/sound/core/seq/seq_lock.c	Thu Oct  9 09:06:43 2003
@@ -25,44 +25,6 @@
 
 #if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)
 
-#if 0 /* NOT USED */
-/* (interruptible) sleep_on during the specified spinlock */
-void snd_seq_sleep_in_lock(wait_queue_head_t *p, spinlock_t *lock)
-{
-	wait_queue_t wait;
-
-	set_current_state(TASK_INTERRUPTIBLE);
-	init_waitqueue_entry(&wait, current);
-
-	add_wait_queue(p, &wait);
-
-	spin_unlock(lock);
-	schedule();
-	spin_lock_irq(lock);
-
-	remove_wait_queue(p, &wait);
-}
-
-/* (interruptible) sleep_on with timeout during the specified spinlock */
-long snd_seq_sleep_timeout_in_lock(wait_queue_head_t *p, spinlock_t *lock, long \
                timeout)
-{
-	wait_queue_t wait;
-
-	set_current_state(TASK_INTERRUPTIBLE);
-	init_waitqueue_entry(&wait, current);
-
-	add_wait_queue(p, &wait);
-
-	spin_unlock(lock);
-	timeout = schedule_timeout(timeout);
-	spin_lock_irq(lock);
-
-	remove_wait_queue(p, &wait);
-
-	return timeout;
-}
-#endif /* NOT USED */
-
 /* wait until all locks are released */
 void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
 {
diff -Nru a/sound/core/timer.c b/sound/core/timer.c
--- a/sound/core/timer.c	Thu Oct  9 09:06:43 2003
+++ b/sound/core/timer.c	Thu Oct  9 09:06:43 2003
@@ -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;
diff -Nru a/sound/isa/sb/emu8000_patch.c b/sound/isa/sb/emu8000_patch.c
--- a/sound/isa/sb/emu8000_patch.c	Thu Oct  9 09:06:43 2003
+++ b/sound/isa/sb/emu8000_patch.c	Thu Oct  9 09:06:43 2003
@@ -233,11 +233,7 @@
 		/* we may take too long time in this loop.
 		 * so give controls back to kernel if needed.
 		 */
-		if (need_resched()) {
-			if (current->state != TASK_RUNNING)
-				set_current_state(TASK_RUNNING);
-			schedule();
-		}
+		cond_resched();
 
 		if (i == sp->v.loopend &&
 		    (sp->v.mode_flags & \
                (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP)))
diff -Nru a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c
--- a/sound/isa/sb/emu8000_pcm.c	Thu Oct  9 09:06:43 2003
+++ b/sound/isa/sb/emu8000_pcm.c	Thu Oct  9 09:06:43 2003
@@ -424,13 +424,9 @@
  */
 #define CHECK_SCHEDULER() \
 do { \
-	if (need_resched()) {\
-		if (current->state != TASK_RUNNING)\
-			set_current_state(TASK_RUNNING);\
-		schedule();\
-		if (signal_pending(current))\
-			return -EAGAIN;\
-	}\
+	cond_resched();\
+	if (signal_pending(current))\
+		return -EAGAIN;\
 } while (0)
 
 
diff -Nru a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
--- a/sound/pci/vx222/vx222_ops.c	Thu Oct  9 09:06:43 2003
+++ b/sound/pci/vx222/vx222_ops.c	Thu Oct  9 09:06:43 2003
@@ -378,11 +378,7 @@
 		if (put_xilinx_data(chip, port, 8, data) < 0)
 			return -EINVAL;
 		/* don't take too much time in this loop... */
-		if (need_resched()) {
-			if (current->state != TASK_RUNNING)
-				set_current_state(TASK_RUNNING);
-			schedule();
-		}
+		cond_resched();
 	}
 	put_xilinx_data(chip, port, 4, 0xff); /* end signature */
 
diff -Nru a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
--- a/sound/usb/usbaudio.c	Thu Oct  9 09:06:43 2003
+++ b/sound/usb/usbaudio.c	Thu Oct  9 09:06:43 2003
@@ -732,7 +732,6 @@
 			break;
 		set_current_state(TASK_UNINTERRUPTIBLE);
 		schedule_timeout(1);
-		set_current_state(TASK_RUNNING);
 	} while (--timeout > 0);
 	if (alive)
 		snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic