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/usbaudio.c | |
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/usbaudio.c')
-rw-r--r-- | sound/usb/usbaudio.c | 38 |
1 files changed, 23 insertions, 15 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, |