[GIT PULL] ALSA fixes (v2)

Previous thread: [PATCH -tip 3/3] Tracing/ftrace: Adapt boot tracer to the new type of print_line by Frederic Weisbecker on Friday, September 26, 2008 - 8:49 am. (1 message)

Next thread: [PATCH 0/4] futex: get_user_pages_fast() for shared futexes by Peter Zijlstra on Friday, September 26, 2008 - 10:32 am. (10 messages)
From: Takashi Iwai
Date: Friday, September 26, 2008 - 9:13 am

Hi Linus,

please pull another ALSA updates for 2.6.27-rc7 from:

  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git for-linus

These are fixes for possible mutex/semaphore deadlocks found via
recent lockdep.  The deadlock possibility is quite low and I guess
it never happened in the real use yet, though.

Thanks!

Takashi

==

Takashi Iwai (2):
      ALSA: fix locking in snd_pcm_open*() and snd_rawmidi_open*()
      ALSA: remove unneeded power_mutex lock in snd_pcm_drop

 sound/core/pcm.c        |    4 ++--
 sound/core/pcm_native.c |   13 +++----------
 sound/core/rawmidi.c    |    4 ++--
 3 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 9dd9bc7..ece25c7 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -781,7 +781,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
 		return -ENODEV;
 
 	card = pcm->card;
-	down_read(&card->controls_rwsem);
+	read_lock(&card->ctl_files_rwlock);
 	list_for_each_entry(kctl, &card->ctl_files, list) {
 		if (kctl->pid == current->pid) {
 			prefer_subdevice = kctl->prefer_pcm_subdevice;
@@ -789,7 +789,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
 				break;
 		}
 	}
-	up_read(&card->controls_rwsem);
+	read_unlock(&card->ctl_files_rwlock);
 
 	switch (stream) {
 	case SNDRV_PCM_STREAM_PLAYBACK:
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index c49b9d9..c487025 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1546,16 +1546,10 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
 	card = substream->pcm->card;
 
 	if (runtime->status->state == SNDRV_PCM_STATE_OPEN ||
-	    runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED)
+	    runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED ||
+	    runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
 		return -EBADFD;
 
-	snd_power_lock(card);
-	if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) ...
From: Takashi Iwai
Date: Monday, September 29, 2008 - 7:19 am

Linus,

please pull ALSA updates for 2.6.27-rc7 from:

  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git for-linus

This contains the fixes for ASoC cs4270 codec driver (to make it
running on 2.6.27) in addition to two deadlock fixes in the last pull
request.

Thanks!

Takashi

==

Jean Delvare (1):
      ALSA: ASoC: Fix another cs4270 error path

Takashi Iwai (2):
      ALSA: fix locking in snd_pcm_open*() and snd_rawmidi_open*()
      ALSA: remove unneeded power_mutex lock in snd_pcm_drop

Timur Tabi (1):
      ALSA: make the CS4270 driver a new-style I2C driver

 sound/core/pcm.c          |    4 +-
 sound/core/pcm_native.c   |   13 ++------
 sound/core/rawmidi.c      |    4 +-
 sound/soc/codecs/cs4270.c |   78 +++++++++-----------------------------------
 4 files changed, 23 insertions(+), 76 deletions(-)

diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 9dd9bc7..ece25c7 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -781,7 +781,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
 		return -ENODEV;
 
 	card = pcm->card;
-	down_read(&card->controls_rwsem);
+	read_lock(&card->ctl_files_rwlock);
 	list_for_each_entry(kctl, &card->ctl_files, list) {
 		if (kctl->pid == current->pid) {
 			prefer_subdevice = kctl->prefer_pcm_subdevice;
@@ -789,7 +789,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
 				break;
 		}
 	}
-	up_read(&card->controls_rwsem);
+	read_unlock(&card->ctl_files_rwlock);
 
 	switch (stream) {
 	case SNDRV_PCM_STREAM_PLAYBACK:
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index c49b9d9..c487025 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1546,16 +1546,10 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
 	card = substream->pcm->card;
 
 	if (runtime->status->state == SNDRV_PCM_STATE_OPEN ||
-	    runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED)
+	    runtime->status->state == ...
Previous thread: [PATCH -tip 3/3] Tracing/ftrace: Adapt boot tracer to the new type of print_line by Frederic Weisbecker on Friday, September 26, 2008 - 8:49 am. (1 message)

Next thread: [PATCH 0/4] futex: get_user_pages_fast() for shared futexes by Peter Zijlstra on Friday, September 26, 2008 - 10:32 am. (10 messages)