ALSA: usx2y: Don't peep the card internal object
PATCH 1/1 ALSA: usx2y: Don't peep the card internal object
Avoid traversing the device object list of the card instance just for checking the PCM streams. The driver's private object already contains the array of substream pointers, so it can be simply looked through. The card internal may be restructured in future, thus better not to rely on it.
Also, this fixes the possible deadlocks in PCM mutex. Instead of taking multiple PCM mutexes, just take the common mutex in all places. Along with it, rename prepare_mutex as pcm_mutex.
Signed-off-by Takashi Iwai <[email protected]>
--- sound/usb/usx2y/usbusx2y.c | 2 +- sound/usb/usx2y/usbusx2y.h | 2 +- sound/usb/usx2y/usbusx2yaudio.c | 60 ++++++++++++++++++-------------- sound/usb/usx2y/usx2yhwdeppcm.c | 76 ++++++++++++++--------------------------- 4 files changed, 61 insertions(+), 79 deletions(-)
sound/usb/usx2y/usbusx2y.c +1 -1
@@ -353,7 +353,7 @@ static int usX2Y_create_card(struct usb_device *device, card->private_free = snd_usX2Y_card_private_free;usX2Y (card)->dev = device;init_waitqueue_head (&usX2Y (card)->prepare_wait_queue); -mutex_init (&usX2Y (card)->prepare_mutex); +mutex_init (&usX2Y (card)->pcm_mutex);INIT_LIST_HEAD (&usX2Y (card)->midi_list);strcpy (card->driver,"USB " NAME_ALLCAPS "" );sprintf (card->shortname,"TASCAM " NAME_ALLCAPS "" );
sound/usb/usx2y/usbusx2y.h +1 -1
@@ -36,7 +36,7 @@ struct usX2Ydev {unsigned int rate, format;int chip_status; -struct mutex prepare_mutex; +struct mutex pcm_mutex;struct us428ctls_sharedmem *us428ctls_sharedmem;int wait_iso_frame;wait_queue_head_t us428ctls_wait_queue_head;
sound/usb/usx2y/usbusx2yaudio.c +34 -26
98 lines not on this page · raw message
sound/usb/usx2y/usx2yhwdeppcm.c +25 -51
122 lines not on this page · raw message
Signature · 1 line
1.8.5.2