Re: [PATCH v3 2/2] ALSA: usb-audio: Add quirk for Plantronics headsets to fix control names

Takashi Iwai
2025-01-14T12:38:50Z

On Tue, 14 Jan 2025 00:51:59 +0100,
Terry Junge wrote:
>
> +/*
> + * Some Plantronics headsets have control names that don't meet ALSA naming
> + * standards. This function fixes nonstandard source names. By the time
> + * this function is called the control name should look like one of these:
> + * "source names Playback Volume"
> + * "source names Playback Switch"
> + * "source names Capture Volume"
> + * "source names Capture Switch"
> + * If any of the trigger words are found in the name then the name will
> + * be changed to:
> + * "Headset Playback Volume"
> + * "Headset Playback Switch"
> + * "Headset Capture Volume"
> + * "Headset Capture Switch"
> + * depending on the current suffix.
> + */
> +static void snd_fix_plt_name(struct snd_usb_audio *chip,
> + typeof_member(struct snd_ctl_elem_id, name) * name)

I personally find this style of argument is difficult to use.
That said, IMO, it's better to stick with the argument
struct snd_ctl_elem_id *id
and access via id->name as in your earlier patch; it's more idiomatic,
and easier to read.

thanks,

Takashi