Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Jaroslav Kysela <perex@perex.cz>,
	 Kevin Hilman <khilman@baylibre.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	 Mark Brown <broonie@kernel.org>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	 Neil Armstrong <neil.armstrong@linaro.org>,
	 Takashi Iwai <tiwai@suse.com>,
	linux-arm-kernel@lists.infradead.org,
	 linux-sound@vger.kernel.org
Subject: Re: [PATCH 2/2] ASoC: meson: meson-card: use priv instead of card on each functions
Date: Wed, 22 Jul 2026 09:40:55 +0200	[thread overview]
Message-ID: <1ja4rjeak8.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <87y0f3zwrt.wl-kuninori.morimoto.gx@renesas.com> (Kuninori Morimoto's message of "Wed, 22 Jul 2026 00:35:34 +0000")

On mer. 22 juil. 2026 at 00:35, Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote:

> Hi Jerome, again
>
> I now double checked.
>
>> > The change is simple but it will make more complex to backport fix an
>> > older kernel once this fix is applied. So again, getting more context to
>> > understand what you are trying to accomplish and why it needs a standard
>> > card variable name would help.
>> 
>> Basically, after "Card capsuling" has done, we can't directly use card->xxx
>> anymore. So we need to update all of such code.
>> I would like to update such code as much as possible in advance.
>> Otherwise, "Card capsuling" patch itself will be more complex and difficult
>> to review.
>
> Current functions get "card" as parameter to get "dev".
>
> 	func(card, ...)
> 	{
> 		struct device *dev = card->dev;
> 		...
> 	}
>
> After "Card capsuling", we will use "card_driver" instead.
> But switching "card" to "card_driver" only is not enough, on Meson case,
> because "card_driver" don't have "dev".
>
> On Meson case, it don't need to keep "card" in priv anymore after
> "Card capsuling". So I would like to add "dev" in priv instead, and remove
> "card", like this.
>
> 	struct meson_card {
> 	 	...
> -		struct snd_soc_card card;
> +		struct snd_soc_card_driver card_driver;
> +		struct device *dev;
> 		...
> 	};
>
> Then, we can get both "card_driver" and "dev" from "priv".
>
> If we can switch to use "priv" instead of "card" *now*, the diff will be
> more small when "Card capsuling", because the patch will have
> "Card capsuling diff" (A) + "switch card to priv" (B).
>
> This diff of (B) part is doing very simple things, but is big volume,
> because it is sharing the code on Meson.
>
> -	func(card, ...)
> +	func(priv, ...)
> 	{
> -		struct device *dev = card->dev;
> +		struct device *dev = priv->dev;
> +		struct snd_soc_card_driver *card_driver = priv->card_driver;
>  		...
> - 		snd_soc_card_xxx(card, ...);
> + 		snd_soc_card_xxx(card_driver, ...);
> 		...
> 	}
>
> -	func(card, ...);
> +	func(priv, ...);
>
> If we can merge (B) part first, remaining part (A) can be simple.
> But yes, the backport will be complex.
>
> Thank you for your help !!
>
> Best regards
> ---
> Kuninori Morimoto

I think getting the device from the card (or other ASoC element) is a
regular pattern. I get what you are trying to do with what you call
capsuling but maybe you should add an API to query those things from
the framework ? like Something snd_soc_card_get_dev(card) ?

The driver then does not have poke the internals of the card but can
still get stuff like that from it

-- 
Jerome


      reply	other threads:[~2026-07-22  7:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  1:36 [PATCH 0/2] ASoC: meson: preparation for Card capsuling Kuninori Morimoto
2026-07-21  1:36 ` [PATCH RFC 1/2] ASoC: meson: meson-card-utils: use meson_card_parse_of_optional() Kuninori Morimoto
2026-07-21  7:32   ` Jerome Brunet
2026-07-21  1:36 ` [PATCH 2/2] ASoC: meson: meson-card: use priv instead of card on each functions Kuninori Morimoto
2026-07-21  7:35   ` Jerome Brunet
2026-07-21 23:22     ` Kuninori Morimoto
2026-07-22  0:35       ` Kuninori Morimoto
2026-07-22  7:40         ` Jerome Brunet [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=1ja4rjeak8.fsf@starbuckisacylon.baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=khilman@baylibre.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.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