diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-10-30 10:08:25 (GMT) |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-10-30 10:08:25 (GMT) |
commit | a5d00dc3a4b65ed38249f3225e453944c633747b (patch) | |
tree | 6249ca5a5f13059f42890525a9ea7133778f3891 /sound/usb/card.c | |
parent | 1a8506d4402b6e96c2ed778dc7ccbb48d1e02fce (diff) | |
parent | 0914f7961babbf28aaa2f19b453951fb4841c03f (diff) | |
download | linux-fsl-qoriq-a5d00dc3a4b65ed38249f3225e453944c633747b.tar.xz |
Merge branch 'for-linus' into for-next
... for migrating the core changes for USB-audio disconnection fixes
Diffstat (limited to 'sound/usb/card.c')
-rw-r--r-- | sound/usb/card.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c index 561bb74..282f0fc 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -339,7 +339,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, } mutex_init(&chip->mutex); - mutex_init(&chip->shutdown_mutex); + init_rwsem(&chip->shutdown_rwsem); chip->index = idx; chip->dev = dev; chip->card = card; @@ -560,7 +560,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, card = chip->card; mutex_lock(®ister_mutex); - mutex_lock(&chip->shutdown_mutex); + down_write(&chip->shutdown_rwsem); chip->shutdown = 1; chip->num_interfaces--; if (chip->num_interfaces <= 0) { @@ -582,11 +582,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, snd_usb_mixer_disconnect(p); } usb_chip[chip->index] = NULL; - mutex_unlock(&chip->shutdown_mutex); + up_write(&chip->shutdown_rwsem); mutex_unlock(®ister_mutex); snd_card_free_when_closed(card); } else { - mutex_unlock(&chip->shutdown_mutex); + up_write(&chip->shutdown_rwsem); mutex_unlock(®ister_mutex); } } @@ -618,16 +618,20 @@ int snd_usb_autoresume(struct snd_usb_audio *chip) { int err = -ENODEV; + down_read(&chip->shutdown_rwsem); if (!chip->shutdown && !chip->probing) err = usb_autopm_get_interface(chip->pm_intf); + up_read(&chip->shutdown_rwsem); return err; } void snd_usb_autosuspend(struct snd_usb_audio *chip) { + down_read(&chip->shutdown_rwsem); if (!chip->shutdown && !chip->probing) usb_autopm_put_interface(chip->pm_intf); + up_read(&chip->shutdown_rwsem); } static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) |