From: Takashi Iwai <tiwai@suse.de>
To: cryolitia@uniontech.com
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Jonathan Corbet <corbet@lwn.net>,
Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>,
Daniel Gomez <da.gomez@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
linux-sound@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
Mingcong Bai <jeffbai@aosc.io>,
Kexy Biscuit <kexybiscuit@aosc.io>,
Nie Cheng <niecheng1@uniontech.com>,
Zhan Jun <zhanjun@uniontech.com>,
Feng Yuan <fengyuan@uniontech.com>,
qaqland <anguoli@uniontech.com>,
kernel@uniontech.com, linux-modules@vger.kernel.org,
Takashi Iwai <tiwai@suse.de>
Subject: Re: [PATCH v4 3/5] ALSA: usb-audio: improve module param quirk_flags
Date: Fri, 19 Sep 2025 14:47:40 +0200 [thread overview]
Message-ID: <87qzw28v83.wl-tiwai@suse.de> (raw)
In-Reply-To: <20250918-sound-v4-3-82cf8123d61c@uniontech.com>
On Thu, 18 Sep 2025 11:24:32 +0200,
Cryolitia PukNgae via B4 Relay wrote:
>
> 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 | 9 ++--
> sound/usb/quirks.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++-
> sound/usb/quirks.h | 3 +-
> sound/usb/usbaudio.h | 3 ++
> 4 files changed, 126 insertions(+), 8 deletions(-)
>
> diff --git a/sound/usb/card.c b/sound/usb/card.c
> index 0265206a8e8cf31133e8463c98fe0497d8ace89e..5837677effa1787ef9d7d02714c3ae43b1a8bc79 100644
> --- a/sound/usb/card.c
> +++ b/sound/usb/card.c
> @@ -73,8 +73,8 @@ 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];
>
> +char *quirk_flags[SNDRV_CARDS];
My preference is to keep this static, but pass the string value to a
function. That is, define snd_usb_init_quirk_flags() in main.c:
static void snd_usb_init_quirk_flags(struct snd_usb_audio *chip, int indx)
{
/* 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++) {
char *val __free(kfree) = NULL;
if (!quirk_flags[i] || !*quirk_flags[i])
continue;
val = kstrdup(quirk_flags[i], GFP_KERNEL);
if (!val)
return;
snd_usb_parse_quirk_string(chip, val);
}
}
static int snd_usb_audio_create(....)
{
....
snd_usb_init_quirk_flags(chip, idx);
....
}
The function snd_usb_parse_quirk_string() is defined in quirks.c,
void snd_usb_parse_quirk_string(struct snd_usb_audio *chip, char *val)
{
for (p = val; p && *p;) {
/* Each entry consists of VID:PID:flags */
field = strsep(&p, ":");
if (!field)
break;
.....
}
}
thanks,
Takashi
next prev parent reply other threads:[~2025-09-19 12:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 9:24 [PATCH v4 0/5] ALSA: usb-audio: add module param device_quirk_flags Cryolitia PukNgae
2025-09-18 9:24 ` Cryolitia PukNgae via B4 Relay
2025-09-18 9:24 ` [PATCH v4 1/5] ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_* Cryolitia PukNgae
2025-09-18 9:24 ` Cryolitia PukNgae via B4 Relay
2025-09-19 12:32 ` Takashi Iwai
2025-09-18 9:24 ` [PATCH v4 2/5] param: export param_array related functions Cryolitia PukNgae
2025-09-18 9:24 ` Cryolitia PukNgae via B4 Relay
2025-09-19 12:37 ` Takashi Iwai
2025-09-18 9:24 ` [PATCH v4 3/5] ALSA: usb-audio: improve module param quirk_flags Cryolitia PukNgae
2025-09-18 9:24 ` Cryolitia PukNgae via B4 Relay
2025-09-19 12:47 ` Takashi Iwai [this message]
2025-09-18 9:24 ` [PATCH v4 4/5] ALSA: usb-audio: make param quirk_flags change-able in runtime Cryolitia PukNgae
2025-09-18 9:24 ` Cryolitia PukNgae via B4 Relay
2025-09-18 9:24 ` [PATCH v4 5/5] ALSA: doc: add docs about improved quirk_flags in snd-usb-audio Cryolitia PukNgae
2025-09-18 9:24 ` Cryolitia PukNgae via B4 Relay
2025-09-18 20:21 ` Randy Dunlap
2025-09-19 1:43 ` Cryolitia PukNgae
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87qzw28v83.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=anguoli@uniontech.com \
--cc=corbet@lwn.net \
--cc=cryolitia@uniontech.com \
--cc=da.gomez@kernel.org \
--cc=fengyuan@uniontech.com \
--cc=jeffbai@aosc.io \
--cc=kernel@uniontech.com \
--cc=kexybiscuit@aosc.io \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=niecheng1@uniontech.com \
--cc=perex@perex.cz \
--cc=petr.pavlu@suse.com \
--cc=samitolvanen@google.com \
--cc=tiwai@suse.com \
--cc=zhanjun@uniontech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.