diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-11-19 03:55:06 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-11-19 03:55:06 -0500 |
commit | 0ced14fbda44bf9c4977f1b01ae1077b944b94ab (patch) | |
tree | 769b24e0a924e1bca28290ca41af7675e7586bf5 /sound | |
parent | 10e44239f67d0b6fb74006e61a7e883b8075247a (diff) | |
parent | e99ddfde6ae0dd2662bb40435696002b590e4057 (diff) |
Merge branch 'usb-midi-fix-3.7' of git://git.alsa-project.org/alsa-kprivate into for-linus
Merge a regression fix for USB MIDI on non-standard usb-audio drivers
by Clemens.
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/midi.c | 8 |
1 files changed, 6 insertions, 2 deletions
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) | |||
1087 | static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) | 1089 | static 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 | ||