summaryrefslogtreecommitdiff
path: root/sound/usb/usbmidi.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-09-14 08:36:03 +0200
committerJaroslav Kysela <perex@suse.cz>2005-11-04 13:15:49 +0100
commitd1bda0455478a9e2a13381044e9bb80a17ec92d2 (patch)
treefcf79d93d1b7293dfd6472b58dddf6ec52b7914c /sound/usb/usbmidi.c
parent5747e54042c710272cefed74cc457531a01768c9 (diff)
[ALSA] usb-audio: simplify MIDI quirk handling
Modules: USB generic driver Simplify the handling of MIDI quirks by treating an interface without quirks as a QUIRK_MIDI_STANDARD_INTERFACE. This also fixes the bug where a MIDI_STANDARD quirk would not be recognized. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/usb/usbmidi.c')
-rw-r--r--sound/usb/usbmidi.c77
1 files changed, 38 insertions, 39 deletions
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index f1a2e2c2e02f..32be9f99c023 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -1550,46 +1550,45 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip,
/* detect the endpoint(s) to use */
memset(endpoints, 0, sizeof(endpoints));
- if (!quirk) {
+ switch (quirk ? quirk->type : QUIRK_MIDI_STANDARD_INTERFACE) {
+ case QUIRK_MIDI_STANDARD_INTERFACE:
err = snd_usbmidi_get_ms_info(umidi, endpoints);
- } else {
- switch (quirk->type) {
- case QUIRK_MIDI_FIXED_ENDPOINT:
- memcpy(&endpoints[0], quirk->data,
- sizeof(snd_usb_midi_endpoint_info_t));
- err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1);
- break;
- case QUIRK_MIDI_YAMAHA:
- err = snd_usbmidi_detect_yamaha(umidi, &endpoints[0]);
- break;
- case QUIRK_MIDI_MIDIMAN:
- umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops;
- memcpy(&endpoints[0], quirk->data,
- sizeof(snd_usb_midi_endpoint_info_t));
- err = 0;
- break;
- case QUIRK_MIDI_NOVATION:
- umidi->usb_protocol_ops = &snd_usbmidi_novation_ops;
- err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
- break;
- case QUIRK_MIDI_RAW:
- umidi->usb_protocol_ops = &snd_usbmidi_raw_ops;
- err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
- break;
- case QUIRK_MIDI_EMAGIC:
- umidi->usb_protocol_ops = &snd_usbmidi_emagic_ops;
- memcpy(&endpoints[0], quirk->data,
- sizeof(snd_usb_midi_endpoint_info_t));
- err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1);
- break;
- case QUIRK_MIDI_MIDITECH:
- err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
- break;
- default:
- snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type);
- err = -ENXIO;
- break;
- }
+ break;
+ case QUIRK_MIDI_FIXED_ENDPOINT:
+ memcpy(&endpoints[0], quirk->data,
+ sizeof(snd_usb_midi_endpoint_info_t));
+ err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1);
+ break;
+ case QUIRK_MIDI_YAMAHA:
+ err = snd_usbmidi_detect_yamaha(umidi, &endpoints[0]);
+ break;
+ case QUIRK_MIDI_MIDIMAN:
+ umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops;
+ memcpy(&endpoints[0], quirk->data,
+ sizeof(snd_usb_midi_endpoint_info_t));
+ err = 0;
+ break;
+ case QUIRK_MIDI_NOVATION:
+ umidi->usb_protocol_ops = &snd_usbmidi_novation_ops;
+ err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
+ break;
+ case QUIRK_MIDI_RAW:
+ umidi->usb_protocol_ops = &snd_usbmidi_raw_ops;
+ err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
+ break;
+ case QUIRK_MIDI_EMAGIC:
+ umidi->usb_protocol_ops = &snd_usbmidi_emagic_ops;
+ memcpy(&endpoints[0], quirk->data,
+ sizeof(snd_usb_midi_endpoint_info_t));
+ err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1);
+ break;
+ case QUIRK_MIDI_MIDITECH:
+ err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
+ break;
+ default:
+ snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type);
+ err = -ENXIO;
+ break;
}
if (err < 0) {
kfree(umidi);