From: Takashi Iwai <tiwai@suse.de>
To: Jaroslav Kysela <perex@perex.cz>
Cc: Maciej Strozek <mstrozek@opensource.cirrus.com>,
Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
alsa-devel@alsa-project.org, patches@opensource.cirrus.com
Subject: Re: [PATCH v6 2/2] ALSA: control: add ioctl to retrieve full card components
Date: Fri, 31 Jul 2026 12:59:32 +0200 [thread overview]
Message-ID: <87y0erzap7.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260720103505.1860399-2-mstrozek@opensource.cirrus.com>
On Mon, 20 Jul 2026 12:35:05 +0200,
Maciej Strozek wrote:
>
> The fixed-size components field in SNDRV_CTL_IOCTL_CARD_INFO can be too
> small on systems with many audio devices.
>
> Keep the existing struct snd_ctl_card_info ABI intact and add a new
> ioctl SNDRV_CTL_IOCTL_CARD_BYTES that carries a variable-length payload
> selected by a type discriminator. The first defined type
> SND_CTL_CARD_BTYPE_COMPONENTS returns the full components string. The
> ioctl is designed to be reused for other variable-length card payloads
> in the future.
>
> The user-space caller may set data_allocated == 0 (or data == NULL) to
> query the required length; otherwise the kernel copies the payload into
> the user buffer and writes back the actual length in data_len.
>
> When the legacy components field in struct snd_ctl_card_info is
> truncated, '>' is written just before the NUL terminator to signal to
> user-space that the full string is available via the new ioctl.
>
> card->components is now dynamically allocated and grown in 32 byte
> increments via krealloc(), capped at 512 bytes.
>
> Link: https://github.com/alsa-project/alsa-lib/pull/494
> Suggested-by: Jaroslav Kysela <perex@perex.cz>
> Suggested-by: Takashi Iwai <tiwai@suse.com>
> Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
> ---
> Changes for v6:
> - take the snd_ioctl_rwsem write lock in snd_component_add()
> Changes for v5:
> - use __u64 and u64_to_user_ptr() instead of 32bit compat layer
> - handle a NULL card->components
> Changes for v4:
> - replaced snd_ctl_card_components with snd_ctl_card_bytes for possible
> future extensions
> - support query mode (data_allocated == 0 or data == NULL)
> - added compat 32-bit
> - renamed card->components_ptr / components_ptr_alloc_size to
> card->components / components_alloc_size
> Changes for v3:
> - change components field to a dynamic array resizable in 32 byte
> increments
> - removed SNDRV_CTL_COMPONENTS_LEN define
> - sanity check if 'components' requests more than 512 bytes
> - added a commit to clean up trailing whitespaces
> - alsa-utils link no longer needed
> Changes for v2:
> - do not modify existing card->components field
> - add a new ioctl and struct to keep the full components string
> - handle the split/trim in snd_ctl_card_info()
Looks OK for me. Jaroslav, could you review, too?
If nothing obvious is found, I'm going to take for 7.3.
thanks,
Takashi
prev parent reply other threads:[~2026-07-31 11:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 10:35 [PATCH v6 1/2] ALSA: control: tidy up whitespaces Maciej Strozek
2026-07-20 10:35 ` [PATCH v6 2/2] ALSA: control: add ioctl to retrieve full card components Maciej Strozek
2026-07-31 10:59 ` Takashi Iwai [this message]
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=87y0erzap7.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mstrozek@opensource.cirrus.com \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox