aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbaudio.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-09-14 02:36:03 -0400
committerJaroslav Kysela <perex@suse.cz>2005-11-04 07:15:49 -0500
commitd1bda0455478a9e2a13381044e9bb80a17ec92d2 (patch)
treefcf79d93d1b7293dfd6472b58dddf6ec52b7914c /sound/usb/usbaudio.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/usbaudio.c')
-rw-r--r--sound/usb/usbaudio.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 2ead878bcb8f..ea1b1f87c1b6 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -2755,9 +2755,9 @@ static int create_fixed_stream_quirk(snd_usb_audio_t *chip,
2755/* 2755/*
2756 * create a stream for an interface with proper descriptors 2756 * create a stream for an interface with proper descriptors
2757 */ 2757 */
2758static int create_standard_interface_quirk(snd_usb_audio_t *chip, 2758static int create_standard_audio_quirk(snd_usb_audio_t *chip,
2759 struct usb_interface *iface, 2759 struct usb_interface *iface,
2760 const snd_usb_audio_quirk_t *quirk) 2760 const snd_usb_audio_quirk_t *quirk)
2761{ 2761{
2762 struct usb_host_interface *alts; 2762 struct usb_host_interface *alts;
2763 struct usb_interface_descriptor *altsd; 2763 struct usb_interface_descriptor *altsd;
@@ -2765,24 +2765,14 @@ static int create_standard_interface_quirk(snd_usb_audio_t *chip,
2765 2765
2766 alts = &iface->altsetting[0]; 2766 alts = &iface->altsetting[0];
2767 altsd = get_iface_desc(alts); 2767 altsd = get_iface_desc(alts);
2768 switch (quirk->type) { 2768 err = parse_audio_endpoints(chip, altsd->bInterfaceNumber);
2769 case QUIRK_AUDIO_STANDARD_INTERFACE:
2770 err = parse_audio_endpoints(chip, altsd->bInterfaceNumber);
2771 if (!err)
2772 usb_set_interface(chip->dev, altsd->bInterfaceNumber, 0); /* reset the current interface */
2773 break;
2774 case QUIRK_MIDI_STANDARD_INTERFACE:
2775 err = snd_usb_create_midi_interface(chip, iface, NULL);
2776 break;
2777 default:
2778 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type);
2779 return -ENXIO;
2780 }
2781 if (err < 0) { 2769 if (err < 0) {
2782 snd_printk(KERN_ERR "cannot setup if %d: error %d\n", 2770 snd_printk(KERN_ERR "cannot setup if %d: error %d\n",
2783 altsd->bInterfaceNumber, err); 2771 altsd->bInterfaceNumber, err);
2784 return err; 2772 return err;
2785 } 2773 }
2774 /* reset the current interface */
2775 usb_set_interface(chip->dev, altsd->bInterfaceNumber, 0);
2786 return 0; 2776 return 0;
2787} 2777}
2788 2778
@@ -3044,7 +3034,7 @@ static int snd_usb_create_quirk(snd_usb_audio_t *chip,
3044 [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface, 3034 [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface,
3045 [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, 3035 [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface,
3046 [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface, 3036 [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface,
3047 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_interface_quirk, 3037 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
3048 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, 3038 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
3049 [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk, 3039 [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk,
3050 [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, 3040 [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk,