Re: [PATCH v5 3/4] ALSA: usb-audio: make param quirk_flags change-able in runtime
From: Takashi Iwai
Date: Sat Sep 27 2025 - 05:32:33 EST
On Thu, 25 Sep 2025 11:25:18 +0200,
Cryolitia PukNgae via B4 Relay wrote:
>
> +/* protects quirk_flags */
> +DEFINE_MUTEX(quirk_flags_mutex);
This can be static?
> +static int param_set_quirkp(const char *val,
> + const struct kernel_param *kp)
> +{
> + guard(mutex)(&quirk_flags_mutex);
> + return param_set_charp(val, kp);
> +}
> +
> +static const struct kernel_param_ops param_ops_quirkp = {
> + .set = param_set_quirkp,
> + .get = param_get_charp,
> + .free = param_free_charp,
> +};
> +
> +#define param_check_quirkp param_check_charp
> +
> +module_param_array(quirk_flags, quirkp, NULL, 0644);
> +MODULE_PARM_DESC(quirk_flags, "Add/modify USB audio quirks");
> +
> /*
> * we keep the snd_usb_audio_t instances by ourselves for merging
> * the all interfaces on the same card as one sound device.
> @@ -697,15 +716,13 @@ static void snd_usb_init_quirk_flags(int idx, struct snd_usb_audio *chip)
> char *val;
> size_t i;
>
> + mutex_lock(&quirk_flags_mutexn);
Use guard(). Then you can avoid ugly goto.
thanks,
Takashi