diff options
author | Daniel Mack <daniel@caiaq.de> | 2011-02-11 06:34:12 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-02-14 11:11:12 -0500 |
commit | 3347b26cab60e20534b9a46ceea70b9fb74297fb (patch) | |
tree | 6a7552d7a492ea9c9ce34ca6e20f82b6696b6aa8 /sound | |
parent | 54a8c500d5b80c83e0f14cbcfcfd4a84abff8a80 (diff) |
ALSA: usb-audio: reconstruct some dispatcher functions to use switch-case
The number of cases has increased so use switch-case rather than
if-statements.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/mixer_quirks.c | 41 | ||||
-rw-r--r-- | sound/usb/quirks.c | 29 |
2 files changed, 33 insertions, 37 deletions
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 3fe612a369a7..73dcc8256bc0 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c | |||
@@ -502,49 +502,44 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, | |||
502 | 502 | ||
503 | int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) | 503 | int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) |
504 | { | 504 | { |
505 | int err; | 505 | int err = 0; |
506 | struct snd_info_entry *entry; | 506 | struct snd_info_entry *entry; |
507 | 507 | ||
508 | if ((err = snd_usb_soundblaster_remote_init(mixer)) < 0) | 508 | if ((err = snd_usb_soundblaster_remote_init(mixer)) < 0) |
509 | return err; | 509 | return err; |
510 | 510 | ||
511 | if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) || | 511 | switch (mixer->chip->usb_id) { |
512 | mixer->chip->usb_id == USB_ID(0x041e, 0x3040) || | 512 | case USB_ID(0x041e, 0x3020): |
513 | mixer->chip->usb_id == USB_ID(0x041e, 0x3042) || | 513 | case USB_ID(0x041e, 0x3040): |
514 | mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) { | 514 | case USB_ID(0x041e, 0x3042): |
515 | if ((err = snd_audigy2nx_controls_create(mixer)) < 0) | 515 | case USB_ID(0x041e, 0x3048): |
516 | return err; | 516 | err = snd_audigy2nx_controls_create(mixer); |
517 | if (err < 0) | ||
518 | break; | ||
517 | if (!snd_card_proc_new(mixer->chip->card, "audigy2nx", &entry)) | 519 | if (!snd_card_proc_new(mixer->chip->card, "audigy2nx", &entry)) |
518 | snd_info_set_text_ops(entry, mixer, | 520 | snd_info_set_text_ops(entry, mixer, |
519 | snd_audigy2nx_proc_read); | 521 | snd_audigy2nx_proc_read); |
520 | } | 522 | break; |
521 | 523 | ||
522 | if (mixer->chip->usb_id == USB_ID(0x0b05, 0x1739) || | 524 | case USB_ID(0x0b05, 0x1739): |
523 | mixer->chip->usb_id == USB_ID(0x0b05, 0x1743)) { | 525 | case USB_ID(0x0b05, 0x1743): |
524 | err = snd_xonar_u1_controls_create(mixer); | 526 | err = snd_xonar_u1_controls_create(mixer); |
525 | if (err < 0) | 527 | break; |
526 | return err; | ||
527 | } | ||
528 | 528 | ||
529 | /* Traktor Audio 6 */ | 529 | case USB_ID(0x17cc, 0x1011): /* Traktor Audio 6 */ |
530 | if (mixer->chip->usb_id == USB_ID(0x17cc, 0x1011)) { | ||
531 | err = snd_nativeinstruments_create_mixer(mixer, | 530 | err = snd_nativeinstruments_create_mixer(mixer, |
532 | snd_nativeinstruments_ta6_mixers, | 531 | snd_nativeinstruments_ta6_mixers, |
533 | ARRAY_SIZE(snd_nativeinstruments_ta6_mixers)); | 532 | ARRAY_SIZE(snd_nativeinstruments_ta6_mixers)); |
534 | if (err < 0) | 533 | break; |
535 | return err; | ||
536 | } | ||
537 | 534 | ||
538 | /* Traktor Audio 10 */ | 535 | case USB_ID(0x17cc, 0x1021): /* Traktor Audio 10 */ |
539 | if (mixer->chip->usb_id == USB_ID(0x17cc, 0x1021)) { | ||
540 | err = snd_nativeinstruments_create_mixer(mixer, | 536 | err = snd_nativeinstruments_create_mixer(mixer, |
541 | snd_nativeinstruments_ta10_mixers, | 537 | snd_nativeinstruments_ta10_mixers, |
542 | ARRAY_SIZE(snd_nativeinstruments_ta10_mixers)); | 538 | ARRAY_SIZE(snd_nativeinstruments_ta10_mixers)); |
543 | if (err < 0) | 539 | break; |
544 | return err; | ||
545 | } | 540 | } |
546 | 541 | ||
547 | return 0; | 542 | return err; |
548 | } | 543 | } |
549 | 544 | ||
550 | void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer, | 545 | void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer, |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index e55bd1cac77d..ca860e611263 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -517,31 +517,32 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev, | |||
517 | u32 id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), | 517 | u32 id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), |
518 | le16_to_cpu(dev->descriptor.idProduct)); | 518 | le16_to_cpu(dev->descriptor.idProduct)); |
519 | 519 | ||
520 | /* SB Extigy needs special boot-up sequence */ | 520 | switch (id) { |
521 | /* if more models come, this will go to the quirk list. */ | 521 | case USB_ID(0x041e, 0x3000): |
522 | if (id == USB_ID(0x041e, 0x3000)) | 522 | /* SB Extigy needs special boot-up sequence */ |
523 | /* if more models come, this will go to the quirk list. */ | ||
523 | return snd_usb_extigy_boot_quirk(dev, intf); | 524 | return snd_usb_extigy_boot_quirk(dev, intf); |
524 | 525 | ||
525 | /* SB Audigy 2 NX needs its own boot-up magic, too */ | 526 | case USB_ID(0x041e, 0x3020): |
526 | if (id == USB_ID(0x041e, 0x3020)) | 527 | /* SB Audigy 2 NX needs its own boot-up magic, too */ |
527 | return snd_usb_audigy2nx_boot_quirk(dev); | 528 | return snd_usb_audigy2nx_boot_quirk(dev); |
528 | 529 | ||
529 | /* C-Media CM106 / Turtle Beach Audio Advantage Roadie */ | 530 | case USB_ID(0x10f5, 0x0200): |
530 | if (id == USB_ID(0x10f5, 0x0200)) | 531 | /* C-Media CM106 / Turtle Beach Audio Advantage Roadie */ |
531 | return snd_usb_cm106_boot_quirk(dev); | 532 | return snd_usb_cm106_boot_quirk(dev); |
532 | 533 | ||
533 | /* C-Media CM6206 / CM106-Like Sound Device */ | 534 | case USB_ID(0x0d8c, 0x0102): |
534 | if (id == USB_ID(0x0d8c, 0x0102)) | 535 | /* C-Media CM6206 / CM106-Like Sound Device */ |
535 | return snd_usb_cm6206_boot_quirk(dev); | 536 | return snd_usb_cm6206_boot_quirk(dev); |
536 | 537 | ||
537 | /* Access Music VirusTI Desktop */ | 538 | case USB_ID(0x133e, 0x0815): |
538 | if (id == USB_ID(0x133e, 0x0815)) | 539 | /* Access Music VirusTI Desktop */ |
539 | return snd_usb_accessmusic_boot_quirk(dev); | 540 | return snd_usb_accessmusic_boot_quirk(dev); |
540 | 541 | ||
541 | /* Native Instruments Devices */ | 542 | case USB_ID(0x17cc, 0x1010): /* Traktor Audio 6 */ |
542 | if (id == USB_ID(0x17cc, 0x1010) || /* Traktor Audio 6 */ | 543 | case USB_ID(0x17cc, 0x1020): /* Traktor Audio 10 */ |
543 | id == USB_ID(0x17cc, 0x1020)) /* Traktor Audio 10 */ | ||
544 | return snd_usb_nativeinstruments_boot_quirk(dev); | 544 | return snd_usb_nativeinstruments_boot_quirk(dev); |
545 | } | ||
545 | 546 | ||
546 | return 0; | 547 | return 0; |
547 | } | 548 | } |