* [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags
@ 2025-09-25 9:25 Cryolitia PukNgae via B4 Relay
2025-09-25 9:25 ` [PATCH v5 1/4] ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_* Cryolitia PukNgae via B4 Relay
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Cryolitia PukNgae via B4 Relay @ 2025-09-25 9:25 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, Jonathan Corbet
Cc: Mingcong Bai, Kexy Biscuit, Nie Cheng, Zhan Jun, Feng Yuan,
qaqland, kernel, linux-sound, linux-kernel, linux-doc,
Cryolitia PukNgae, Takashi Iwai
As an implementation of what has been discussed previously[1].
1. https://lore.kernel.org/all/87h5xm5g7f.wl-tiwai@suse.de/
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
---
Changes in v5:
- Apply review comments. Thanks a lot, Takashi Iwai!
- Link to v4: https://lore.kernel.org/r/20250918-sound-v4-0-82cf8123d61c@uniontech.com
Changes in v4:
- Split basic parse and dynamic change
- Drop usage of linked list
- Link to v3: https://lore.kernel.org/r/20250917-sound-v3-0-92ebe9472a0a@uniontech.com
Changes in v3:
- Instead of a new param, improve the existed one.
- Link to v2: https://lore.kernel.org/r/20250912-sound-v2-0-01ea3d279f4b@uniontech.com
Changes in v2:
- Cleaned up some internal rebase confusion, sorry for that
- Link to v1: https://lore.kernel.org/r/20250912-sound-v1-0-cc9cfd9f2d01@uniontech.com
---
Cryolitia PukNgae (4):
ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_*
ALSA: usb-audio: improve module param quirk_flags
ALSA: usb-audio: make param quirk_flags change-able in runtime
ALSA: doc: add docs about improved quirk_flags in snd-usb-audio
Documentation/sound/alsa-configuration.rst | 108 +++++++++++------
sound/usb/card.c | 66 +++++++++--
sound/usb/quirks.c | 179 ++++++++++++++++++++++++++++-
sound/usb/quirks.h | 11 +-
sound/usb/usbaudio.h | 84 +++++++++-----
5 files changed, 376 insertions(+), 72 deletions(-)
---
base-commit: 4c421c40c8b30ab7aae1edc7f7e294fcd33fc186
change-id: 20250910-sound-a91c86c92dba
Best regards,
--
Cryolitia PukNgae <cryolitia@uniontech.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v5 1/4] ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_*
2025-09-25 9:25 [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae via B4 Relay
@ 2025-09-25 9:25 ` Cryolitia PukNgae via B4 Relay
2025-09-27 9:24 ` Takashi Iwai
2025-09-25 9:25 ` [PATCH v5 2/4] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae via B4 Relay
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Cryolitia PukNgae via B4 Relay @ 2025-09-25 9:25 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, Jonathan Corbet
Cc: Mingcong Bai, Kexy Biscuit, Nie Cheng, Zhan Jun, Feng Yuan,
qaqland, kernel, linux-sound, linux-kernel, linux-doc,
Cryolitia PukNgae, Takashi Iwai
From: Cryolitia PukNgae <cryolitia@uniontech.com>
Also improve debug logs for applied quirks
Co-developed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
---
sound/usb/quirks.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++---
sound/usb/quirks.h | 7 ++++
sound/usb/usbaudio.h | 84 ++++++++++++++++++++++++++++++++--------------
3 files changed, 156 insertions(+), 30 deletions(-)
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index d736a4750356597bfb0f9d5ab01cdaeaac0f907c..db6d6e324d78c4da3fc3c676f6f076f01841204e 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -2446,6 +2446,96 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
{} /* terminator */
};
+#define QUIRK_STRING_ENTRY(x) \
+ [QUIRK_TYPE_ ## x] = __stringify(x)
+
+static const char *const snd_usb_audio_quirk_flag_names[] = {
+ QUIRK_STRING_ENTRY(GET_SAMPLE_RATE),
+ QUIRK_STRING_ENTRY(SHARE_MEDIA_DEVICE),
+ QUIRK_STRING_ENTRY(ALIGN_TRANSFER),
+ QUIRK_STRING_ENTRY(TX_LENGTH),
+ QUIRK_STRING_ENTRY(PLAYBACK_FIRST),
+ QUIRK_STRING_ENTRY(SKIP_CLOCK_SELECTOR),
+ QUIRK_STRING_ENTRY(IGNORE_CLOCK_SOURCE),
+ QUIRK_STRING_ENTRY(ITF_USB_DSD_DAC),
+ QUIRK_STRING_ENTRY(CTL_MSG_DELAY),
+ QUIRK_STRING_ENTRY(CTL_MSG_DELAY_1M),
+ QUIRK_STRING_ENTRY(CTL_MSG_DELAY_5M),
+ QUIRK_STRING_ENTRY(IFACE_DELAY),
+ QUIRK_STRING_ENTRY(VALIDATE_RATES),
+ QUIRK_STRING_ENTRY(DISABLE_AUTOSUSPEND),
+ QUIRK_STRING_ENTRY(IGNORE_CTL_ERROR),
+ QUIRK_STRING_ENTRY(DSD_RAW),
+ QUIRK_STRING_ENTRY(SET_IFACE_FIRST),
+ QUIRK_STRING_ENTRY(GENERIC_IMPLICIT_FB),
+ QUIRK_STRING_ENTRY(SKIP_IMPLICIT_FB),
+ QUIRK_STRING_ENTRY(IFACE_SKIP_CLOSE),
+ QUIRK_STRING_ENTRY(FORCE_IFACE_RESET),
+ QUIRK_STRING_ENTRY(FIXED_RATE),
+ QUIRK_STRING_ENTRY(MIC_RES_16),
+ QUIRK_STRING_ENTRY(MIC_RES_384),
+ QUIRK_STRING_ENTRY(MIXER_PLAYBACK_MIN_MUTE),
+ QUIRK_STRING_ENTRY(MIXER_CAPTURE_MIN_MUTE),
+ NULL
+};
+
+const char *snd_usb_quirk_flag_find_name(unsigned long index)
+{
+ if (index >= ARRAY_SIZE(snd_usb_audio_quirk_flag_names))
+ return NULL;
+
+ return snd_usb_audio_quirk_flag_names[index];
+}
+
+u32 snd_usb_quirk_flags_from_name(const char *name)
+{
+ char *upper;
+ int i;
+
+ upper = kstrdup(name, GFP_KERNEL);
+
+ if (!upper)
+ return 0;
+
+ string_upper(upper, upper);
+
+ if (!name || !*name)
+ return 0;
+
+ for (i = 0; snd_usb_audio_quirk_flag_names[i]; i++) {
+ if (strcmp(name, snd_usb_audio_quirk_flag_names[i]) == 0 ||
+ strcmp(upper, snd_usb_audio_quirk_flag_names[i]) == 0) {
+ kfree(upper);
+ return BIT_U32(i);
+ }
+ }
+
+ kfree(upper);
+ return 0;
+}
+
+void snd_usb_apply_flag_dbg(const char *reason,
+ struct snd_usb_audio *chip,
+ unsigned long flag)
+{
+ unsigned long bit;
+
+ for_each_set_bit(bit, &flag, BYTES_TO_BITS(sizeof(flag))) {
+ const char *name = snd_usb_audio_quirk_flag_names[bit];
+
+ if (name)
+ usb_audio_dbg(chip,
+ "From %s apply quirk flag %s for device %04x:%04x\n",
+ reason, name, USB_ID_VENDOR(chip->usb_id),
+ USB_ID_PRODUCT(chip->usb_id));
+ else
+ usb_audio_warn(chip,
+ "From %s apply unknown quirk flag 0x%lx for device %04x:%04x\n",
+ reason, bit, USB_ID_VENDOR(chip->usb_id),
+ USB_ID_PRODUCT(chip->usb_id));
+ }
+}
+
void snd_usb_init_quirk_flags(struct snd_usb_audio *chip)
{
const struct usb_audio_quirk_flags_table *p;
@@ -2454,10 +2544,7 @@ void snd_usb_init_quirk_flags(struct snd_usb_audio *chip)
if (chip->usb_id == p->id ||
(!USB_ID_PRODUCT(p->id) &&
USB_ID_VENDOR(chip->usb_id) == USB_ID_VENDOR(p->id))) {
- usb_audio_dbg(chip,
- "Set quirk_flags 0x%x for device %04x:%04x\n",
- p->flags, USB_ID_VENDOR(chip->usb_id),
- USB_ID_PRODUCT(chip->usb_id));
+ snd_usb_apply_flag_dbg("builtin table", chip, p->flags);
chip->quirk_flags |= p->flags;
return;
}
diff --git a/sound/usb/quirks.h b/sound/usb/quirks.h
index f9bfd5ac7bab01717de3a76227482a128bf73165..1b727d3c35c7033b85b56ce43d66fd76c8f2d4ef 100644
--- a/sound/usb/quirks.h
+++ b/sound/usb/quirks.h
@@ -48,6 +48,13 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip,
struct audioformat *fp,
int stream);
+void snd_usb_apply_flag_dbg(const char *reason,
+ struct snd_usb_audio *chip,
+ unsigned long flag);
+
void snd_usb_init_quirk_flags(struct snd_usb_audio *chip);
+const char *snd_usb_quirk_flag_find_name(unsigned long flag);
+u32 snd_usb_quirk_flags_from_name(const char *name);
+
#endif /* __USBAUDIO_QUIRKS_H */
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 30b5102e3caed01eeb86d0075c41338104c58950..79978cae9799cd14da2c7d2391df104df40fa672 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -226,31 +226,63 @@ extern bool snd_usb_skip_validation;
* Similar to QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE, but for capture streams
*/
-#define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
-#define QUIRK_FLAG_SHARE_MEDIA_DEVICE (1U << 1)
-#define QUIRK_FLAG_ALIGN_TRANSFER (1U << 2)
-#define QUIRK_FLAG_TX_LENGTH (1U << 3)
-#define QUIRK_FLAG_PLAYBACK_FIRST (1U << 4)
-#define QUIRK_FLAG_SKIP_CLOCK_SELECTOR (1U << 5)
-#define QUIRK_FLAG_IGNORE_CLOCK_SOURCE (1U << 6)
-#define QUIRK_FLAG_ITF_USB_DSD_DAC (1U << 7)
-#define QUIRK_FLAG_CTL_MSG_DELAY (1U << 8)
-#define QUIRK_FLAG_CTL_MSG_DELAY_1M (1U << 9)
-#define QUIRK_FLAG_CTL_MSG_DELAY_5M (1U << 10)
-#define QUIRK_FLAG_IFACE_DELAY (1U << 11)
-#define QUIRK_FLAG_VALIDATE_RATES (1U << 12)
-#define QUIRK_FLAG_DISABLE_AUTOSUSPEND (1U << 13)
-#define QUIRK_FLAG_IGNORE_CTL_ERROR (1U << 14)
-#define QUIRK_FLAG_DSD_RAW (1U << 15)
-#define QUIRK_FLAG_SET_IFACE_FIRST (1U << 16)
-#define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17)
-#define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18)
-#define QUIRK_FLAG_IFACE_SKIP_CLOSE (1U << 19)
-#define QUIRK_FLAG_FORCE_IFACE_RESET (1U << 20)
-#define QUIRK_FLAG_FIXED_RATE (1U << 21)
-#define QUIRK_FLAG_MIC_RES_16 (1U << 22)
-#define QUIRK_FLAG_MIC_RES_384 (1U << 23)
-#define QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE (1U << 24)
-#define QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE (1U << 25)
+enum {
+ QUIRK_TYPE_GET_SAMPLE_RATE = 0,
+ QUIRK_TYPE_SHARE_MEDIA_DEVICE = 1,
+ QUIRK_TYPE_ALIGN_TRANSFER = 2,
+ QUIRK_TYPE_TX_LENGTH = 3,
+ QUIRK_TYPE_PLAYBACK_FIRST = 4,
+ QUIRK_TYPE_SKIP_CLOCK_SELECTOR = 5,
+ QUIRK_TYPE_IGNORE_CLOCK_SOURCE = 6,
+ QUIRK_TYPE_ITF_USB_DSD_DAC = 7,
+ QUIRK_TYPE_CTL_MSG_DELAY = 8,
+ QUIRK_TYPE_CTL_MSG_DELAY_1M = 9,
+ QUIRK_TYPE_CTL_MSG_DELAY_5M = 10,
+ QUIRK_TYPE_IFACE_DELAY = 11,
+ QUIRK_TYPE_VALIDATE_RATES = 12,
+ QUIRK_TYPE_DISABLE_AUTOSUSPEND = 13,
+ QUIRK_TYPE_IGNORE_CTL_ERROR = 14,
+ QUIRK_TYPE_DSD_RAW = 15,
+ QUIRK_TYPE_SET_IFACE_FIRST = 16,
+ QUIRK_TYPE_GENERIC_IMPLICIT_FB = 17,
+ QUIRK_TYPE_SKIP_IMPLICIT_FB = 18,
+ QUIRK_TYPE_IFACE_SKIP_CLOSE = 19,
+ QUIRK_TYPE_FORCE_IFACE_RESET = 20,
+ QUIRK_TYPE_FIXED_RATE = 21,
+ QUIRK_TYPE_MIC_RES_16 = 22,
+ QUIRK_TYPE_MIC_RES_384 = 23,
+ QUIRK_TYPE_MIXER_PLAYBACK_MIN_MUTE = 24,
+ QUIRK_TYPE_MIXER_CAPTURE_MIN_MUTE = 25,
+/* Please also edit snd_usb_audio_quirk_flag_names */
+};
+
+#define QUIRK_FLAG(x) BIT_U32(QUIRK_TYPE_ ## x)
+
+#define QUIRK_FLAG_GET_SAMPLE_RATE QUIRK_FLAG(GET_SAMPLE_RATE)
+#define QUIRK_FLAG_SHARE_MEDIA_DEVICE QUIRK_FLAG(SHARE_MEDIA_DEVICE)
+#define QUIRK_FLAG_ALIGN_TRANSFER QUIRK_FLAG(ALIGN_TRANSFER)
+#define QUIRK_FLAG_TX_LENGTH QUIRK_FLAG(TX_LENGTH)
+#define QUIRK_FLAG_PLAYBACK_FIRST QUIRK_FLAG(PLAYBACK_FIRST)
+#define QUIRK_FLAG_SKIP_CLOCK_SELECTOR QUIRK_FLAG(SKIP_CLOCK_SELECTOR)
+#define QUIRK_FLAG_IGNORE_CLOCK_SOURCE QUIRK_FLAG(IGNORE_CLOCK_SOURCE)
+#define QUIRK_FLAG_ITF_USB_DSD_DAC QUIRK_FLAG(ITF_USB_DSD_DAC)
+#define QUIRK_FLAG_CTL_MSG_DELAY QUIRK_FLAG(CTL_MSG_DELAY)
+#define QUIRK_FLAG_CTL_MSG_DELAY_1M QUIRK_FLAG(CTL_MSG_DELAY_1M)
+#define QUIRK_FLAG_CTL_MSG_DELAY_5M QUIRK_FLAG(CTL_MSG_DELAY_5M)
+#define QUIRK_FLAG_IFACE_DELAY QUIRK_FLAG(IFACE_DELAY)
+#define QUIRK_FLAG_VALIDATE_RATES QUIRK_FLAG(VALIDATE_RATES)
+#define QUIRK_FLAG_DISABLE_AUTOSUSPEND QUIRK_FLAG(DISABLE_AUTOSUSPEND)
+#define QUIRK_FLAG_IGNORE_CTL_ERROR QUIRK_FLAG(IGNORE_CTL_ERROR)
+#define QUIRK_FLAG_DSD_RAW QUIRK_FLAG(DSD_RAW)
+#define QUIRK_FLAG_SET_IFACE_FIRST QUIRK_FLAG(SET_IFACE_FIRST)
+#define QUIRK_FLAG_GENERIC_IMPLICIT_FB QUIRK_FLAG(GENERIC_IMPLICIT_FB)
+#define QUIRK_FLAG_SKIP_IMPLICIT_FB QUIRK_FLAG(SKIP_IMPLICIT_FB)
+#define QUIRK_FLAG_IFACE_SKIP_CLOSE QUIRK_FLAG(IFACE_SKIP_CLOSE)
+#define QUIRK_FLAG_FORCE_IFACE_RESET QUIRK_FLAG(FORCE_IFACE_RESET)
+#define QUIRK_FLAG_FIXED_RATE QUIRK_FLAG(FIXED_RATE)
+#define QUIRK_FLAG_MIC_RES_16 QUIRK_FLAG(MIC_RES_16)
+#define QUIRK_FLAG_MIC_RES_384 QUIRK_FLAG(MIC_RES_384)
+#define QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE QUIRK_FLAG(MIXER_PLAYBACK_MIN_MUTE)
+#define QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE QUIRK_FLAG(MIXER_CAPTURE_MIN_MUTE)
#endif /* __USBAUDIO_H */
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v5 2/4] ALSA: usb-audio: improve module param quirk_flags
2025-09-25 9:25 [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae via B4 Relay
2025-09-25 9:25 ` [PATCH v5 1/4] ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_* Cryolitia PukNgae via B4 Relay
@ 2025-09-25 9:25 ` Cryolitia PukNgae via B4 Relay
2025-09-27 9:30 ` Takashi Iwai
2025-09-25 9:25 ` [PATCH v5 3/4] ALSA: usb-audio: make param quirk_flags change-able in runtime Cryolitia PukNgae via B4 Relay
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Cryolitia PukNgae via B4 Relay @ 2025-09-25 9:25 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, Jonathan Corbet
Cc: Mingcong Bai, Kexy Biscuit, Nie Cheng, Zhan Jun, Feng Yuan,
qaqland, kernel, linux-sound, linux-kernel, linux-doc,
Cryolitia PukNgae, Takashi Iwai
From: Cryolitia PukNgae <cryolitia@uniontech.com>
For apply and unapply quirk flags more flexibly though param
Co-developed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
---
sound/usb/card.c | 44 ++++++++++++++++++++++++----
sound/usb/quirks.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
sound/usb/quirks.h | 4 ++-
3 files changed, 124 insertions(+), 8 deletions(-)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 0265206a8e8cf31133e8463c98fe0497d8ace89e..68d8324fef3747c48d01088e7d1deb61e870db5c 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -73,7 +73,7 @@ static bool lowlatency = true;
static char *quirk_alias[SNDRV_CARDS];
static char *delayed_register[SNDRV_CARDS];
static bool implicit_fb[SNDRV_CARDS];
-static unsigned int quirk_flags[SNDRV_CARDS];
+static char *quirk_flags[SNDRV_CARDS];
bool snd_usb_use_vmalloc = true;
bool snd_usb_skip_validation;
@@ -103,7 +103,7 @@ 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, uint, NULL, 0444);
+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).");
@@ -692,6 +692,41 @@ static void usb_audio_make_longname(struct usb_device *dev,
}
}
+static void snd_usb_init_quirk_flags(int idx, struct snd_usb_audio *chip)
+{
+ char *val;
+ size_t i;
+
+ /* old style option found: the position-based integer value */
+ if (quirk_flags[idx] &&
+ !kstrtou32(quirk_flags[idx], 0, &chip->quirk_flags)) {
+ usb_audio_dbg(chip,
+ "Set quirk flags 0x%x from param based on position %d for device %04x:%04x\n",
+ chip->quirk_flags, idx,
+ USB_ID_VENDOR(chip->usb_id),
+ USB_ID_PRODUCT(chip->usb_id));
+ return;
+ }
+
+ /* take the default quirk from the quirk table */
+ snd_usb_init_quirk_flags_table(chip);
+
+ /* add or correct quirk bits from options */
+ for (i = 0; i < ARRAY_SIZE(quirk_flags); i++) {
+ if (!quirk_flags[i] || !*quirk_flags[i])
+ break;
+
+ val = kstrdup(quirk_flags[i], GFP_KERNEL);
+
+ if (!val)
+ return;
+
+ snd_usb_init_quirk_flags_parse_string(chip, val);
+
+ kfree(val);
+ }
+}
+
/*
* create a chip instance and set its names.
*/
@@ -750,10 +785,7 @@ static int snd_usb_audio_create(struct usb_interface *intf,
INIT_LIST_HEAD(&chip->midi_v2_list);
INIT_LIST_HEAD(&chip->mixer_list);
- if (quirk_flags[idx])
- chip->quirk_flags = quirk_flags[idx];
- else
- snd_usb_init_quirk_flags(chip);
+ snd_usb_init_quirk_flags(idx, chip);
card->private_free = snd_usb_audio_free;
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index db6d6e324d78c4da3fc3c676f6f076f01841204e..5bcad4997ed2a4642903d5ef9d43109fb0b20324 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -2536,7 +2536,7 @@ void snd_usb_apply_flag_dbg(const char *reason,
}
}
-void snd_usb_init_quirk_flags(struct snd_usb_audio *chip)
+void snd_usb_init_quirk_flags_table(struct snd_usb_audio *chip)
{
const struct usb_audio_quirk_flags_table *p;
@@ -2550,3 +2550,85 @@ void snd_usb_init_quirk_flags(struct snd_usb_audio *chip)
}
}
}
+
+void snd_usb_init_quirk_flags_parse_string(struct snd_usb_audio *chip, char *val)
+{
+ u16 chip_vid = USB_ID_VENDOR(chip->usb_id);
+ u16 chip_pid = USB_ID_PRODUCT(chip->usb_id);
+ u32 mask_flags, unmask_flags, bit;
+ char *p, *field, *flag;
+ bool is_unmask;
+ u16 vid, pid;
+
+ for (p = val; p && *p;) {
+ /* Each entry consists of VID:PID:flags */
+ field = strsep(&p, ":");
+ if (!field)
+ break;
+
+ if (strcmp(field, "*") == 0)
+ vid = 0;
+ else if (kstrtou16(field, 16, &vid))
+ break;
+
+ field = strsep(&p, ":");
+ if (!field)
+ break;
+
+ if (strcmp(field, "*") == 0)
+ pid = 0;
+ else if (kstrtou16(field, 16, &pid))
+ break;
+
+ field = strsep(&p, ";");
+ if (!field || !*field)
+ break;
+
+ if ((vid != 0 && vid != chip_vid) ||
+ (pid != 0 && pid != chip_pid))
+ continue;
+
+ /* Collect the flags */
+ mask_flags = 0;
+ unmask_flags = 0;
+ while (field && *field) {
+ flag = strsep(&field, "|");
+
+ if (!flag)
+ break;
+
+ if (*flag == '!') {
+ is_unmask = true;
+ flag++;
+ } else {
+ is_unmask = false;
+ }
+
+ if (!kstrtou32(flag, 16, &bit)) {
+ if (is_unmask)
+ unmask_flags |= bit;
+ else
+ mask_flags |= bit;
+
+ break;
+ }
+
+ bit = snd_usb_quirk_flags_from_name(flag);
+
+ if (bit) {
+ if (is_unmask)
+ unmask_flags |= bit;
+ else
+ mask_flags |= bit;
+ } else {
+ pr_warn("snd_usb_audio: unknown flag %s while parsing param quirk_flags\n",
+ flag);
+ }
+ }
+
+ chip->quirk_flags &= ~unmask_flags;
+ chip->quirk_flags |= mask_flags;
+ snd_usb_apply_flag_dbg("module param", chip,
+ chip->quirk_flags);
+ }
+}
diff --git a/sound/usb/quirks.h b/sound/usb/quirks.h
index 1b727d3c35c7033b85b56ce43d66fd76c8f2d4ef..218ae0e1bd7ea890fc05227bec7ab81b1562e316 100644
--- a/sound/usb/quirks.h
+++ b/sound/usb/quirks.h
@@ -52,7 +52,9 @@ void snd_usb_apply_flag_dbg(const char *reason,
struct snd_usb_audio *chip,
unsigned long flag);
-void snd_usb_init_quirk_flags(struct snd_usb_audio *chip);
+void snd_usb_init_quirk_flags_table(struct snd_usb_audio *chip);
+void snd_usb_init_quirk_flags_parse_string(struct snd_usb_audio *chip,
+ char *val);
const char *snd_usb_quirk_flag_find_name(unsigned long flag);
u32 snd_usb_quirk_flags_from_name(const char *name);
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v5 3/4] ALSA: usb-audio: make param quirk_flags change-able in runtime
2025-09-25 9:25 [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae via B4 Relay
2025-09-25 9:25 ` [PATCH v5 1/4] ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_* Cryolitia PukNgae via B4 Relay
2025-09-25 9:25 ` [PATCH v5 2/4] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae via B4 Relay
@ 2025-09-25 9:25 ` Cryolitia PukNgae via B4 Relay
2025-09-27 9:32 ` Takashi Iwai
2025-09-27 11:13 ` kernel test robot
2025-09-25 9:25 ` [PATCH v5 4/4] ALSA: doc: add docs about improved quirk_flags in snd-usb-audio Cryolitia PukNgae via B4 Relay
2025-09-27 9:21 ` [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags Takashi Iwai
4 siblings, 2 replies; 10+ messages in thread
From: Cryolitia PukNgae via B4 Relay @ 2025-09-25 9:25 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, Jonathan Corbet
Cc: Mingcong Bai, Kexy Biscuit, Nie Cheng, Zhan Jun, Feng Yuan,
qaqland, kernel, linux-sound, linux-kernel, linux-doc,
Cryolitia PukNgae, Takashi Iwai
From: Cryolitia PukNgae <cryolitia@uniontech.com>
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>
---
sound/usb/card.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 68d8324fef3747c48d01088e7d1deb61e870db5c..4001a4d0ad2b30ccc03b11fc7a1ebb63efb6ab1f 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -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 */
+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.
@@ -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_mutex);
+
/* old style option found: the position-based integer value */
if (quirk_flags[idx] &&
!kstrtou32(quirk_flags[idx], 0, &chip->quirk_flags)) {
- usb_audio_dbg(chip,
- "Set quirk flags 0x%x from param based on position %d for device %04x:%04x\n",
- chip->quirk_flags, idx,
- USB_ID_VENDOR(chip->usb_id),
- USB_ID_PRODUCT(chip->usb_id));
- return;
+ snd_usb_apply_flag_dbg("module param", chip, chip->quirk_flags);
+ goto unlock;
}
/* take the default quirk from the quirk table */
@@ -725,6 +742,9 @@ static void snd_usb_init_quirk_flags(int idx, struct snd_usb_audio *chip)
kfree(val);
}
+
+unlock:
+ mutex_unlock(&quirk_flags_mutex);
}
/*
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v5 4/4] ALSA: doc: add docs about improved quirk_flags in snd-usb-audio
2025-09-25 9:25 [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae via B4 Relay
` (2 preceding siblings ...)
2025-09-25 9:25 ` [PATCH v5 3/4] ALSA: usb-audio: make param quirk_flags change-able in runtime Cryolitia PukNgae via B4 Relay
@ 2025-09-25 9:25 ` Cryolitia PukNgae via B4 Relay
2025-09-27 9:21 ` [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags Takashi Iwai
4 siblings, 0 replies; 10+ messages in thread
From: Cryolitia PukNgae via B4 Relay @ 2025-09-25 9:25 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, Jonathan Corbet
Cc: Mingcong Bai, Kexy Biscuit, Nie Cheng, Zhan Jun, Feng Yuan,
qaqland, kernel, linux-sound, linux-kernel, linux-doc,
Cryolitia PukNgae
From: Cryolitia PukNgae <cryolitia@uniontech.com>
Just briefly described about the option.
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
---
Documentation/sound/alsa-configuration.rst | 108 ++++++++++++++++++++---------
1 file changed, 75 insertions(+), 33 deletions(-)
diff --git a/Documentation/sound/alsa-configuration.rst b/Documentation/sound/alsa-configuration.rst
index a2fb8ed251dd0294e7a62209ca15d5c32c6adfae..0a4eaa7d66ddd05e7c7378596a351bb6ea17f9ba 100644
--- a/Documentation/sound/alsa-configuration.rst
+++ b/Documentation/sound/alsa-configuration.rst
@@ -2297,39 +2297,81 @@ skip_validation
of the unit descriptor instead of a driver probe error, so that we
can check its details.
quirk_flags
- Contains the bit flags for various device specific workarounds.
- Applied to the corresponding card index.
-
- * bit 0: Skip reading sample rate for devices
- * bit 1: Create Media Controller API entries
- * bit 2: Allow alignment on audio sub-slot at transfer
- * bit 3: Add length specifier to transfers
- * bit 4: Start playback stream at first in implement feedback mode
- * bit 5: Skip clock selector setup
- * bit 6: Ignore errors from clock source search
- * bit 7: Indicates ITF-USB DSD based DACs
- * bit 8: Add a delay of 20ms at each control message handling
- * bit 9: Add a delay of 1-2ms at each control message handling
- * bit 10: Add a delay of 5-6ms at each control message handling
- * bit 11: Add a delay of 50ms at each interface setup
- * bit 12: Perform sample rate validations at probe
- * bit 13: Disable runtime PM autosuspend
- * bit 14: Ignore errors for mixer access
- * bit 15: Support generic DSD raw U32_BE format
- * bit 16: Set up the interface at first like UAC1
- * bit 17: Apply the generic implicit feedback sync mode
- * bit 18: Don't apply implicit feedback sync mode
- * bit 19: Don't closed interface during setting sample rate
- * bit 20: Force an interface reset whenever stopping & restarting
- a stream
- * bit 21: Do not set PCM rate (frequency) when only one rate is
- available for the given endpoint.
- * bit 22: Set the fixed resolution 16 for Mic Capture Volume
- * bit 23: Set the fixed resolution 384 for Mic Capture Volume
- * bit 24: Set minimum volume control value as mute for devices
- where the lowest playback value represents muted state instead
- of minimum audible volume
- * bit 25: Be similar to bit 24 but for capture streams
+ The option provides a refined and flexible control for applying quirk
+ flags. It allows to specify the quirk flags for each device, and can
+ be modified dynamically via sysfs.
+ The old usage accepts an array of integers, each of which applies quirk
+ flags on the device in the order of probing.
+ E.g., ``quirk_flags=0x01,0x02`` applies get_sample_rate to the first
+ device, and share_media_device to the second device.
+ The new usage accepts a string in the format of
+ ``VID1:PID1:FLAGS1;VID2:PID2:FLAGS2;...``, where ``VIDx`` and ``PIDx``
+ specify the device, and ``FLAGSx`` specify the flags to be applied.
+ ``VIDx`` and ``PIDx`` are 4-digit hexadecimal numbers, and can be
+ specified as ``*`` to match any value. ``FLAGSx`` can be a set of
+ flags given by name, separated by ``|``, or a hexadecimal number
+ representing the bit flags. The available flag names are listed below.
+ An exclamation mark can be prefixed to a flag name to negate the flag.
+ For example, ``1234:abcd:mixer_playback_min_mute|!ignore_ctl_error;*:*:0x01;``
+ applies the ``mixer_playback_min_mute`` flag and clears the
+ ``ignore_ctl_error`` flag for the device 1234:abcd, and applies the
+ ``skip_sample_rate`` flag for all devices.
+
+ * bit 0: ``get_sample_rate``
+ Skip reading sample rate for devices
+ * bit 1: ``share_media_device``
+ Create Media Controller API entries
+ * bit 2: ``align_transfer``
+ Allow alignment on audio sub-slot at transfer
+ * bit 3: ``tx_length``
+ Add length specifier to transfers
+ * bit 4: ``playback_first``
+ Start playback stream at first in implement feedback mode
+ * bit 5: ``skip_clock_selector``
+ Skip clock selector setup
+ * bit 6: ``ignore_clock_source``
+ Ignore errors from clock source search
+ * bit 7: ``itf_usb_dsd_dac``
+ Indicates ITF-USB DSD-based DACs
+ * bit 8: ``ctl_msg_delay``
+ Add a delay of 20ms at each control message handling
+ * bit 9: ``ctl_msg_delay_1m``
+ Add a delay of 1-2ms at each control message handling
+ * bit 10: ``ctl_msg_delay_5m``
+ Add a delay of 5-6ms at each control message handling
+ * bit 11: ``iface_delay``
+ Add a delay of 50ms at each interface setup
+ * bit 12: ``validate_rates``
+ Perform sample rate validations at probe
+ * bit 13: ``disable_autosuspend``
+ Disable runtime PM autosuspend
+ * bit 14: ``ignore_ctl_error``
+ Ignore errors for mixer access
+ * bit 15: ``dsd_raw``
+ Support generic DSD raw U32_BE format
+ * bit 16: ``set_iface_first``
+ Set up the interface at first like UAC1
+ * bit 17: ``generic_implicit_fb``
+ Apply the generic implicit feedback sync mode
+ * bit 18: ``skip_implicit_fb``
+ Don't apply implicit feedback sync mode
+ * bit 19: ``iface_skip_close``
+ Don't close interface during setting sample rate
+ * bit 20: ``force_iface_reset``
+ Force an interface reset whenever stopping & restarting a stream
+ * bit 21: ``fixed_rate``
+ Do not set PCM rate (frequency) when only one rate is available
+ for the given endpoint
+ * bit 22: ``mic_res_16``
+ Set the fixed resolution 16 for Mic Capture Volume
+ * bit 23: ``mic_res_384``
+ Set the fixed resolution 384 for Mic Capture Volume
+ * bit 24: ``mixer_playback_min_mute``
+ Set minimum volume control value as mute for devices where the
+ lowest playback value represents muted state instead of minimum
+ audible volume
+ * bit 25: ``mixer_capture_min_mute``
+ Similar to bit 24 but for capture streams
This module supports multiple devices, autoprobe and hotplugging.
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags
2025-09-25 9:25 [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae via B4 Relay
` (3 preceding siblings ...)
2025-09-25 9:25 ` [PATCH v5 4/4] ALSA: doc: add docs about improved quirk_flags in snd-usb-audio Cryolitia PukNgae via B4 Relay
@ 2025-09-27 9:21 ` Takashi Iwai
4 siblings, 0 replies; 10+ messages in thread
From: Takashi Iwai @ 2025-09-27 9:21 UTC (permalink / raw)
To: cryolitia
Cc: Jaroslav Kysela, Takashi Iwai, Jonathan Corbet, Mingcong Bai,
Kexy Biscuit, Nie Cheng, Zhan Jun, Feng Yuan, qaqland, kernel,
linux-sound, linux-kernel, linux-doc, Takashi Iwai
On Thu, 25 Sep 2025 11:25:15 +0200,
Cryolitia PukNgae via B4 Relay wrote:
>
> As an implementation of what has been discussed previously[1].
>
> 1. https://lore.kernel.org/all/87h5xm5g7f.wl-tiwai@suse.de/
>
> Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
Thanks for the new patch set. In general the code change looks good.
But, could you provide a bit more information in the patch
description? Ideally speaking, the patch description should suffice
to understand what's done in the commit without seeing the commit
change itself.
Also, please try to use guard() for mutex.
thanks,
Takashi
> ---
> Changes in v5:
> - Apply review comments. Thanks a lot, Takashi Iwai!
> - Link to v4: https://lore.kernel.org/r/20250918-sound-v4-0-82cf8123d61c@uniontech.com
>
> Changes in v4:
> - Split basic parse and dynamic change
> - Drop usage of linked list
> - Link to v3: https://lore.kernel.org/r/20250917-sound-v3-0-92ebe9472a0a@uniontech.com
>
> Changes in v3:
> - Instead of a new param, improve the existed one.
> - Link to v2: https://lore.kernel.org/r/20250912-sound-v2-0-01ea3d279f4b@uniontech.com
>
> Changes in v2:
> - Cleaned up some internal rebase confusion, sorry for that
> - Link to v1: https://lore.kernel.org/r/20250912-sound-v1-0-cc9cfd9f2d01@uniontech.com
>
> ---
> Cryolitia PukNgae (4):
> ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_*
> ALSA: usb-audio: improve module param quirk_flags
> ALSA: usb-audio: make param quirk_flags change-able in runtime
> ALSA: doc: add docs about improved quirk_flags in snd-usb-audio
>
> Documentation/sound/alsa-configuration.rst | 108 +++++++++++------
> sound/usb/card.c | 66 +++++++++--
> sound/usb/quirks.c | 179 ++++++++++++++++++++++++++++-
> sound/usb/quirks.h | 11 +-
> sound/usb/usbaudio.h | 84 +++++++++-----
> 5 files changed, 376 insertions(+), 72 deletions(-)
> ---
> base-commit: 4c421c40c8b30ab7aae1edc7f7e294fcd33fc186
> change-id: 20250910-sound-a91c86c92dba
>
> Best regards,
> --
> Cryolitia PukNgae <cryolitia@uniontech.com>
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 1/4] ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_*
2025-09-25 9:25 ` [PATCH v5 1/4] ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_* Cryolitia PukNgae via B4 Relay
@ 2025-09-27 9:24 ` Takashi Iwai
0 siblings, 0 replies; 10+ messages in thread
From: Takashi Iwai @ 2025-09-27 9:24 UTC (permalink / raw)
To: cryolitia
Cc: Jaroslav Kysela, Takashi Iwai, Jonathan Corbet, Mingcong Bai,
Kexy Biscuit, Nie Cheng, Zhan Jun, Feng Yuan, qaqland, kernel,
linux-sound, linux-kernel, linux-doc, Takashi Iwai
On Thu, 25 Sep 2025 11:25:16 +0200,
Cryolitia PukNgae via B4 Relay wrote:
> +u32 snd_usb_quirk_flags_from_name(const char *name)
> +{
> + char *upper;
> + int i;
> +
> + upper = kstrdup(name, GFP_KERNEL);
> +
> + if (!upper)
> + return 0;
> +
> + string_upper(upper, upper);
> +
> + if (!name || !*name)
> + return 0;
> +
> + for (i = 0; snd_usb_audio_quirk_flag_names[i]; i++) {
> + if (strcmp(name, snd_usb_audio_quirk_flag_names[i]) == 0 ||
> + strcmp(upper, snd_usb_audio_quirk_flag_names[i]) == 0) {
> + kfree(upper);
> + return BIT_U32(i);
> + }
> + }
> +
> + kfree(upper);
> + return 0;
> +}
I suppose you can write simpler code with strcasecmp().
thanks,
Takashi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 2/4] ALSA: usb-audio: improve module param quirk_flags
2025-09-25 9:25 ` [PATCH v5 2/4] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae via B4 Relay
@ 2025-09-27 9:30 ` Takashi Iwai
0 siblings, 0 replies; 10+ messages in thread
From: Takashi Iwai @ 2025-09-27 9:30 UTC (permalink / raw)
To: cryolitia
Cc: Jaroslav Kysela, Takashi Iwai, Jonathan Corbet, Mingcong Bai,
Kexy Biscuit, Nie Cheng, Zhan Jun, Feng Yuan, qaqland, kernel,
linux-sound, linux-kernel, linux-doc, Takashi Iwai
On Thu, 25 Sep 2025 11:25:17 +0200,
Cryolitia PukNgae via B4 Relay wrote:
> +static void snd_usb_init_quirk_flags(int idx, struct snd_usb_audio *chip)
> +{
> + /* add or correct quirk bits from options */
> + for (i = 0; i < ARRAY_SIZE(quirk_flags); i++) {
> + if (!quirk_flags[i] || !*quirk_flags[i])
> + break;
> +
> + val = kstrdup(quirk_flags[i], GFP_KERNEL);
> +
> + if (!val)
> + return;
> +
> + snd_usb_init_quirk_flags_parse_string(chip, val);
> +
> + kfree(val);
For a temporary string allocation, nowadays it's better to use
__free(kfree):
for (i = 0; i < ARRAY_SIZE(quirk_flags); i++) {
if (!quirk_flags[i] || !*quirk_flags[i])
break;
char *val __free(kfree) =
kstrdup(quirk_flags[i], GFP_KERNEL);
if (!val)
return;
snd_usb_init_quirk_flags_parse_string(chip, val);
}
Or maybe it's even safer to pass the original string (with const) and
do kstrdup() in the callee side. You can use __free(kfree) in the
same way in snd_usb_init_quirk_flags_parse_string().
thanks,
Takashi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 3/4] ALSA: usb-audio: make param quirk_flags change-able in runtime
2025-09-25 9:25 ` [PATCH v5 3/4] ALSA: usb-audio: make param quirk_flags change-able in runtime Cryolitia PukNgae via B4 Relay
@ 2025-09-27 9:32 ` Takashi Iwai
2025-09-27 11:13 ` kernel test robot
1 sibling, 0 replies; 10+ messages in thread
From: Takashi Iwai @ 2025-09-27 9:32 UTC (permalink / raw)
To: cryolitia
Cc: Jaroslav Kysela, Takashi Iwai, Jonathan Corbet, Mingcong Bai,
Kexy Biscuit, Nie Cheng, Zhan Jun, Feng Yuan, qaqland, kernel,
linux-sound, linux-kernel, linux-doc, Takashi Iwai
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 3/4] ALSA: usb-audio: make param quirk_flags change-able in runtime
2025-09-25 9:25 ` [PATCH v5 3/4] ALSA: usb-audio: make param quirk_flags change-able in runtime Cryolitia PukNgae via B4 Relay
2025-09-27 9:32 ` Takashi Iwai
@ 2025-09-27 11:13 ` kernel test robot
1 sibling, 0 replies; 10+ messages in thread
From: kernel test robot @ 2025-09-27 11:13 UTC (permalink / raw)
To: Cryolitia PukNgae via B4 Relay, Jaroslav Kysela, Takashi Iwai,
Jonathan Corbet
Cc: oe-kbuild-all, Mingcong Bai, Kexy Biscuit, Nie Cheng, Zhan Jun,
Feng Yuan, qaqland, kernel, linux-sound, linux-kernel, linux-doc,
Cryolitia PukNgae
Hi Cryolitia,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 4c421c40c8b30ab7aae1edc7f7e294fcd33fc186]
url: https://github.com/intel-lab-lkp/linux/commits/Cryolitia-PukNgae-via-B4-Relay/ALSA-usb-audio-add-two-way-convert-between-name-and-bit-for-QUIRK_FLAG_/20250925-173635
base: 4c421c40c8b30ab7aae1edc7f7e294fcd33fc186
patch link: https://lore.kernel.org/r/20250925-sound-v5-3-2593586ff350%40uniontech.com
patch subject: [PATCH v5 3/4] ALSA: usb-audio: make param quirk_flags change-able in runtime
config: arm64-randconfig-r132-20250927 (https://download.01.org/0day-ci/archive/20250927/202509271834.cL5PYMND-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project cafc064fc7a96b3979a023ddae1da2b499d6c954)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250927/202509271834.cL5PYMND-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509271834.cL5PYMND-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> sound/usb/card.c:112:1: sparse: sparse: symbol 'quirk_flags_mutex' was not declared. Should it be static?
vim +/quirk_flags_mutex +112 sound/usb/card.c
110
111 /* protects quirk_flags */
> 112 DEFINE_MUTEX(quirk_flags_mutex);
113
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-09-27 11:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 9:25 [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae via B4 Relay
2025-09-25 9:25 ` [PATCH v5 1/4] ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_* Cryolitia PukNgae via B4 Relay
2025-09-27 9:24 ` Takashi Iwai
2025-09-25 9:25 ` [PATCH v5 2/4] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae via B4 Relay
2025-09-27 9:30 ` Takashi Iwai
2025-09-25 9:25 ` [PATCH v5 3/4] ALSA: usb-audio: make param quirk_flags change-able in runtime Cryolitia PukNgae via B4 Relay
2025-09-27 9:32 ` Takashi Iwai
2025-09-27 11:13 ` kernel test robot
2025-09-25 9:25 ` [PATCH v5 4/4] ALSA: doc: add docs about improved quirk_flags in snd-usb-audio Cryolitia PukNgae via B4 Relay
2025-09-27 9:21 ` [PATCH v5 0/4] ALSA: usb-audio: improve module param quirk_flags Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).