[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87sev8l97e.wl-tiwai@suse.de>
Date: Tue, 13 Aug 2024 17:43:33 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Juan José Arboleda <soyjuanarbol@...il.com>
Cc: linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org,
perex@...ex.cz,
tiwai@...e.com
Subject: Re: [PATCH 2/2] ALSA: usb-audio: reduce checkpatch issues in quirks-table.h
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@...il.com>
>
> 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
Download attachment "0001-ALSA-usb-audio-Define-macros-for-quirk-table-entries.patch" of type "application/octet-stream" (2424 bytes)
Download attachment "0002-ALSA-usb-audio-Replace-complex-quirk-lines-with-macr.patch" of type "application/octet-stream" (94794 bytes)
Powered by blists - more mailing lists