mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
ALSA: ua101, usx2y: fix broken MIDI output
commite99ddfde6aupstream. Commit88a8516a21(ALSA: usbaudio: implement USB autosuspend) added autosuspend code to all files making up the snd-usb-audio driver. However, midi.c is part of snd-usb-lib and is also used by other drivers, not all of which support autosuspend. Thus, calls to usb_autopm_get_interface() could fail, and this unexpected error would result in the MIDI output being completely unusable. Make it work by ignoring the error that is expected with drivers that do not support autosuspend. Reported-by: Colin Fletcher <colin.m.fletcher@googlemail.com> Reported-by: Devin Venable <venable.devin@gmail.com> Reported-by: Dr Nick Bailey <nicholas.bailey@glasgow.ac.uk> Reported-by: Jannis Achstetter <jannis_achstetter@web.de> Reported-by: Rui Nuno Capela <rncbc@rncbc.org> Cc: Oliver Neukum <oliver@neukum.org> Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
14de2f67dd
commit
08dc993050
@@ -147,6 +147,7 @@ struct snd_usb_midi_out_endpoint {
|
||||
struct snd_usb_midi_out_endpoint* ep;
|
||||
struct snd_rawmidi_substream *substream;
|
||||
int active;
|
||||
bool autopm_reference;
|
||||
uint8_t cable; /* cable number << 4 */
|
||||
uint8_t state;
|
||||
#define STATE_UNKNOWN 0
|
||||
@@ -1059,7 +1060,8 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
|
||||
return -ENXIO;
|
||||
}
|
||||
err = usb_autopm_get_interface(umidi->iface);
|
||||
if (err < 0)
|
||||
port->autopm_reference = err >= 0;
|
||||
if (err < 0 && err != -EACCES)
|
||||
return -EIO;
|
||||
substream->runtime->private_data = port;
|
||||
port->state = STATE_UNKNOWN;
|
||||
@@ -1070,9 +1072,11 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
|
||||
static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream)
|
||||
{
|
||||
struct snd_usb_midi* umidi = substream->rmidi->private_data;
|
||||
struct usbmidi_out_port *port = substream->runtime->private_data;
|
||||
|
||||
substream_open(substream, 0);
|
||||
usb_autopm_put_interface(umidi->iface);
|
||||
if (port->autopm_reference)
|
||||
usb_autopm_put_interface(umidi->iface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user