All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Rong Zhang <i@rong.moe>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Cryolitia PukNgae <cryolitia@uniontech.com>,
	Arun Raghavan <arunr@valvesoftware.com>,
	linux-sound@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, Icenowy Zheng <uwu@icenowy.me>
Subject: Re: [PATCH v2 4/8] ALSA: usb-audio: Support string-descriptor-based quirk table entry
Date: Tue, 03 Mar 2026 07:37:29 +0100	[thread overview]
Message-ID: <87ecm1l8pi.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260302185900.427415-5-i@rong.moe>

On Mon, 02 Mar 2026 19:58:55 +0100,
Rong Zhang wrote:
> 
> Some quirky devices do not have a unique VID/PID. Matching them using
> DEVICE_FLG() or VENDOR_FLG() may result in conflicts.
> 
> Add two new macros DEVICE_STRING_FLG() and VENDOR_STRING_FLG() to match
> USB string descriptors (manufacturer and/or product) in addition to VID
> and/or PID, so that we can deconflict these devices safely.
> 
> No functional change intended.
> 
> Signed-off-by: Rong Zhang <i@rong.moe>
> ---
> Changes in v2:
> - Alloc string buffers with kmalloc() instead of on stack (thanks
>   Takashi Iwai)
> - Get string descriptors in a neater way (ditto)
> - Tiny differences compared to Takashi's sugeestion:
>   - Use `IS_ERR_OR_NULL() || strcmp()' instead of `!IS_ERR_OR_NULL() &&
>     strcmp()', so failure in getting the string descriptor won't
>     resulting in quirk flags being applied to irrelevant devices
>   - Use trivial goto cleanup patterns instead of `__free(kfree)' as the
>     latter can't handle ERR_PTR()

__free(kfree) can handle ERR_PTR() gracefully :)
In linux/slab.h, it's defined as:
  DEFINE_FREE(kfree, void *, if (!IS_ERR_OR_NULL(_T)) kfree(_T))


Takashi

  reply	other threads:[~2026-03-03  6:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 18:58 [PATCH v2 0/8] ALSA: usb-audio: Add quirks for linear volume devices and deconflict VID Rong Zhang
2026-03-02 18:58 ` [PATCH v2 1/8] Revert "ALSA: usb: Increase volume range that triggers a warning" Rong Zhang
2026-03-02 20:53   ` [External Mail] " Arun Raghavan
2026-03-02 18:58 ` [PATCH v2 2/8] ALSA: usb-audio: Add helper function for volume range checks Rong Zhang
2026-03-02 18:58 ` [PATCH v2 3/8] ALSA: usb-audio: Improve " Rong Zhang
2026-03-02 18:58 ` [PATCH v2 4/8] ALSA: usb-audio: Support string-descriptor-based quirk table entry Rong Zhang
2026-03-03  6:37   ` Takashi Iwai [this message]
2026-03-02 18:58 ` [PATCH v2 5/8] ALSA: usb-audio: Deconflict VID between Focusrite Novation & MV-SILICON Rong Zhang
2026-03-02 18:58 ` [PATCH v2 6/8] ALSA: usb-audio: Add QUIRK_FLAG_MIXER_{PLAYBACK,CAPTURE}_LINEAR_VOL Rong Zhang
2026-03-02 18:58 ` [PATCH v2 7/8] ALSA: usb-audio: Add linear volume quirk for Hotone Audio Pulze Mini Rong Zhang
2026-03-02 18:58 ` [PATCH v2 8/8] ALSA: usb-audio: Apply linear volume quirk on MV-SILICON devices Rong Zhang

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=87ecm1l8pi.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=arunr@valvesoftware.com \
    --cc=corbet@lwn.net \
    --cc=cryolitia@uniontech.com \
    --cc=i@rong.moe \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=skhan@linuxfoundation.org \
    --cc=tiwai@suse.com \
    --cc=uwu@icenowy.me \
    /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.