[alsa-devel] [PATCH 1/6] ALSA: snd-usb: add snd_usb_audio-wide mutex

Daniel Mack zonque at gmail.com
Fri Dec 23 17:15:42 CET 2011


This is needed for new card-wide list operations.

Signed-off-by: Daniel Mack <zonque at gmail.com>
---
 sound/usb/card.c     |    2 ++
 sound/usb/usbaudio.h |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 4a7be7b..6bc88b7 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -276,6 +276,7 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
 
 static int snd_usb_audio_free(struct snd_usb_audio *chip)
 {
+	mutex_destroy(&chip->mutex);
 	kfree(chip);
 	return 0;
 }
@@ -336,6 +337,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
 		return -ENOMEM;
 	}
 
+	mutex_init(&chip->mutex);
 	mutex_init(&chip->shutdown_mutex);
 	chip->index = idx;
 	chip->dev = dev;
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 3e2b035..a16c21d 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -36,6 +36,7 @@ struct snd_usb_audio {
 	struct snd_card *card;
 	struct usb_interface *pm_intf;
 	u32 usb_id;
+	struct mutex mutex;
 	struct mutex shutdown_mutex;
 	unsigned int shutdown:1;
 	unsigned int probing:1;
-- 
1.7.7.4



More information about the Alsa-devel mailing list