diff options
author | Damien Zammit <damien@zamaudio.com> | 2013-01-04 03:51:44 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-01-04 03:53:17 -0500 |
commit | b7b435e81b7228af68b5d3bef277fce10100b369 (patch) | |
tree | 07f7e0d1d4fea7403c39a4c3e3e5f7e1bea76f55 /sound/usb | |
parent | 8f7f3ab15e0873a9b04d5a38ef1d33831aaf609d (diff) |
ALSA: usb-audio: Fix kernel panic of Digidesign Mbox2 quirk
This patch is based on 3.8-rc1. It fixes two things:
1) A kernel panic caused by incorrect allocation of a u8 variable
"bootresponse".
2) A noisy dmesg (urb status -32) caused by broken pipe to an
invalid midi endpoint.
It is also a little cleaner because there is no need for a new
QUIRK_MIDI type as suggested by kernel developers, since the device
follows exactly the MIDIMAN protocol.
Signed-off-by: Damien Zammit <damien@zamaudio.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/midi.c | 4 | ||||
-rw-r--r-- | sound/usb/quirks-table.h | 2 | ||||
-rw-r--r-- | sound/usb/quirks.c | 16 | ||||
-rw-r--r-- | sound/usb/usbaudio.h | 1 |
4 files changed, 8 insertions, 15 deletions
diff --git a/sound/usb/midi.c b/sound/usb/midi.c index c183d34842ac..34b9bb7fe87c 100644 --- a/sound/usb/midi.c +++ b/sound/usb/midi.c | |||
@@ -2181,10 +2181,6 @@ int snd_usbmidi_create(struct snd_card *card, | |||
2181 | umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; | 2181 | umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; |
2182 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 2182 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
2183 | break; | 2183 | break; |
2184 | case QUIRK_MIDI_MBOX2: | ||
2185 | umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops; | ||
2186 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | ||
2187 | break; | ||
2188 | case QUIRK_MIDI_RAW_BYTES: | 2184 | case QUIRK_MIDI_RAW_BYTES: |
2189 | umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; | 2185 | umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; |
2190 | /* | 2186 | /* |
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 5388ca3a4ab0..78e845ec65da 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h | |||
@@ -3015,7 +3015,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
3015 | }, | 3015 | }, |
3016 | { | 3016 | { |
3017 | .ifnum = 6, | 3017 | .ifnum = 6, |
3018 | .type = QUIRK_MIDI_MBOX2, | 3018 | .type = QUIRK_MIDI_MIDIMAN, |
3019 | .data = &(const struct snd_usb_midi_endpoint_info) { | 3019 | .data = &(const struct snd_usb_midi_endpoint_info) { |
3020 | .out_ep = 0x02, | 3020 | .out_ep = 0x02, |
3021 | .out_cables = 0x0001, | 3021 | .out_cables = 0x0001, |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index f104c68fe1e0..acc12f004c23 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -306,7 +306,6 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, | |||
306 | [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk, | 306 | [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk, |
307 | [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk, | 307 | [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk, |
308 | [QUIRK_MIDI_NOVATION] = create_any_midi_quirk, | 308 | [QUIRK_MIDI_NOVATION] = create_any_midi_quirk, |
309 | [QUIRK_MIDI_MBOX2] = create_any_midi_quirk, | ||
310 | [QUIRK_MIDI_RAW_BYTES] = create_any_midi_quirk, | 309 | [QUIRK_MIDI_RAW_BYTES] = create_any_midi_quirk, |
311 | [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk, | 310 | [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk, |
312 | [QUIRK_MIDI_CME] = create_any_midi_quirk, | 311 | [QUIRK_MIDI_CME] = create_any_midi_quirk, |
@@ -528,11 +527,11 @@ static void mbox2_setup_48_24_magic(struct usb_device *dev) | |||
528 | #define MBOX2_BOOT_LOADING 0x01 /* Hard coded into the device */ | 527 | #define MBOX2_BOOT_LOADING 0x01 /* Hard coded into the device */ |
529 | #define MBOX2_BOOT_READY 0x02 /* Hard coded into the device */ | 528 | #define MBOX2_BOOT_READY 0x02 /* Hard coded into the device */ |
530 | 529 | ||
531 | int snd_usb_mbox2_boot_quirk(struct usb_device *dev) | 530 | static int snd_usb_mbox2_boot_quirk(struct usb_device *dev) |
532 | { | 531 | { |
533 | struct usb_host_config *config = dev->actconfig; | 532 | struct usb_host_config *config = dev->actconfig; |
534 | int err; | 533 | int err; |
535 | u8 bootresponse; | 534 | u8 bootresponse[12]; |
536 | int fwsize; | 535 | int fwsize; |
537 | int count; | 536 | int count; |
538 | 537 | ||
@@ -546,20 +545,20 @@ int snd_usb_mbox2_boot_quirk(struct usb_device *dev) | |||
546 | snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n"); | 545 | snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n"); |
547 | 546 | ||
548 | count = 0; | 547 | count = 0; |
549 | bootresponse = MBOX2_BOOT_LOADING; | 548 | bootresponse[0] = MBOX2_BOOT_LOADING; |
550 | while ((bootresponse == MBOX2_BOOT_LOADING) && (count < 10)) { | 549 | while ((bootresponse[0] == MBOX2_BOOT_LOADING) && (count < 10)) { |
551 | msleep(500); /* 0.5 second delay */ | 550 | msleep(500); /* 0.5 second delay */ |
552 | snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), | 551 | snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), |
553 | /* Control magic - load onboard firmware */ | 552 | /* Control magic - load onboard firmware */ |
554 | 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012); | 553 | 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012); |
555 | if (bootresponse == MBOX2_BOOT_READY) | 554 | if (bootresponse[0] == MBOX2_BOOT_READY) |
556 | break; | 555 | break; |
557 | snd_printd("usb-audio: device not ready, resending boot sequence...\n"); | 556 | snd_printd("usb-audio: device not ready, resending boot sequence...\n"); |
558 | count++; | 557 | count++; |
559 | } | 558 | } |
560 | 559 | ||
561 | if (bootresponse != MBOX2_BOOT_READY) { | 560 | if (bootresponse[0] != MBOX2_BOOT_READY) { |
562 | snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse); | 561 | snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]); |
563 | return -ENODEV; | 562 | return -ENODEV; |
564 | } | 563 | } |
565 | 564 | ||
@@ -660,7 +659,6 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, | |||
660 | return 0; /* keep this altsetting */ | 659 | return 0; /* keep this altsetting */ |
661 | } | 660 | } |
662 | 661 | ||
663 | |||
664 | static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, | 662 | static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, |
665 | int iface, int altno) | 663 | int iface, int altno) |
666 | { | 664 | { |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index a8172c119796..1ac3fd9cc5a6 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -76,7 +76,6 @@ enum quirk_type { | |||
76 | QUIRK_MIDI_YAMAHA, | 76 | QUIRK_MIDI_YAMAHA, |
77 | QUIRK_MIDI_MIDIMAN, | 77 | QUIRK_MIDI_MIDIMAN, |
78 | QUIRK_MIDI_NOVATION, | 78 | QUIRK_MIDI_NOVATION, |
79 | QUIRK_MIDI_MBOX2, | ||
80 | QUIRK_MIDI_RAW_BYTES, | 79 | QUIRK_MIDI_RAW_BYTES, |
81 | QUIRK_MIDI_EMAGIC, | 80 | QUIRK_MIDI_EMAGIC, |
82 | QUIRK_MIDI_CME, | 81 | QUIRK_MIDI_CME, |