On Thu, 18 Sep 2025 11:24:31 +0200,
Cryolitia PukNgae via B4 Relay wrote:
>
> From: Cryolitia PukNgae <[email protected]>
>
> - int param_array_set(const char *val, const struct kernel_param *kp);
> - int param_array_get(char *buffer, const struct kernel_param *kp);
> - void param_array_free(void *arg);
>
> It would be helpful for the new module param we designed in
> snd_usb_audio, in order to run additional custom codes when params
> are set in runtime, and re-use the extisted codes in param.c
>
> Signed-off-by: Cryolitia PukNgae <[email protected]>
Can we do just like below?
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
modules_param_parray(quirk_flags, quirkp, NULL, 0644);
Then mutex is locked at each time a parameter is set.
Optionally, the string value can be verified in param_set_quirkp()
before passing to param_set_charp(), too.
thanks,
Takashi