Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Cássio Gabriel" <cassiogabrielcontato@gmail.com>
Cc: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	notify@kernel.org
Subject: Re: [PATCH v2] ALSA: core: Use flexible array for card private data
Date: Mon, 01 Jun 2026 11:29:32 +0200	[thread overview]
Message-ID: <87v7c21udf.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260531-alsa-card-private-flex-array-v2-1-e4ff67f5bd23@gmail.com>

On Mon, 01 Jun 2026 03:23:35 +0200,
Cássio Gabriel wrote:
> 
> snd_card_new() and snd_devm_card_new() allocate struct snd_card
> together with optional driver-private storage. The storage is currently
> described only by open-coded sizeof(*card) + extra_size arithmetic, and
> snd_card_init() reaches it by manually adding sizeof(struct snd_card) to
> the card pointer.
> 
> Make the trailing storage explicit with a flexible array member. Use
> kzalloc_flex() for the regular allocation path and struct_size() for the
> devres allocation size. This documents the layout and avoids open-coded
> variable-size object arithmetic.
> 
> Align the flexible array to unsigned long long so the driver-private area
> does not become less aligned than the old sizeof(struct snd_card) tail
> address on 32-bit ABIs.
> 
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>

Applied to for-next branch now.  Thanks.


Takashi

      reply	other threads:[~2026-06-01  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  1:23 [PATCH v2] ALSA: core: Use flexible array for card private data Cássio Gabriel
2026-06-01  9:29 ` 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=87v7c21udf.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=cassiogabrielcontato@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=notify@kernel.org \
    --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