diff options
Diffstat (limited to 'sound/usb/midi.c')
-rw-r--r-- | sound/usb/midi.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/sound/usb/midi.c b/sound/usb/midi.c index 34b9bb7fe87c..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); |
@@ -1455,6 +1444,7 @@ void snd_usbmidi_disconnect(struct list_head* p) | |||
1455 | } | 1444 | } |
1456 | del_timer_sync(&umidi->error_timer); | 1445 | del_timer_sync(&umidi->error_timer); |
1457 | } | 1446 | } |
1447 | EXPORT_SYMBOL(snd_usbmidi_disconnect); | ||
1458 | 1448 | ||
1459 | static void snd_usbmidi_rawmidi_free(struct snd_rawmidi *rmidi) | 1449 | static void snd_usbmidi_rawmidi_free(struct snd_rawmidi *rmidi) |
1460 | { | 1450 | { |
@@ -1465,10 +1455,9 @@ static void snd_usbmidi_rawmidi_free(struct snd_rawmidi *rmidi) | |||
1465 | static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi* umidi, | 1455 | static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi* umidi, |
1466 | int stream, int number) | 1456 | int stream, int number) |
1467 | { | 1457 | { |
1468 | struct list_head* list; | 1458 | struct snd_rawmidi_substream *substream; |
1469 | 1459 | ||
1470 | list_for_each(list, &umidi->rmidi->streams[stream].substreams) { | 1460 | list_for_each_entry(substream, &umidi->rmidi->streams[stream].substreams, list) { |
1471 | struct snd_rawmidi_substream *substream = list_entry(list, struct snd_rawmidi_substream, list); | ||
1472 | if (substream->number == number) | 1461 | if (substream->number == number) |
1473 | return substream; | 1462 | return substream; |
1474 | } | 1463 | } |
@@ -2091,6 +2080,7 @@ void snd_usbmidi_input_stop(struct list_head* p) | |||
2091 | } | 2080 | } |
2092 | umidi->input_running = 0; | 2081 | umidi->input_running = 0; |
2093 | } | 2082 | } |
2083 | EXPORT_SYMBOL(snd_usbmidi_input_stop); | ||
2094 | 2084 | ||
2095 | static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep) | 2085 | static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep) |
2096 | { | 2086 | { |
@@ -2120,6 +2110,7 @@ void snd_usbmidi_input_start(struct list_head* p) | |||
2120 | snd_usbmidi_input_start_ep(umidi->endpoints[i].in); | 2110 | snd_usbmidi_input_start_ep(umidi->endpoints[i].in); |
2121 | umidi->input_running = 1; | 2111 | umidi->input_running = 1; |
2122 | } | 2112 | } |
2113 | EXPORT_SYMBOL(snd_usbmidi_input_start); | ||
2123 | 2114 | ||
2124 | /* | 2115 | /* |
2125 | * Creates and registers everything needed for a MIDI streaming interface. | 2116 | * Creates and registers everything needed for a MIDI streaming interface. |
@@ -2256,11 +2247,9 @@ int snd_usbmidi_create(struct snd_card *card, | |||
2256 | return err; | 2247 | return err; |
2257 | } | 2248 | } |
2258 | 2249 | ||
2250 | usb_autopm_get_interface_no_resume(umidi->iface); | ||
2251 | |||
2259 | list_add_tail(&umidi->list, midi_list); | 2252 | list_add_tail(&umidi->list, midi_list); |
2260 | return 0; | 2253 | return 0; |
2261 | } | 2254 | } |
2262 | |||
2263 | EXPORT_SYMBOL(snd_usbmidi_create); | 2255 | EXPORT_SYMBOL(snd_usbmidi_create); |
2264 | EXPORT_SYMBOL(snd_usbmidi_input_stop); | ||
2265 | EXPORT_SYMBOL(snd_usbmidi_input_start); | ||
2266 | EXPORT_SYMBOL(snd_usbmidi_disconnect); | ||