aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/midi.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 60c7aa7579cc..8e01fa4991c5 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -126,7 +126,6 @@ struct snd_usb_midi {
126 struct snd_usb_midi_in_endpoint *in; 126 struct snd_usb_midi_in_endpoint *in;
127 } endpoints[MIDI_MAX_ENDPOINTS]; 127 } endpoints[MIDI_MAX_ENDPOINTS];
128 unsigned long input_triggered; 128 unsigned long input_triggered;
129 bool autopm_reference;
130 unsigned int opened[2]; 129 unsigned int opened[2];
131 unsigned char disconnected; 130 unsigned char disconnected;
132 unsigned char input_running; 131 unsigned char input_running;
@@ -1040,7 +1039,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
1040{ 1039{
1041 struct snd_usb_midi* umidi = substream->rmidi->private_data; 1040 struct snd_usb_midi* umidi = substream->rmidi->private_data;
1042 struct snd_kcontrol *ctl; 1041 struct snd_kcontrol *ctl;
1043 int err;
1044 1042
1045 down_read(&umidi->disc_rwsem); 1043 down_read(&umidi->disc_rwsem);
1046 if (umidi->disconnected) { 1044 if (umidi->disconnected) {
@@ -1051,13 +1049,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
1051 mutex_lock(&umidi->mutex); 1049 mutex_lock(&umidi->mutex);
1052 if (open) { 1050 if (open) {
1053 if (!umidi->opened[0] && !umidi->opened[1]) { 1051 if (!umidi->opened[0] && !umidi->opened[1]) {
1054 err = usb_autopm_get_interface(umidi->iface);
1055 umidi->autopm_reference = err >= 0;
1056 if (err < 0 && err != -EACCES) {
1057 mutex_unlock(&umidi->mutex);
1058 up_read(&umidi->disc_rwsem);
1059 return -EIO;
1060 }
1061 if (umidi->roland_load_ctl) { 1052 if (umidi->roland_load_ctl) {
1062 ctl = umidi->roland_load_ctl; 1053 ctl = umidi->roland_load_ctl;
1063 ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; 1054 ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
@@ -1080,8 +1071,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
1080 snd_ctl_notify(umidi->card, 1071 snd_ctl_notify(umidi->card,
1081 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); 1072 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
1082 } 1073 }
1083 if (umidi->autopm_reference)
1084 usb_autopm_put_interface(umidi->iface);
1085 } 1074 }
1086 } 1075 }
1087 mutex_unlock(&umidi->mutex); 1076 mutex_unlock(&umidi->mutex);
@@ -2258,6 +2247,8 @@ int snd_usbmidi_create(struct snd_card *card,
2258 return err; 2247 return err;
2259 } 2248 }
2260 2249
2250 usb_autopm_get_interface_no_resume(umidi->iface);
2251
2261 list_add_tail(&umidi->list, midi_list); 2252 list_add_tail(&umidi->list, midi_list);
2262 return 0; 2253 return 0;
2263} 2254}