diff options
author | Rahul Mittal <rmittal@nvidia.com> | 2013-10-16 11:34:26 +0530 |
---|---|---|
committer | Bharat Nihalani <bnihalani@nvidia.com> | 2013-10-24 21:41:56 -0700 |
commit | 3e10a62a50bc6ddf386e47445a675788cce375dc (patch) | |
tree | 90365ccb489c8c779b9a7c67e6abafd4256d8e50 /sound/usb | |
parent | 2f90c83c41737d7352fc959df09cc4d14518fd8f (diff) |
ALSA: usb: Handle unplug during multiple devices
Set usb_audio switch state to DISCONNECTED only if
the device with active audio (i.e. the one which was
plugged-in earliest) is unplugged. Hence, unplugging
other devices won't disturb active audio.
Bug 1368093
Change-Id: I461c58cf15b20220fa627634423b6e23112ad64b
Signed-off-by: Rahul Mittal <rmittal@nvidia.com>
Reviewed-on: http://git-master/r/299797
Reviewed-by: Scott Peterson <speterson@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/card.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c index 080ae81ba8b0..e0c0e25b7293 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -604,6 +604,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, { struct snd_card *card; struct list_head *p, *n; + int i; if (chip == (void *)-1L) return; @@ -617,7 +618,12 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, chip->num_interfaces--; #ifdef CONFIG_SWITCH - switch_set_state(&usb_switch_dev, STATE_DISCONNECTED); + for (i = 0; i < chip->index; i++) { + if (usb_chip[i]) + break; + } + if (i == chip->index) + switch_set_state(&usb_switch_dev, STATE_DISCONNECTED); #endif if (chip->num_interfaces <= 0) { |