Re: [PATCH 2/2] ALSA: usb-audio: reduce checkpatch issues in quirks-table.h

From: Takashi Iwai
Date: Tue Aug 13 2024 - 11:43:11 EST


On Tue, 13 Aug 2024 08:57:09 +0200,
Takashi Iwai wrote:
>
> On Tue, 13 Aug 2024 05:31:28 +0200,
> Juan José Arboleda wrote:
> >
> > Reduced checkpatch errors from 185 to 2, and warnings from 4 to 1 in
> > sound/usb/quirks-table.h.
> >
> > Remaining issues were reviewed and considered non-blocking.
> >
> > Signed-off-by: Juan José Arboleda <soyjuanarbol@xxxxxxxxx>
>
> Honestly speaking, I don't find it's much improvement from the code
> readability POV. (And you don't have to "correct" the spaces in
> comment lines :)
>
> That is, if the reason of the changes is only about the complaint from
> checkpatch, we can simply ignore it. Above all, applying space-only
> fixes would make the stable backports more difficult.
>
> OTOH, if we really want to improve the code readability, maybe it'd be
> better to introduce some macros to simplify the definitions. e.g.
>
> /* Quirk driver_info, use like QUIRK_DRIVER_INFO { ... } */
> #define QUIRK_DRIVER_INFO \
> .driver_info = (unsigned long)&(const struct snd_usb_audio_quirk)
>
> /* Quirk data entry for struct audioformat */
> #define QUIRK_DATA_AUDIOFORMAT \
> .data = &(const struct audioformat)
> /* Quirk data entry for struct snd_usb_midiendpoint_info */
> #define QUIRK_DATA_MIDI_EP_INFO \
> .data = &(const struct snd_usb_midi_endpoint_info)
>
> and replace accordingly.
>
> But again, I'm not sure whether it's worth. Macros might be good from
> the code safety as the open code is error prone, though.

FWIW, the patches below are what I had in my mind.


Takashi

Attachment: 0001-ALSA-usb-audio-Define-macros-for-quirk-table-entries.patch
Description: Binary data