diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2009-11-16 06:23:46 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-24 04:19:59 -0500 |
commit | d82af9f9aab69e82b86450272588c861364f8879 (patch) | |
tree | 725374db87473b6ae0e2ac6f41ca44866affa37b /sound/usb | |
parent | 96f61d9ade82f3e9503df36809175325e8f5eaca (diff) |
sound: usb: make the USB MIDI module more independent
Remove the dependecy from the USB MIDI code on the snd_usb_audio
structure. This allows using the USB MIDI module from another driver
without having to pretend to be the generic USB audio driver.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/usbaudio.c | 38 | ||||
-rw-r--r-- | sound/usb/usbaudio.h | 7 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 96 | ||||
-rw-r--r-- | sound/usb/usx2y/us122l.c | 22 | ||||
-rw-r--r-- | sound/usb/usx2y/us122l.h | 1 | ||||
-rw-r--r-- | sound/usb/usx2y/usX2Yhwdep.c | 2 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.c | 4 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.h | 1 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2yaudio.c | 4 |
9 files changed, 96 insertions, 79 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 8db0374e10d5..b074a594c595 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2893,7 +2893,9 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) | |||
2893 | if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || | 2893 | if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || |
2894 | altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && | 2894 | altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && |
2895 | altsd->bInterfaceSubClass == USB_SUBCLASS_MIDI_STREAMING) { | 2895 | altsd->bInterfaceSubClass == USB_SUBCLASS_MIDI_STREAMING) { |
2896 | if (snd_usb_create_midi_interface(chip, iface, NULL) < 0) { | 2896 | int err = snd_usbmidi_create(chip->card, iface, |
2897 | &chip->midi_list, NULL); | ||
2898 | if (err < 0) { | ||
2897 | snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", dev->devnum, ctrlif, j); | 2899 | snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", dev->devnum, ctrlif, j); |
2898 | continue; | 2900 | continue; |
2899 | } | 2901 | } |
@@ -3038,12 +3040,11 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, | |||
3038 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | 3040 | .type = QUIRK_MIDI_FIXED_ENDPOINT, |
3039 | .data = &uaxx_ep | 3041 | .data = &uaxx_ep |
3040 | }; | 3042 | }; |
3041 | if (chip->usb_id == USB_ID(0x0582, 0x002b)) | 3043 | const struct snd_usb_audio_quirk *quirk = |
3042 | return snd_usb_create_midi_interface(chip, iface, | 3044 | chip->usb_id == USB_ID(0x0582, 0x002b) |
3043 | &ua700_quirk); | 3045 | ? &ua700_quirk : &uaxx_quirk; |
3044 | else | 3046 | return snd_usbmidi_create(chip->card, iface, |
3045 | return snd_usb_create_midi_interface(chip, iface, | 3047 | &chip->midi_list, quirk); |
3046 | &uaxx_quirk); | ||
3047 | } | 3048 | } |
3048 | 3049 | ||
3049 | if (altsd->bNumEndpoints != 1) | 3050 | if (altsd->bNumEndpoints != 1) |
@@ -3370,6 +3371,13 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, | |||
3370 | return 0; /* keep this altsetting */ | 3371 | return 0; /* keep this altsetting */ |
3371 | } | 3372 | } |
3372 | 3373 | ||
3374 | static int create_any_midi_quirk(struct snd_usb_audio *chip, | ||
3375 | struct usb_interface *intf, | ||
3376 | const struct snd_usb_audio_quirk *quirk) | ||
3377 | { | ||
3378 | return snd_usbmidi_create(chip->card, intf, &chip->midi_list, quirk); | ||
3379 | } | ||
3380 | |||
3373 | /* | 3381 | /* |
3374 | * audio-interface quirks | 3382 | * audio-interface quirks |
3375 | * | 3383 | * |
@@ -3387,14 +3395,14 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip, | |||
3387 | static const quirk_func_t quirk_funcs[] = { | 3395 | static const quirk_func_t quirk_funcs[] = { |
3388 | [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, | 3396 | [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, |
3389 | [QUIRK_COMPOSITE] = create_composite_quirk, | 3397 | [QUIRK_COMPOSITE] = create_composite_quirk, |
3390 | [QUIRK_MIDI_STANDARD_INTERFACE] = snd_usb_create_midi_interface, | 3398 | [QUIRK_MIDI_STANDARD_INTERFACE] = create_any_midi_quirk, |
3391 | [QUIRK_MIDI_FIXED_ENDPOINT] = snd_usb_create_midi_interface, | 3399 | [QUIRK_MIDI_FIXED_ENDPOINT] = create_any_midi_quirk, |
3392 | [QUIRK_MIDI_YAMAHA] = snd_usb_create_midi_interface, | 3400 | [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk, |
3393 | [QUIRK_MIDI_MIDIMAN] = snd_usb_create_midi_interface, | 3401 | [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk, |
3394 | [QUIRK_MIDI_NOVATION] = snd_usb_create_midi_interface, | 3402 | [QUIRK_MIDI_NOVATION] = create_any_midi_quirk, |
3395 | [QUIRK_MIDI_FASTLANE] = snd_usb_create_midi_interface, | 3403 | [QUIRK_MIDI_FASTLANE] = create_any_midi_quirk, |
3396 | [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, | 3404 | [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk, |
3397 | [QUIRK_MIDI_CME] = snd_usb_create_midi_interface, | 3405 | [QUIRK_MIDI_CME] = create_any_midi_quirk, |
3398 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, | 3406 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, |
3399 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, | 3407 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
3400 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, | 3408 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index e9a3a9dca15c..40ba8115fb81 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -132,7 +132,6 @@ struct snd_usb_audio { | |||
132 | int pcm_devs; | 132 | int pcm_devs; |
133 | 133 | ||
134 | struct list_head midi_list; /* list of midi interfaces */ | 134 | struct list_head midi_list; /* list of midi interfaces */ |
135 | int next_midi_device; | ||
136 | 135 | ||
137 | struct list_head mixer_list; /* list of mixer interfaces */ | 136 | struct list_head mixer_list; /* list of mixer interfaces */ |
138 | }; | 137 | }; |
@@ -227,8 +226,10 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, | |||
227 | int ignore_error); | 226 | int ignore_error); |
228 | void snd_usb_mixer_disconnect(struct list_head *p); | 227 | void snd_usb_mixer_disconnect(struct list_head *p); |
229 | 228 | ||
230 | int snd_usb_create_midi_interface(struct snd_usb_audio *chip, struct usb_interface *iface, | 229 | int snd_usbmidi_create(struct snd_card *card, |
231 | const struct snd_usb_audio_quirk *quirk); | 230 | struct usb_interface *iface, |
231 | struct list_head *midi_list, | ||
232 | const struct snd_usb_audio_quirk *quirk); | ||
232 | void snd_usbmidi_input_stop(struct list_head* p); | 233 | void snd_usbmidi_input_stop(struct list_head* p); |
233 | void snd_usbmidi_input_start(struct list_head* p); | 234 | void snd_usbmidi_input_start(struct list_head* p); |
234 | void snd_usbmidi_disconnect(struct list_head *p); | 235 | void snd_usbmidi_disconnect(struct list_head *p); |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 80b2845bc486..6e89b8368d9a 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -102,7 +102,8 @@ struct usb_protocol_ops { | |||
102 | }; | 102 | }; |
103 | 103 | ||
104 | struct snd_usb_midi { | 104 | struct snd_usb_midi { |
105 | struct snd_usb_audio *chip; | 105 | struct usb_device *dev; |
106 | struct snd_card *card; | ||
106 | struct usb_interface *iface; | 107 | struct usb_interface *iface; |
107 | const struct snd_usb_audio_quirk *quirk; | 108 | const struct snd_usb_audio_quirk *quirk; |
108 | struct snd_rawmidi *rmidi; | 109 | struct snd_rawmidi *rmidi; |
@@ -111,6 +112,8 @@ struct snd_usb_midi { | |||
111 | struct timer_list error_timer; | 112 | struct timer_list error_timer; |
112 | spinlock_t disc_lock; | 113 | spinlock_t disc_lock; |
113 | struct mutex mutex; | 114 | struct mutex mutex; |
115 | u32 usb_id; | ||
116 | int next_midi_device; | ||
114 | 117 | ||
115 | struct snd_usb_midi_endpoint { | 118 | struct snd_usb_midi_endpoint { |
116 | struct snd_usb_midi_out_endpoint *out; | 119 | struct snd_usb_midi_out_endpoint *out; |
@@ -260,7 +263,7 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb) | |||
260 | } | 263 | } |
261 | } | 264 | } |
262 | 265 | ||
263 | urb->dev = ep->umidi->chip->dev; | 266 | urb->dev = ep->umidi->dev; |
264 | snd_usbmidi_submit_urb(urb, GFP_ATOMIC); | 267 | snd_usbmidi_submit_urb(urb, GFP_ATOMIC); |
265 | } | 268 | } |
266 | 269 | ||
@@ -301,7 +304,7 @@ static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep) | |||
301 | unsigned long flags; | 304 | unsigned long flags; |
302 | 305 | ||
303 | spin_lock_irqsave(&ep->buffer_lock, flags); | 306 | spin_lock_irqsave(&ep->buffer_lock, flags); |
304 | if (ep->umidi->chip->shutdown) { | 307 | if (ep->umidi->disconnected) { |
305 | spin_unlock_irqrestore(&ep->buffer_lock, flags); | 308 | spin_unlock_irqrestore(&ep->buffer_lock, flags); |
306 | return; | 309 | return; |
307 | } | 310 | } |
@@ -317,7 +320,7 @@ static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep) | |||
317 | 320 | ||
318 | dump_urb("sending", urb->transfer_buffer, | 321 | dump_urb("sending", urb->transfer_buffer, |
319 | urb->transfer_buffer_length); | 322 | urb->transfer_buffer_length); |
320 | urb->dev = ep->umidi->chip->dev; | 323 | urb->dev = ep->umidi->dev; |
321 | if (snd_usbmidi_submit_urb(urb, GFP_ATOMIC) < 0) | 324 | if (snd_usbmidi_submit_urb(urb, GFP_ATOMIC) < 0) |
322 | break; | 325 | break; |
323 | ep->active_urbs |= 1 << urb_index; | 326 | ep->active_urbs |= 1 << urb_index; |
@@ -354,7 +357,7 @@ static void snd_usbmidi_error_timer(unsigned long data) | |||
354 | if (in && in->error_resubmit) { | 357 | if (in && in->error_resubmit) { |
355 | in->error_resubmit = 0; | 358 | in->error_resubmit = 0; |
356 | for (j = 0; j < INPUT_URBS; ++j) { | 359 | for (j = 0; j < INPUT_URBS; ++j) { |
357 | in->urbs[j]->dev = umidi->chip->dev; | 360 | in->urbs[j]->dev = umidi->dev; |
358 | snd_usbmidi_submit_urb(in->urbs[j], GFP_ATOMIC); | 361 | snd_usbmidi_submit_urb(in->urbs[j], GFP_ATOMIC); |
359 | } | 362 | } |
360 | } | 363 | } |
@@ -374,7 +377,7 @@ static int send_bulk_static_data(struct snd_usb_midi_out_endpoint* ep, | |||
374 | return -ENOMEM; | 377 | return -ENOMEM; |
375 | dump_urb("sending", buf, len); | 378 | dump_urb("sending", buf, len); |
376 | if (ep->urbs[0].urb) | 379 | if (ep->urbs[0].urb) |
377 | err = usb_bulk_msg(ep->umidi->chip->dev, ep->urbs[0].urb->pipe, | 380 | err = usb_bulk_msg(ep->umidi->dev, ep->urbs[0].urb->pipe, |
378 | buf, len, NULL, 250); | 381 | buf, len, NULL, 250); |
379 | kfree(buf); | 382 | kfree(buf); |
380 | return err; | 383 | return err; |
@@ -729,8 +732,7 @@ static void snd_usbmidi_us122l_output(struct snd_usb_midi_out_endpoint *ep, | |||
729 | 732 | ||
730 | if (!ep->ports[0].active) | 733 | if (!ep->ports[0].active) |
731 | return; | 734 | return; |
732 | count = snd_usb_get_speed(ep->umidi->chip->dev) == USB_SPEED_HIGH | 735 | count = snd_usb_get_speed(ep->umidi->dev) == USB_SPEED_HIGH ? 1 : 2; |
733 | ? 1 : 2; | ||
734 | count = snd_rawmidi_transmit(ep->ports[0].substream, | 736 | count = snd_rawmidi_transmit(ep->ports[0].substream, |
735 | urb->transfer_buffer, | 737 | urb->transfer_buffer, |
736 | count); | 738 | count); |
@@ -898,7 +900,7 @@ static void update_roland_altsetting(struct snd_usb_midi* umidi) | |||
898 | hostif = &intf->altsetting[umidi->roland_load_ctl->private_value]; | 900 | hostif = &intf->altsetting[umidi->roland_load_ctl->private_value]; |
899 | intfd = get_iface_desc(hostif); | 901 | intfd = get_iface_desc(hostif); |
900 | snd_usbmidi_input_stop(&umidi->list); | 902 | snd_usbmidi_input_stop(&umidi->list); |
901 | usb_set_interface(umidi->chip->dev, intfd->bInterfaceNumber, | 903 | usb_set_interface(umidi->dev, intfd->bInterfaceNumber, |
902 | intfd->bAlternateSetting); | 904 | intfd->bAlternateSetting); |
903 | snd_usbmidi_input_start(&umidi->list); | 905 | snd_usbmidi_input_start(&umidi->list); |
904 | } | 906 | } |
@@ -913,7 +915,7 @@ static void substream_open(struct snd_rawmidi_substream *substream, int open) | |||
913 | if (umidi->opened++ == 0 && umidi->roland_load_ctl) { | 915 | if (umidi->opened++ == 0 && umidi->roland_load_ctl) { |
914 | ctl = umidi->roland_load_ctl; | 916 | ctl = umidi->roland_load_ctl; |
915 | ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; | 917 | ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; |
916 | snd_ctl_notify(umidi->chip->card, | 918 | snd_ctl_notify(umidi->card, |
917 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | 919 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); |
918 | update_roland_altsetting(umidi); | 920 | update_roland_altsetting(umidi); |
919 | } | 921 | } |
@@ -921,7 +923,7 @@ static void substream_open(struct snd_rawmidi_substream *substream, int open) | |||
921 | if (--umidi->opened == 0 && umidi->roland_load_ctl) { | 923 | if (--umidi->opened == 0 && umidi->roland_load_ctl) { |
922 | ctl = umidi->roland_load_ctl; | 924 | ctl = umidi->roland_load_ctl; |
923 | ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | 925 | ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; |
924 | snd_ctl_notify(umidi->chip->card, | 926 | snd_ctl_notify(umidi->card, |
925 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | 927 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); |
926 | } | 928 | } |
927 | } | 929 | } |
@@ -963,7 +965,7 @@ static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, | |||
963 | 965 | ||
964 | port->active = up; | 966 | port->active = up; |
965 | if (up) { | 967 | if (up) { |
966 | if (port->ep->umidi->chip->shutdown) { | 968 | if (port->ep->umidi->disconnected) { |
967 | /* gobble up remaining bytes to prevent wait in | 969 | /* gobble up remaining bytes to prevent wait in |
968 | * snd_rawmidi_drain_output */ | 970 | * snd_rawmidi_drain_output */ |
969 | while (!snd_rawmidi_transmit_empty(substream)) | 971 | while (!snd_rawmidi_transmit_empty(substream)) |
@@ -1041,7 +1043,7 @@ static struct snd_rawmidi_ops snd_usbmidi_input_ops = { | |||
1041 | static void free_urb_and_buffer(struct snd_usb_midi *umidi, struct urb *urb, | 1043 | static void free_urb_and_buffer(struct snd_usb_midi *umidi, struct urb *urb, |
1042 | unsigned int buffer_length) | 1044 | unsigned int buffer_length) |
1043 | { | 1045 | { |
1044 | usb_buffer_free(umidi->chip->dev, buffer_length, | 1046 | usb_buffer_free(umidi->dev, buffer_length, |
1045 | urb->transfer_buffer, urb->transfer_dma); | 1047 | urb->transfer_buffer, urb->transfer_dma); |
1046 | usb_free_urb(urb); | 1048 | usb_free_urb(urb); |
1047 | } | 1049 | } |
@@ -1088,24 +1090,24 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi, | |||
1088 | } | 1090 | } |
1089 | } | 1091 | } |
1090 | if (ep_info->in_interval) | 1092 | if (ep_info->in_interval) |
1091 | pipe = usb_rcvintpipe(umidi->chip->dev, ep_info->in_ep); | 1093 | pipe = usb_rcvintpipe(umidi->dev, ep_info->in_ep); |
1092 | else | 1094 | else |
1093 | pipe = usb_rcvbulkpipe(umidi->chip->dev, ep_info->in_ep); | 1095 | pipe = usb_rcvbulkpipe(umidi->dev, ep_info->in_ep); |
1094 | length = usb_maxpacket(umidi->chip->dev, pipe, 0); | 1096 | length = usb_maxpacket(umidi->dev, pipe, 0); |
1095 | for (i = 0; i < INPUT_URBS; ++i) { | 1097 | for (i = 0; i < INPUT_URBS; ++i) { |
1096 | buffer = usb_buffer_alloc(umidi->chip->dev, length, GFP_KERNEL, | 1098 | buffer = usb_buffer_alloc(umidi->dev, length, GFP_KERNEL, |
1097 | &ep->urbs[i]->transfer_dma); | 1099 | &ep->urbs[i]->transfer_dma); |
1098 | if (!buffer) { | 1100 | if (!buffer) { |
1099 | snd_usbmidi_in_endpoint_delete(ep); | 1101 | snd_usbmidi_in_endpoint_delete(ep); |
1100 | return -ENOMEM; | 1102 | return -ENOMEM; |
1101 | } | 1103 | } |
1102 | if (ep_info->in_interval) | 1104 | if (ep_info->in_interval) |
1103 | usb_fill_int_urb(ep->urbs[i], umidi->chip->dev, | 1105 | usb_fill_int_urb(ep->urbs[i], umidi->dev, |
1104 | pipe, buffer, length, | 1106 | pipe, buffer, length, |
1105 | snd_usbmidi_in_urb_complete, | 1107 | snd_usbmidi_in_urb_complete, |
1106 | ep, ep_info->in_interval); | 1108 | ep, ep_info->in_interval); |
1107 | else | 1109 | else |
1108 | usb_fill_bulk_urb(ep->urbs[i], umidi->chip->dev, | 1110 | usb_fill_bulk_urb(ep->urbs[i], umidi->dev, |
1109 | pipe, buffer, length, | 1111 | pipe, buffer, length, |
1110 | snd_usbmidi_in_urb_complete, ep); | 1112 | snd_usbmidi_in_urb_complete, ep); |
1111 | ep->urbs[i]->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | 1113 | ep->urbs[i]->transfer_flags = URB_NO_TRANSFER_DMA_MAP; |
@@ -1157,15 +1159,15 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, | |||
1157 | ep->urbs[i].ep = ep; | 1159 | ep->urbs[i].ep = ep; |
1158 | } | 1160 | } |
1159 | if (ep_info->out_interval) | 1161 | if (ep_info->out_interval) |
1160 | pipe = usb_sndintpipe(umidi->chip->dev, ep_info->out_ep); | 1162 | pipe = usb_sndintpipe(umidi->dev, ep_info->out_ep); |
1161 | else | 1163 | else |
1162 | pipe = usb_sndbulkpipe(umidi->chip->dev, ep_info->out_ep); | 1164 | pipe = usb_sndbulkpipe(umidi->dev, ep_info->out_ep); |
1163 | if (umidi->chip->usb_id == USB_ID(0x0a92, 0x1020)) /* ESI M4U */ | 1165 | if (umidi->usb_id == USB_ID(0x0a92, 0x1020)) /* ESI M4U */ |
1164 | ep->max_transfer = 4; | 1166 | ep->max_transfer = 4; |
1165 | else | 1167 | else |
1166 | ep->max_transfer = usb_maxpacket(umidi->chip->dev, pipe, 1); | 1168 | ep->max_transfer = usb_maxpacket(umidi->dev, pipe, 1); |
1167 | for (i = 0; i < OUTPUT_URBS; ++i) { | 1169 | for (i = 0; i < OUTPUT_URBS; ++i) { |
1168 | buffer = usb_buffer_alloc(umidi->chip->dev, | 1170 | buffer = usb_buffer_alloc(umidi->dev, |
1169 | ep->max_transfer, GFP_KERNEL, | 1171 | ep->max_transfer, GFP_KERNEL, |
1170 | &ep->urbs[i].urb->transfer_dma); | 1172 | &ep->urbs[i].urb->transfer_dma); |
1171 | if (!buffer) { | 1173 | if (!buffer) { |
@@ -1173,12 +1175,12 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, | |||
1173 | return -ENOMEM; | 1175 | return -ENOMEM; |
1174 | } | 1176 | } |
1175 | if (ep_info->out_interval) | 1177 | if (ep_info->out_interval) |
1176 | usb_fill_int_urb(ep->urbs[i].urb, umidi->chip->dev, | 1178 | usb_fill_int_urb(ep->urbs[i].urb, umidi->dev, |
1177 | pipe, buffer, ep->max_transfer, | 1179 | pipe, buffer, ep->max_transfer, |
1178 | snd_usbmidi_out_urb_complete, | 1180 | snd_usbmidi_out_urb_complete, |
1179 | &ep->urbs[i], ep_info->out_interval); | 1181 | &ep->urbs[i], ep_info->out_interval); |
1180 | else | 1182 | else |
1181 | usb_fill_bulk_urb(ep->urbs[i].urb, umidi->chip->dev, | 1183 | usb_fill_bulk_urb(ep->urbs[i].urb, umidi->dev, |
1182 | pipe, buffer, ep->max_transfer, | 1184 | pipe, buffer, ep->max_transfer, |
1183 | snd_usbmidi_out_urb_complete, | 1185 | snd_usbmidi_out_urb_complete, |
1184 | &ep->urbs[i]); | 1186 | &ep->urbs[i]); |
@@ -1412,7 +1414,7 @@ static struct port_info *find_port_info(struct snd_usb_midi* umidi, int number) | |||
1412 | int i; | 1414 | int i; |
1413 | 1415 | ||
1414 | for (i = 0; i < ARRAY_SIZE(snd_usbmidi_port_info); ++i) { | 1416 | for (i = 0; i < ARRAY_SIZE(snd_usbmidi_port_info); ++i) { |
1415 | if (snd_usbmidi_port_info[i].id == umidi->chip->usb_id && | 1417 | if (snd_usbmidi_port_info[i].id == umidi->usb_id && |
1416 | snd_usbmidi_port_info[i].port == number) | 1418 | snd_usbmidi_port_info[i].port == number) |
1417 | return &snd_usbmidi_port_info[i]; | 1419 | return &snd_usbmidi_port_info[i]; |
1418 | } | 1420 | } |
@@ -1450,7 +1452,7 @@ static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, | |||
1450 | port_info = find_port_info(umidi, number); | 1452 | port_info = find_port_info(umidi, number); |
1451 | name_format = port_info ? port_info->name : "%s MIDI %d"; | 1453 | name_format = port_info ? port_info->name : "%s MIDI %d"; |
1452 | snprintf(substream->name, sizeof(substream->name), | 1454 | snprintf(substream->name, sizeof(substream->name), |
1453 | name_format, umidi->chip->card->shortname, number + 1); | 1455 | name_format, umidi->card->shortname, number + 1); |
1454 | 1456 | ||
1455 | *rsubstream = substream; | 1457 | *rsubstream = substream; |
1456 | } | 1458 | } |
@@ -1548,7 +1550,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1548 | endpoints[epidx].out_ep = usb_endpoint_num(ep); | 1550 | endpoints[epidx].out_ep = usb_endpoint_num(ep); |
1549 | if (usb_endpoint_xfer_int(ep)) | 1551 | if (usb_endpoint_xfer_int(ep)) |
1550 | endpoints[epidx].out_interval = ep->bInterval; | 1552 | endpoints[epidx].out_interval = ep->bInterval; |
1551 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) | 1553 | else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW) |
1552 | /* | 1554 | /* |
1553 | * Low speed bulk transfers don't exist, so | 1555 | * Low speed bulk transfers don't exist, so |
1554 | * force interrupt transfers for devices like | 1556 | * force interrupt transfers for devices like |
@@ -1568,7 +1570,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1568 | endpoints[epidx].in_ep = usb_endpoint_num(ep); | 1570 | endpoints[epidx].in_ep = usb_endpoint_num(ep); |
1569 | if (usb_endpoint_xfer_int(ep)) | 1571 | if (usb_endpoint_xfer_int(ep)) |
1570 | endpoints[epidx].in_interval = ep->bInterval; | 1572 | endpoints[epidx].in_interval = ep->bInterval; |
1571 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) | 1573 | else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW) |
1572 | endpoints[epidx].in_interval = 1; | 1574 | endpoints[epidx].in_interval = 1; |
1573 | endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; | 1575 | endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; |
1574 | snd_printdd(KERN_INFO "EP %02X: %d jack(s)\n", | 1576 | snd_printdd(KERN_INFO "EP %02X: %d jack(s)\n", |
@@ -1647,11 +1649,11 @@ static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi) | |||
1647 | 1649 | ||
1648 | snd_printdd(KERN_INFO "switching to altsetting %d with int ep\n", | 1650 | snd_printdd(KERN_INFO "switching to altsetting %d with int ep\n", |
1649 | intfd->bAlternateSetting); | 1651 | intfd->bAlternateSetting); |
1650 | usb_set_interface(umidi->chip->dev, intfd->bInterfaceNumber, | 1652 | usb_set_interface(umidi->dev, intfd->bInterfaceNumber, |
1651 | intfd->bAlternateSetting); | 1653 | intfd->bAlternateSetting); |
1652 | 1654 | ||
1653 | umidi->roland_load_ctl = snd_ctl_new1(&roland_load_ctl, umidi); | 1655 | umidi->roland_load_ctl = snd_ctl_new1(&roland_load_ctl, umidi); |
1654 | if (snd_ctl_add(umidi->chip->card, umidi->roland_load_ctl) < 0) | 1656 | if (snd_ctl_add(umidi->card, umidi->roland_load_ctl) < 0) |
1655 | umidi->roland_load_ctl = NULL; | 1657 | umidi->roland_load_ctl = NULL; |
1656 | } | 1658 | } |
1657 | 1659 | ||
@@ -1668,7 +1670,7 @@ static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi, | |||
1668 | struct usb_endpoint_descriptor* epd; | 1670 | struct usb_endpoint_descriptor* epd; |
1669 | int i, out_eps = 0, in_eps = 0; | 1671 | int i, out_eps = 0, in_eps = 0; |
1670 | 1672 | ||
1671 | if (USB_ID_VENDOR(umidi->chip->usb_id) == 0x0582) | 1673 | if (USB_ID_VENDOR(umidi->usb_id) == 0x0582) |
1672 | snd_usbmidi_switch_roland_altsetting(umidi); | 1674 | snd_usbmidi_switch_roland_altsetting(umidi); |
1673 | 1675 | ||
1674 | if (endpoint[0].out_ep || endpoint[0].in_ep) | 1676 | if (endpoint[0].out_ep || endpoint[0].in_ep) |
@@ -1855,12 +1857,12 @@ static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi, | |||
1855 | struct snd_rawmidi *rmidi; | 1857 | struct snd_rawmidi *rmidi; |
1856 | int err; | 1858 | int err; |
1857 | 1859 | ||
1858 | err = snd_rawmidi_new(umidi->chip->card, "USB MIDI", | 1860 | err = snd_rawmidi_new(umidi->card, "USB MIDI", |
1859 | umidi->chip->next_midi_device++, | 1861 | umidi->next_midi_device++, |
1860 | out_ports, in_ports, &rmidi); | 1862 | out_ports, in_ports, &rmidi); |
1861 | if (err < 0) | 1863 | if (err < 0) |
1862 | return err; | 1864 | return err; |
1863 | strcpy(rmidi->name, umidi->chip->card->shortname); | 1865 | strcpy(rmidi->name, umidi->card->shortname); |
1864 | rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | | 1866 | rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | |
1865 | SNDRV_RAWMIDI_INFO_INPUT | | 1867 | SNDRV_RAWMIDI_INFO_INPUT | |
1866 | SNDRV_RAWMIDI_INFO_DUPLEX; | 1868 | SNDRV_RAWMIDI_INFO_DUPLEX; |
@@ -1899,7 +1901,7 @@ static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep) | |||
1899 | return; | 1901 | return; |
1900 | for (i = 0; i < INPUT_URBS; ++i) { | 1902 | for (i = 0; i < INPUT_URBS; ++i) { |
1901 | struct urb* urb = ep->urbs[i]; | 1903 | struct urb* urb = ep->urbs[i]; |
1902 | urb->dev = ep->umidi->chip->dev; | 1904 | urb->dev = ep->umidi->dev; |
1903 | snd_usbmidi_submit_urb(urb, GFP_KERNEL); | 1905 | snd_usbmidi_submit_urb(urb, GFP_KERNEL); |
1904 | } | 1906 | } |
1905 | } | 1907 | } |
@@ -1920,9 +1922,10 @@ void snd_usbmidi_input_start(struct list_head* p) | |||
1920 | /* | 1922 | /* |
1921 | * Creates and registers everything needed for a MIDI streaming interface. | 1923 | * Creates and registers everything needed for a MIDI streaming interface. |
1922 | */ | 1924 | */ |
1923 | int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | 1925 | int snd_usbmidi_create(struct snd_card *card, |
1924 | struct usb_interface* iface, | 1926 | struct usb_interface* iface, |
1925 | const struct snd_usb_audio_quirk* quirk) | 1927 | struct list_head *midi_list, |
1928 | const struct snd_usb_audio_quirk* quirk) | ||
1926 | { | 1929 | { |
1927 | struct snd_usb_midi* umidi; | 1930 | struct snd_usb_midi* umidi; |
1928 | struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS]; | 1931 | struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS]; |
@@ -1932,13 +1935,16 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | |||
1932 | umidi = kzalloc(sizeof(*umidi), GFP_KERNEL); | 1935 | umidi = kzalloc(sizeof(*umidi), GFP_KERNEL); |
1933 | if (!umidi) | 1936 | if (!umidi) |
1934 | return -ENOMEM; | 1937 | return -ENOMEM; |
1935 | umidi->chip = chip; | 1938 | umidi->dev = interface_to_usbdev(iface); |
1939 | umidi->card = card; | ||
1936 | umidi->iface = iface; | 1940 | umidi->iface = iface; |
1937 | umidi->quirk = quirk; | 1941 | umidi->quirk = quirk; |
1938 | umidi->usb_protocol_ops = &snd_usbmidi_standard_ops; | 1942 | umidi->usb_protocol_ops = &snd_usbmidi_standard_ops; |
1939 | init_timer(&umidi->error_timer); | 1943 | init_timer(&umidi->error_timer); |
1940 | spin_lock_init(&umidi->disc_lock); | 1944 | spin_lock_init(&umidi->disc_lock); |
1941 | mutex_init(&umidi->mutex); | 1945 | mutex_init(&umidi->mutex); |
1946 | umidi->usb_id = USB_ID(le16_to_cpu(umidi->dev->descriptor.idVendor), | ||
1947 | le16_to_cpu(umidi->dev->descriptor.idProduct)); | ||
1942 | umidi->error_timer.function = snd_usbmidi_error_timer; | 1948 | umidi->error_timer.function = snd_usbmidi_error_timer; |
1943 | umidi->error_timer.data = (unsigned long)umidi; | 1949 | umidi->error_timer.data = (unsigned long)umidi; |
1944 | 1950 | ||
@@ -1947,7 +1953,7 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | |||
1947 | switch (quirk ? quirk->type : QUIRK_MIDI_STANDARD_INTERFACE) { | 1953 | switch (quirk ? quirk->type : QUIRK_MIDI_STANDARD_INTERFACE) { |
1948 | case QUIRK_MIDI_STANDARD_INTERFACE: | 1954 | case QUIRK_MIDI_STANDARD_INTERFACE: |
1949 | err = snd_usbmidi_get_ms_info(umidi, endpoints); | 1955 | err = snd_usbmidi_get_ms_info(umidi, endpoints); |
1950 | if (chip->usb_id == USB_ID(0x0763, 0x0150)) /* M-Audio Uno */ | 1956 | if (umidi->usb_id == USB_ID(0x0763, 0x0150)) /* M-Audio Uno */ |
1951 | umidi->usb_protocol_ops = | 1957 | umidi->usb_protocol_ops = |
1952 | &snd_usbmidi_maudio_broken_running_status_ops; | 1958 | &snd_usbmidi_maudio_broken_running_status_ops; |
1953 | break; | 1959 | break; |
@@ -1983,7 +1989,7 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | |||
1983 | * interface 0, so we have to make sure that the USB core looks | 1989 | * interface 0, so we have to make sure that the USB core looks |
1984 | * again at interface 0 by calling usb_set_interface() on it. | 1990 | * again at interface 0 by calling usb_set_interface() on it. |
1985 | */ | 1991 | */ |
1986 | usb_set_interface(umidi->chip->dev, 0, 0); | 1992 | usb_set_interface(umidi->dev, 0, 0); |
1987 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1993 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1988 | break; | 1994 | break; |
1989 | case QUIRK_MIDI_EMAGIC: | 1995 | case QUIRK_MIDI_EMAGIC: |
@@ -2029,14 +2035,14 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | |||
2029 | return err; | 2035 | return err; |
2030 | } | 2036 | } |
2031 | 2037 | ||
2032 | list_add(&umidi->list, &umidi->chip->midi_list); | 2038 | list_add_tail(&umidi->list, midi_list); |
2033 | 2039 | ||
2034 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) | 2040 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) |
2035 | snd_usbmidi_input_start_ep(umidi->endpoints[i].in); | 2041 | snd_usbmidi_input_start_ep(umidi->endpoints[i].in); |
2036 | return 0; | 2042 | return 0; |
2037 | } | 2043 | } |
2038 | 2044 | ||
2039 | EXPORT_SYMBOL(snd_usb_create_midi_interface); | 2045 | EXPORT_SYMBOL(snd_usbmidi_create); |
2040 | EXPORT_SYMBOL(snd_usbmidi_input_stop); | 2046 | EXPORT_SYMBOL(snd_usbmidi_input_stop); |
2041 | EXPORT_SYMBOL(snd_usbmidi_input_start); | 2047 | EXPORT_SYMBOL(snd_usbmidi_input_start); |
2042 | EXPORT_SYMBOL(snd_usbmidi_disconnect); | 2048 | EXPORT_SYMBOL(snd_usbmidi_disconnect); |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 00cd54c236b4..0ad061e5728b 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -62,8 +62,8 @@ static int us122l_create_usbmidi(struct snd_card *card) | |||
62 | struct usb_device *dev = US122L(card)->chip.dev; | 62 | struct usb_device *dev = US122L(card)->chip.dev; |
63 | struct usb_interface *iface = usb_ifnum_to_if(dev, 1); | 63 | struct usb_interface *iface = usb_ifnum_to_if(dev, 1); |
64 | 64 | ||
65 | return snd_usb_create_midi_interface(&US122L(card)->chip, | 65 | return snd_usbmidi_create(card, iface, |
66 | iface, &quirk); | 66 | &US122L(card)->midi_list, &quirk); |
67 | } | 67 | } |
68 | 68 | ||
69 | static int us144_create_usbmidi(struct snd_card *card) | 69 | static int us144_create_usbmidi(struct snd_card *card) |
@@ -84,8 +84,8 @@ static int us144_create_usbmidi(struct snd_card *card) | |||
84 | struct usb_device *dev = US122L(card)->chip.dev; | 84 | struct usb_device *dev = US122L(card)->chip.dev; |
85 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); | 85 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); |
86 | 86 | ||
87 | return snd_usb_create_midi_interface(&US122L(card)->chip, | 87 | return snd_usbmidi_create(card, iface, |
88 | iface, &quirk); | 88 | &US122L(card)->midi_list, &quirk); |
89 | } | 89 | } |
90 | 90 | ||
91 | /* | 91 | /* |
@@ -297,7 +297,7 @@ static unsigned int usb_stream_hwdep_poll(struct snd_hwdep *hw, | |||
297 | static void us122l_stop(struct us122l *us122l) | 297 | static void us122l_stop(struct us122l *us122l) |
298 | { | 298 | { |
299 | struct list_head *p; | 299 | struct list_head *p; |
300 | list_for_each(p, &us122l->chip.midi_list) | 300 | list_for_each(p, &us122l->midi_list) |
301 | snd_usbmidi_input_stop(p); | 301 | snd_usbmidi_input_stop(p); |
302 | 302 | ||
303 | usb_stream_stop(&us122l->sk); | 303 | usb_stream_stop(&us122l->sk); |
@@ -363,7 +363,7 @@ static bool us122l_start(struct us122l *us122l, | |||
363 | snd_printk(KERN_ERR "us122l_start error %i \n", err); | 363 | snd_printk(KERN_ERR "us122l_start error %i \n", err); |
364 | goto out; | 364 | goto out; |
365 | } | 365 | } |
366 | list_for_each(p, &us122l->chip.midi_list) | 366 | list_for_each(p, &us122l->midi_list) |
367 | snd_usbmidi_input_start(p); | 367 | snd_usbmidi_input_start(p); |
368 | success = true; | 368 | success = true; |
369 | out: | 369 | out: |
@@ -508,7 +508,7 @@ static bool us122l_create_card(struct snd_card *card) | |||
508 | if (err < 0) { | 508 | if (err < 0) { |
509 | /* release the midi resources */ | 509 | /* release the midi resources */ |
510 | struct list_head *p; | 510 | struct list_head *p; |
511 | list_for_each(p, &us122l->chip.midi_list) | 511 | list_for_each(p, &us122l->midi_list) |
512 | snd_usbmidi_disconnect(p); | 512 | snd_usbmidi_disconnect(p); |
513 | 513 | ||
514 | us122l_stop(us122l); | 514 | us122l_stop(us122l); |
@@ -546,7 +546,7 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
546 | US122L(card)->chip.card = card; | 546 | US122L(card)->chip.card = card; |
547 | mutex_init(&US122L(card)->mutex); | 547 | mutex_init(&US122L(card)->mutex); |
548 | init_waitqueue_head(&US122L(card)->sk.sleep); | 548 | init_waitqueue_head(&US122L(card)->sk.sleep); |
549 | INIT_LIST_HEAD(&US122L(card)->chip.midi_list); | 549 | INIT_LIST_HEAD(&US122L(card)->midi_list); |
550 | strcpy(card->driver, "USB "NAME_ALLCAPS""); | 550 | strcpy(card->driver, "USB "NAME_ALLCAPS""); |
551 | sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); | 551 | sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); |
552 | sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", | 552 | sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", |
@@ -638,7 +638,7 @@ static void snd_us122l_disconnect(struct usb_interface *intf) | |||
638 | us122l->chip.shutdown = 1; | 638 | us122l->chip.shutdown = 1; |
639 | 639 | ||
640 | /* release the midi resources */ | 640 | /* release the midi resources */ |
641 | list_for_each(p, &us122l->chip.midi_list) { | 641 | list_for_each(p, &us122l->midi_list) { |
642 | snd_usbmidi_disconnect(p); | 642 | snd_usbmidi_disconnect(p); |
643 | } | 643 | } |
644 | 644 | ||
@@ -667,7 +667,7 @@ static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message) | |||
667 | if (!us122l) | 667 | if (!us122l) |
668 | return 0; | 668 | return 0; |
669 | 669 | ||
670 | list_for_each(p, &us122l->chip.midi_list) | 670 | list_for_each(p, &us122l->midi_list) |
671 | snd_usbmidi_input_stop(p); | 671 | snd_usbmidi_input_stop(p); |
672 | 672 | ||
673 | mutex_lock(&us122l->mutex); | 673 | mutex_lock(&us122l->mutex); |
@@ -720,7 +720,7 @@ static int snd_us122l_resume(struct usb_interface *intf) | |||
720 | if (err) | 720 | if (err) |
721 | goto unlock; | 721 | goto unlock; |
722 | 722 | ||
723 | list_for_each(p, &us122l->chip.midi_list) | 723 | list_for_each(p, &us122l->midi_list) |
724 | snd_usbmidi_input_start(p); | 724 | snd_usbmidi_input_start(p); |
725 | unlock: | 725 | unlock: |
726 | mutex_unlock(&us122l->mutex); | 726 | mutex_unlock(&us122l->mutex); |
diff --git a/sound/usb/usx2y/us122l.h b/sound/usb/usx2y/us122l.h index 3d10c4b2a0f5..61ce5d7de0b9 100644 --- a/sound/usb/usx2y/us122l.h +++ b/sound/usb/usx2y/us122l.h | |||
@@ -12,6 +12,7 @@ struct us122l { | |||
12 | unsigned second_periods_polled; | 12 | unsigned second_periods_polled; |
13 | struct file *master; | 13 | struct file *master; |
14 | struct file *slave; | 14 | struct file *slave; |
15 | struct list_head midi_list; | ||
15 | 16 | ||
16 | atomic_t mmap_count; | 17 | atomic_t mmap_count; |
17 | }; | 18 | }; |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 52e04b2f35d3..f96ab86259d0 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -171,7 +171,7 @@ static int usX2Y_create_usbmidi(struct snd_card *card) | |||
171 | &quirk_2 : &quirk_1; | 171 | &quirk_2 : &quirk_1; |
172 | 172 | ||
173 | snd_printdd("usX2Y_create_usbmidi \n"); | 173 | snd_printdd("usX2Y_create_usbmidi \n"); |
174 | return snd_usb_create_midi_interface(&usX2Y(card)->chip, iface, quirk); | 174 | return snd_usbmidi_create(card, iface, &usX2Y(card)->midi_list, quirk); |
175 | } | 175 | } |
176 | 176 | ||
177 | static int usX2Y_create_alsa_devices(struct snd_card *card) | 177 | static int usX2Y_create_alsa_devices(struct snd_card *card) |
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index cb4bb8373ca2..181337090e48 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -354,7 +354,7 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
354 | usX2Y(card)->chip.card = card; | 354 | usX2Y(card)->chip.card = card; |
355 | init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); | 355 | init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); |
356 | mutex_init(&usX2Y(card)->prepare_mutex); | 356 | mutex_init(&usX2Y(card)->prepare_mutex); |
357 | INIT_LIST_HEAD(&usX2Y(card)->chip.midi_list); | 357 | INIT_LIST_HEAD(&usX2Y(card)->midi_list); |
358 | strcpy(card->driver, "USB "NAME_ALLCAPS""); | 358 | strcpy(card->driver, "USB "NAME_ALLCAPS""); |
359 | sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); | 359 | sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); |
360 | sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", | 360 | sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", |
@@ -451,7 +451,7 @@ static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr) | |||
451 | usb_kill_urb(usX2Y->In04urb); | 451 | usb_kill_urb(usX2Y->In04urb); |
452 | snd_card_disconnect(card); | 452 | snd_card_disconnect(card); |
453 | /* release the midi resources */ | 453 | /* release the midi resources */ |
454 | list_for_each(p, &usX2Y->chip.midi_list) { | 454 | list_for_each(p, &usX2Y->midi_list) { |
455 | snd_usbmidi_disconnect(p); | 455 | snd_usbmidi_disconnect(p); |
456 | } | 456 | } |
457 | if (usX2Y->us428ctls_sharedmem) | 457 | if (usX2Y->us428ctls_sharedmem) |
diff --git a/sound/usb/usx2y/usbusx2y.h b/sound/usb/usx2y/usbusx2y.h index 456b5fdbc339..231866ea3491 100644 --- a/sound/usb/usx2y/usbusx2y.h +++ b/sound/usb/usx2y/usbusx2y.h | |||
@@ -42,6 +42,7 @@ struct usX2Ydev { | |||
42 | struct snd_usX2Y_substream *subs[4]; | 42 | struct snd_usX2Y_substream *subs[4]; |
43 | struct snd_usX2Y_substream * volatile prepare_subs; | 43 | struct snd_usX2Y_substream * volatile prepare_subs; |
44 | wait_queue_head_t prepare_wait_queue; | 44 | wait_queue_head_t prepare_wait_queue; |
45 | struct list_head midi_list; | ||
45 | }; | 46 | }; |
46 | 47 | ||
47 | 48 | ||
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index 9efd27f6b52f..b8e2f4691493 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -740,7 +740,7 @@ static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format) | |||
740 | alternate = 1; | 740 | alternate = 1; |
741 | usX2Y->stride = 4; | 741 | usX2Y->stride = 4; |
742 | } | 742 | } |
743 | list_for_each(p, &usX2Y->chip.midi_list) { | 743 | list_for_each(p, &usX2Y->midi_list) { |
744 | snd_usbmidi_input_stop(p); | 744 | snd_usbmidi_input_stop(p); |
745 | } | 745 | } |
746 | usb_kill_urb(usX2Y->In04urb); | 746 | usb_kill_urb(usX2Y->In04urb); |
@@ -750,7 +750,7 @@ static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format) | |||
750 | } | 750 | } |
751 | usX2Y->In04urb->dev = usX2Y->chip.dev; | 751 | usX2Y->In04urb->dev = usX2Y->chip.dev; |
752 | err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); | 752 | err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); |
753 | list_for_each(p, &usX2Y->chip.midi_list) { | 753 | list_for_each(p, &usX2Y->midi_list) { |
754 | snd_usbmidi_input_start(p); | 754 | snd_usbmidi_input_start(p); |
755 | } | 755 | } |
756 | usX2Y->format = format; | 756 | usX2Y->format = format; |