ALSA: usb-audio: make param quirk_flags change-able in runtime
Change its permision from 0644 to 0444, and add runtime processing. Developers now can change it during sysfs, without rebooting, for debugging new buggy devices. Co-developed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
committed by
Takashi Iwai
parent
ffd586126a
commit
98b5427bb6
+23
-2
@@ -103,13 +103,32 @@ module_param_array(delayed_register, charp, NULL, 0444);
|
||||
MODULE_PARM_DESC(delayed_register, "Quirk for delayed registration, given by id:iface, e.g. 0123abcd:4.");
|
||||
module_param_array(implicit_fb, bool, NULL, 0444);
|
||||
MODULE_PARM_DESC(implicit_fb, "Apply generic implicit feedback sync mode.");
|
||||
module_param_array(quirk_flags, charp, NULL, 0444);
|
||||
MODULE_PARM_DESC(quirk_flags, "Driver quirk bit flags.");
|
||||
module_param_named(use_vmalloc, snd_usb_use_vmalloc, bool, 0444);
|
||||
MODULE_PARM_DESC(use_vmalloc, "Use vmalloc for PCM intermediate buffers (default: yes).");
|
||||
module_param_named(skip_validation, snd_usb_skip_validation, bool, 0444);
|
||||
MODULE_PARM_DESC(skip_validation, "Skip unit descriptor validation (default: no).");
|
||||
|
||||
/* protects quirk_flags */
|
||||
static DEFINE_MUTEX(quirk_flags_mutex);
|
||||
|
||||
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.
|
||||
@@ -696,6 +715,8 @@ static void snd_usb_init_quirk_flags(int idx, struct snd_usb_audio *chip)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
guard(mutex)(&quirk_flags_mutex);
|
||||
|
||||
/* old style option found: the position-based integer value */
|
||||
if (quirk_flags[idx] &&
|
||||
!kstrtou32(quirk_flags[idx], 0, &chip->quirk_flags)) {
|
||||
|
||||
Reference in New Issue
Block a user