summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2011-02-11 14:34:12 +0300
committerTakashi Iwai <tiwai@suse.de>2011-02-14 19:11:12 +0300
commit3347b26cab60e20534b9a46ceea70b9fb74297fb (patch)
tree6a7552d7a492ea9c9ce34ca6e20f82b6696b6aa8
parent54a8c500d5b80c83e0f14cbcfcfd4a84abff8a80 (diff)
downloadlinux-3347b26cab60e20534b9a46ceea70b9fb74297fb.tar.xz
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>
-rw-r--r--sound/usb/mixer_quirks.c41
-rw-r--r--sound/usb/quirks.c29
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,
int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
{
- int err;
+ int err = 0;
struct snd_info_entry *entry;
if ((err = snd_usb_soundblaster_remote_init(mixer)) < 0)
return err;
- if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) ||
- mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
- mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
- mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) {
- if ((err = snd_audigy2nx_controls_create(mixer)) < 0)
- return err;
+ switch (mixer->chip->usb_id) {
+ case USB_ID(0x041e, 0x3020):
+ case USB_ID(0x041e, 0x3040):
+ case USB_ID(0x041e, 0x3042):
+ case USB_ID(0x041e, 0x3048):
+ err = snd_audigy2nx_controls_create(mixer);
+ if (err < 0)
+ break;
if (!snd_card_proc_new(mixer->chip->card, "audigy2nx", &entry))
snd_info_set_text_ops(entry, mixer,
snd_audigy2nx_proc_read);
- }
+ break;
- if (mixer->chip->usb_id == USB_ID(0x0b05, 0x1739) ||
- mixer->chip->usb_id == USB_ID(0x0b05, 0x1743)) {
+ case USB_ID(0x0b05, 0x1739):
+ case USB_ID(0x0b05, 0x1743):
err = snd_xonar_u1_controls_create(mixer);
- if (err < 0)
- return err;
- }
+ break;
- /* Traktor Audio 6 */
- if (mixer->chip->usb_id == USB_ID(0x17cc, 0x1011)) {
+ case USB_ID(0x17cc, 0x1011): /* Traktor Audio 6 */
err = snd_nativeinstruments_create_mixer(mixer,
snd_nativeinstruments_ta6_mixers,
ARRAY_SIZE(snd_nativeinstruments_ta6_mixers));
- if (err < 0)
- return err;
- }
+ break;
- /* Traktor Audio 10 */
- if (mixer->chip->usb_id == USB_ID(0x17cc, 0x1021)) {
+ case USB_ID(0x17cc, 0x1021): /* Traktor Audio 10 */
err = snd_nativeinstruments_create_mixer(mixer,
snd_nativeinstruments_ta10_mixers,
ARRAY_SIZE(snd_nativeinstruments_ta10_mixers));
- if (err < 0)
- return err;
+ break;
}
- return 0;
+ return err;
}
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,
u32 id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
le16_to_cpu(dev->descriptor.idProduct));
- /* SB Extigy needs special boot-up sequence */
- /* if more models come, this will go to the quirk list. */
- if (id == USB_ID(0x041e, 0x3000))
+ switch (id) {
+ case USB_ID(0x041e, 0x3000):
+ /* SB Extigy needs special boot-up sequence */
+ /* if more models come, this will go to the quirk list. */
return snd_usb_extigy_boot_quirk(dev, intf);
- /* SB Audigy 2 NX needs its own boot-up magic, too */
- if (id == USB_ID(0x041e, 0x3020))
+ case USB_ID(0x041e, 0x3020):
+ /* SB Audigy 2 NX needs its own boot-up magic, too */
return snd_usb_audigy2nx_boot_quirk(dev);
- /* C-Media CM106 / Turtle Beach Audio Advantage Roadie */
- if (id == USB_ID(0x10f5, 0x0200))
+ case USB_ID(0x10f5, 0x0200):
+ /* C-Media CM106 / Turtle Beach Audio Advantage Roadie */
return snd_usb_cm106_boot_quirk(dev);
- /* C-Media CM6206 / CM106-Like Sound Device */
- if (id == USB_ID(0x0d8c, 0x0102))
+ case USB_ID(0x0d8c, 0x0102):
+ /* C-Media CM6206 / CM106-Like Sound Device */
return snd_usb_cm6206_boot_quirk(dev);
- /* Access Music VirusTI Desktop */
- if (id == USB_ID(0x133e, 0x0815))
+ case USB_ID(0x133e, 0x0815):
+ /* Access Music VirusTI Desktop */
return snd_usb_accessmusic_boot_quirk(dev);
- /* Native Instruments Devices */
- if (id == USB_ID(0x17cc, 0x1010) || /* Traktor Audio 6 */
- id == USB_ID(0x17cc, 0x1020)) /* Traktor Audio 10 */
+ case USB_ID(0x17cc, 0x1010): /* Traktor Audio 6 */
+ case USB_ID(0x17cc, 0x1020): /* Traktor Audio 10 */
return snd_usb_nativeinstruments_boot_quirk(dev);
+ }
return 0;
}