[PATCH 2/2] ASoC: meson: meson-card: use priv instead of card on each functions
Jerome Brunet
jbrunet at baylibre.com
Wed Jul 22 00:40:55 PDT 2026
On mer. 22 juil. 2026 at 00:35, Kuninori Morimoto <kuninori.morimoto.gx at 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
More information about the linux-arm-kernel
mailing list