[PATCH 1/2] ALSA: usb-audio: Convert snd_usb_apply_interface_quirk() into a switch statement
From: Rong Zhang
Date: Mon Sep 07 2026 - 15:37:06 EST
A switch statement is more readable than the current if blocks.
Also sort the cases in an ascending order.
As an interesting effect, this shrinks the size of quirks.o by 64 bytes
(GCC 16 -O2 x86_64):
text data bss total filename (before)
15266 12279 0 27545 quirks.o
text data bss total filename (before)
15202 12279 0 27481 quirks.o
Signed-off-by: Rong Zhang <i@xxxxxxxx>
---
sound/usb/quirks.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 91938172912a..6e4808330a80 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1589,18 +1589,20 @@ int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,
int iface,
int altno)
{
- /* audiophile usb: skip altsets incompatible with device_setup */
- if (chip->usb_id == USB_ID(0x0763, 0x2003))
- return audiophile_skip_setting_quirk(chip, iface, altno);
+ switch (chip->usb_id) {
/* quattro usb: skip altsets incompatible with device_setup */
- if (chip->usb_id == USB_ID(0x0763, 0x2001))
+ case USB_ID(0x0763, 0x2001):
return quattro_skip_setting_quirk(chip, iface, altno);
+ /* audiophile usb: skip altsets incompatible with device_setup */
+ case USB_ID(0x0763, 0x2003):
+ return audiophile_skip_setting_quirk(chip, iface, altno);
/* fasttrackpro usb: skip altsets incompatible with device_setup */
- if (chip->usb_id == USB_ID(0x0763, 0x2012))
+ case USB_ID(0x0763, 0x2012):
return fasttrackpro_skip_setting_quirk(chip, iface, altno);
/* presonus studio 1810c: skip altsets incompatible with device_setup */
- if (chip->usb_id == USB_ID(0x194f, 0x010c))
+ case USB_ID(0x194f, 0x010c):
return s1810c_skip_setting_quirk(chip, iface, altno);
+ }
return 0;
}
--
2.55.0