Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: usb-audio: Define macros for quirk table entries

Many entries in the USB-audio quirk tables have relatively complex
expressions. For improving the readability, introduce a few macros.
Those are applied in the following patch.

Link: https://patch.msgid.link/20240814134844.2726-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+77
+77
sound/usb/quirks-table.h
··· 35 35 .bInterfaceClass = USB_CLASS_AUDIO, \ 36 36 .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL 37 37 38 + /* Quirk .driver_info, followed by the definition of the quirk entry; 39 + * put like QUIRK_DRIVER_INFO { ... } in each entry of the quirk table 40 + */ 41 + #define QUIRK_DRIVER_INFO \ 42 + .driver_info = (unsigned long)&(const struct snd_usb_audio_quirk) 43 + 44 + /* 45 + * Macros for quirk data entries 46 + */ 47 + 48 + /* Quirk data entry for ignoring the interface */ 49 + #define QUIRK_DATA_IGNORE(_ifno) \ 50 + .ifnum = (_ifno), .type = QUIRK_IGNORE_INTERFACE 51 + /* Quirk data entry for a standard audio interface */ 52 + #define QUIRK_DATA_STANDARD_AUDIO(_ifno) \ 53 + .ifnum = (_ifno), .type = QUIRK_AUDIO_STANDARD_INTERFACE 54 + /* Quirk data entry for a standard MIDI interface */ 55 + #define QUIRK_DATA_STANDARD_MIDI(_ifno) \ 56 + .ifnum = (_ifno), .type = QUIRK_MIDI_STANDARD_INTERFACE 57 + /* Quirk data entry for a standard mixer interface */ 58 + #define QUIRK_DATA_STANDARD_MIXER(_ifno) \ 59 + .ifnum = (_ifno), .type = QUIRK_AUDIO_STANDARD_MIXER 60 + 61 + /* Quirk data entry for Yamaha MIDI */ 62 + #define QUIRK_DATA_MIDI_YAMAHA(_ifno) \ 63 + .ifnum = (_ifno), .type = QUIRK_MIDI_YAMAHA 64 + /* Quirk data entry for Edirol UAxx */ 65 + #define QUIRK_DATA_EDIROL_UAXX(_ifno) \ 66 + .ifnum = (_ifno), .type = QUIRK_AUDIO_EDIROL_UAXX 67 + /* Quirk data entry for raw bytes interface */ 68 + #define QUIRK_DATA_RAW_BYTES(_ifno) \ 69 + .ifnum = (_ifno), .type = QUIRK_MIDI_RAW_BYTES 70 + 71 + /* Quirk composite array terminator */ 72 + #define QUIRK_COMPOSITE_END { .ifnum = -1 } 73 + 74 + /* Quirk data entry for composite quirks; 75 + * followed by the quirk array that is terminated with QUIRK_COMPOSITE_END 76 + * e.g. QUIRK_DATA_COMPOSITE { { quirk1 }, { quirk2 },..., QUIRK_COMPOSITE_END } 77 + */ 78 + #define QUIRK_DATA_COMPOSITE \ 79 + .ifnum = QUIRK_ANY_INTERFACE, \ 80 + .type = QUIRK_COMPOSITE, \ 81 + .data = &(const struct snd_usb_audio_quirk[]) 82 + 83 + /* Quirk data entry for a fixed audio endpoint; 84 + * followed by audioformat definition 85 + * e.g. QUIRK_DATA_AUDIOFORMAT(n) { .formats = xxx, ... } 86 + */ 87 + #define QUIRK_DATA_AUDIOFORMAT(_ifno) \ 88 + .ifnum = (_ifno), \ 89 + .type = QUIRK_AUDIO_FIXED_ENDPOINT, \ 90 + .data = &(const struct audioformat) 91 + 92 + /* Quirk data entry for a fixed MIDI endpoint; 93 + * followed by snd_usb_midi_endpoint_info definition 94 + * e.g. QUIRK_DATA_MIDI_FIXED_ENDPOINT(n) { .out_cables = x, .in_cables = y } 95 + */ 96 + #define QUIRK_DATA_MIDI_FIXED_ENDPOINT(_ifno) \ 97 + .ifnum = (_ifno), \ 98 + .type = QUIRK_MIDI_FIXED_ENDPOINT, \ 99 + .data = &(const struct snd_usb_midi_endpoint_info) 100 + /* Quirk data entry for a MIDIMAN MIDI endpoint */ 101 + #define QUIRK_DATA_MIDI_MIDIMAN(_ifno) \ 102 + .ifnum = (_ifno), \ 103 + .type = QUIRK_MIDI_MIDIMAN, \ 104 + .data = &(const struct snd_usb_midi_endpoint_info) 105 + /* Quirk data entry for a EMAGIC MIDI endpoint */ 106 + #define QUIRK_DATA_MIDI_EMAGIC(_ifno) \ 107 + .ifnum = (_ifno), \ 108 + .type = QUIRK_MIDI_EMAGIC, \ 109 + .data = &(const struct snd_usb_midi_endpoint_info) 110 + 111 + /* 112 + * Here we go... the quirk table definition begins: 113 + */ 114 + 38 115 /* FTDI devices */ 39 116 { 40 117 USB_DEVICE(0x0403, 0xb8d8),