Commit 3347b26c authored by Daniel Mack's avatar Daniel Mack Committed by Takashi Iwai

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: default avatarDaniel Mack <daniel@caiaq.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 54a8c500
...@@ -502,49 +502,44 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, ...@@ -502,49 +502,44 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
{ {
int err; int err = 0;
struct snd_info_entry *entry; struct snd_info_entry *entry;
if ((err = snd_usb_soundblaster_remote_init(mixer)) < 0) if ((err = snd_usb_soundblaster_remote_init(mixer)) < 0)
return err; return err;
if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) || switch (mixer->chip->usb_id) {
mixer->chip->usb_id == USB_ID(0x041e, 0x3040) || case USB_ID(0x041e, 0x3020):
mixer->chip->usb_id == USB_ID(0x041e, 0x3042) || case USB_ID(0x041e, 0x3040):
mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) { case USB_ID(0x041e, 0x3042):
if ((err = snd_audigy2nx_controls_create(mixer)) < 0) case USB_ID(0x041e, 0x3048):
return err; err = snd_audigy2nx_controls_create(mixer);
if (err < 0)
break;
if (!snd_card_proc_new(mixer->chip->card, "audigy2nx", &entry)) if (!snd_card_proc_new(mixer->chip->card, "audigy2nx", &entry))
snd_info_set_text_ops(entry, mixer, snd_info_set_text_ops(entry, mixer,
snd_audigy2nx_proc_read); snd_audigy2nx_proc_read);
} break;
if (mixer->chip->usb_id == USB_ID(0x0b05, 0x1739) || case USB_ID(0x0b05, 0x1739):
mixer->chip->usb_id == USB_ID(0x0b05, 0x1743)) { case USB_ID(0x0b05, 0x1743):
err = snd_xonar_u1_controls_create(mixer); err = snd_xonar_u1_controls_create(mixer);
if (err < 0) break;
return err;
}
/* Traktor Audio 6 */ case USB_ID(0x17cc, 0x1011): /* Traktor Audio 6 */
if (mixer->chip->usb_id == USB_ID(0x17cc, 0x1011)) {
err = snd_nativeinstruments_create_mixer(mixer, err = snd_nativeinstruments_create_mixer(mixer,
snd_nativeinstruments_ta6_mixers, snd_nativeinstruments_ta6_mixers,
ARRAY_SIZE(snd_nativeinstruments_ta6_mixers)); ARRAY_SIZE(snd_nativeinstruments_ta6_mixers));
if (err < 0) break;
return err;
}
/* Traktor Audio 10 */ case USB_ID(0x17cc, 0x1021): /* Traktor Audio 10 */
if (mixer->chip->usb_id == USB_ID(0x17cc, 0x1021)) {
err = snd_nativeinstruments_create_mixer(mixer, err = snd_nativeinstruments_create_mixer(mixer,
snd_nativeinstruments_ta10_mixers, snd_nativeinstruments_ta10_mixers,
ARRAY_SIZE(snd_nativeinstruments_ta10_mixers)); ARRAY_SIZE(snd_nativeinstruments_ta10_mixers));
if (err < 0) break;
return err;
} }
return 0; return err;
} }
void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer, void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer,
......
...@@ -517,31 +517,32 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev, ...@@ -517,31 +517,32 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev,
u32 id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), u32 id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
le16_to_cpu(dev->descriptor.idProduct)); le16_to_cpu(dev->descriptor.idProduct));
switch (id) {
case USB_ID(0x041e, 0x3000):
/* SB Extigy needs special boot-up sequence */ /* SB Extigy needs special boot-up sequence */
/* if more models come, this will go to the quirk list. */ /* if more models come, this will go to the quirk list. */
if (id == USB_ID(0x041e, 0x3000))
return snd_usb_extigy_boot_quirk(dev, intf); return snd_usb_extigy_boot_quirk(dev, intf);
case USB_ID(0x041e, 0x3020):
/* SB Audigy 2 NX needs its own boot-up magic, too */ /* SB Audigy 2 NX needs its own boot-up magic, too */
if (id == USB_ID(0x041e, 0x3020))
return snd_usb_audigy2nx_boot_quirk(dev); return snd_usb_audigy2nx_boot_quirk(dev);
case USB_ID(0x10f5, 0x0200):
/* C-Media CM106 / Turtle Beach Audio Advantage Roadie */ /* C-Media CM106 / Turtle Beach Audio Advantage Roadie */
if (id == USB_ID(0x10f5, 0x0200))
return snd_usb_cm106_boot_quirk(dev); return snd_usb_cm106_boot_quirk(dev);
case USB_ID(0x0d8c, 0x0102):
/* C-Media CM6206 / CM106-Like Sound Device */ /* C-Media CM6206 / CM106-Like Sound Device */
if (id == USB_ID(0x0d8c, 0x0102))
return snd_usb_cm6206_boot_quirk(dev); return snd_usb_cm6206_boot_quirk(dev);
case USB_ID(0x133e, 0x0815):
/* Access Music VirusTI Desktop */ /* Access Music VirusTI Desktop */
if (id == USB_ID(0x133e, 0x0815))
return snd_usb_accessmusic_boot_quirk(dev); return snd_usb_accessmusic_boot_quirk(dev);
/* Native Instruments Devices */ case USB_ID(0x17cc, 0x1010): /* Traktor Audio 6 */
if (id == USB_ID(0x17cc, 0x1010) || /* Traktor Audio 6 */ case USB_ID(0x17cc, 0x1020): /* Traktor Audio 10 */
id == USB_ID(0x17cc, 0x1020)) /* Traktor Audio 10 */
return snd_usb_nativeinstruments_boot_quirk(dev); return snd_usb_nativeinstruments_boot_quirk(dev);
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment