aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-11-19 15:25:27 -0500
committerTakashi Iwai <tiwai@suse.de>2012-11-19 15:25:27 -0500
commit87af0b80c933f05a4c7dd8c5edebe10365e76220 (patch)
tree6c33ab1a47b5f1ef196e8847586fb81b17152a0e /sound/usb
parent08a978db518dfceb37998bc74a7fed03540cfd08 (diff)
parent2ea3c6a2c779e5a6487d2b436770232162dfbbe3 (diff)
Merge branch 'for-linus' into for-next
Merge the recent HD-audio codec change for fixing recursive suspend calls. Conflicts: sound/pci/hda/hda_codec.c
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/card.c6
-rw-r--r--sound/usb/midi.c8
2 files changed, 9 insertions, 5 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 282f0fc9fed1..dbf7999d18b4 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -559,9 +559,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
559 return; 559 return;
560 560
561 card = chip->card; 561 card = chip->card;
562 mutex_lock(&register_mutex);
563 down_write(&chip->shutdown_rwsem); 562 down_write(&chip->shutdown_rwsem);
564 chip->shutdown = 1; 563 chip->shutdown = 1;
564 up_write(&chip->shutdown_rwsem);
565
566 mutex_lock(&register_mutex);
565 chip->num_interfaces--; 567 chip->num_interfaces--;
566 if (chip->num_interfaces <= 0) { 568 if (chip->num_interfaces <= 0) {
567 snd_card_disconnect(card); 569 snd_card_disconnect(card);
@@ -582,11 +584,9 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
582 snd_usb_mixer_disconnect(p); 584 snd_usb_mixer_disconnect(p);
583 } 585 }
584 usb_chip[chip->index] = NULL; 586 usb_chip[chip->index] = NULL;
585 up_write(&chip->shutdown_rwsem);
586 mutex_unlock(&register_mutex); 587 mutex_unlock(&register_mutex);
587 snd_card_free_when_closed(card); 588 snd_card_free_when_closed(card);
588 } else { 589 } else {
589 up_write(&chip->shutdown_rwsem);
590 mutex_unlock(&register_mutex); 590 mutex_unlock(&register_mutex);
591 } 591 }
592} 592}
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index c83f6143c0eb..eeefbce3873c 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -148,6 +148,7 @@ struct snd_usb_midi_out_endpoint {
148 struct snd_usb_midi_out_endpoint* ep; 148 struct snd_usb_midi_out_endpoint* ep;
149 struct snd_rawmidi_substream *substream; 149 struct snd_rawmidi_substream *substream;
150 int active; 150 int active;
151 bool autopm_reference;
151 uint8_t cable; /* cable number << 4 */ 152 uint8_t cable; /* cable number << 4 */
152 uint8_t state; 153 uint8_t state;
153#define STATE_UNKNOWN 0 154#define STATE_UNKNOWN 0
@@ -1076,7 +1077,8 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
1076 return -ENXIO; 1077 return -ENXIO;
1077 } 1078 }
1078 err = usb_autopm_get_interface(umidi->iface); 1079 err = usb_autopm_get_interface(umidi->iface);
1079 if (err < 0) 1080 port->autopm_reference = err >= 0;
1081 if (err < 0 && err != -EACCES)
1080 return -EIO; 1082 return -EIO;
1081 substream->runtime->private_data = port; 1083 substream->runtime->private_data = port;
1082 port->state = STATE_UNKNOWN; 1084 port->state = STATE_UNKNOWN;
@@ -1087,9 +1089,11 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
1087static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) 1089static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream)
1088{ 1090{
1089 struct snd_usb_midi* umidi = substream->rmidi->private_data; 1091 struct snd_usb_midi* umidi = substream->rmidi->private_data;
1092 struct usbmidi_out_port *port = substream->runtime->private_data;
1090 1093
1091 substream_open(substream, 0); 1094 substream_open(substream, 0);
1092 usb_autopm_put_interface(umidi->iface); 1095 if (port->autopm_reference)
1096 usb_autopm_put_interface(umidi->iface);
1093 return 0; 1097 return 0;
1094} 1098}
1095 1099