Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"Bard Liao" <yung-chuan.liao@linux.intel.com>,
	Jaroslav Kysela <perex@perex.cz>,
	"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	Kiseok Jo <kiseok.jo@irondevice.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	"Peter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Takashi Iwai <tiwai@suse.com>,
	"Vijendar Mukunda" <Vijendar.Mukunda@amd.com>,
	Benjamin Bara <benjamin.bara@skidata.com>,
	<linux-sound@vger.kernel.org>
Subject: Re: [PATCH 1/7] ASoC: soc-component: use dapm->component instead of container_of()
Date: Fri, 11 Apr 2025 11:07:06 +0200	[thread overview]
Message-ID: <fefd793a-3625-41a1-9fa1-ddd6cbbf3612@intel.com> (raw)
In-Reply-To: <8734efh2s8.wl-kuninori.morimoto.gx@renesas.com>

On 2025-04-11 4:04 AM, Kuninori Morimoto wrote:
> 
> Hi Cezary, again
> 
>>> I'd rather focus on 'struct snd_soc_dapm_context' exclusively. A valid
>>> pointer to this type is required for many functions found in
>>> include/sound/ yet the struct is more of framework-internal entity.
>>> Strict separation between dapm-context "for the framework" from
>>> dapm-context "for the user" would grant better readability benefits.
> 
> I have checked each drivers which is using struct snd_soc_dapm_context.
> It seems not only framework but many user drivers need to use/access to it.
> 
> So separation seems impossible, and dropping wrapper is maybe not good idea.
> But I can understand that it will be very longer code :)
> 
> 	x = dapm->component;
> 	x = snd_soc_dapm_to_component(dapm);
> 
> For me personally, wrapper function/macro is not so bad idea.
> It is much safer to use function/macro rather than touching them directly.
> 
> Anyway, I will try to keep current patch-set style.
> But any comment is very welcome.
> Thank you for your help !!


I see two replies, hope it's fine if I just reply to this one. I love 
the enthusiasm though :D

What I meant is that even the name of the type - 'dapm_context' - speaks 
of framework-internal stuff. The fields that define that struct also are 
not for the users (drivers) really. Perhaps there is a way to get rid of 
the dapm_context pointer entirely in the argument lists of public 
functions found in include/sound/. The pointer could be obtained e.g.: 
via container_of() by the framework's internal handler when needed.

Otherwise, I do not see real benefit of using 'x = 
snd_soc_dapm_to_component()' over 'x = dapm->component'. In my opinion 
there's no need to provide wrapper for every field we have. No hard 
blocks though.


Kind regards,
Czarek

  reply	other threads:[~2025-04-11  9:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  2:56 [PATCH 0/7] ASoC: use snd_soc_dapm_to_component() Kuninori Morimoto
2025-04-09  2:57 ` [PATCH 1/7] ASoC: soc-component: use dapm->component instead of container_of() Kuninori Morimoto
2025-04-09  7:59   ` Cezary Rojewski
2025-04-10  0:19     ` Kuninori Morimoto
2025-04-11  2:04       ` Kuninori Morimoto
2025-04-11  9:07         ` Cezary Rojewski [this message]
2025-04-13 23:39           ` Kuninori Morimoto
2025-04-14  2:01             ` Kuninori Morimoto
2025-04-17  9:34               ` Cezary Rojewski
2025-04-17 23:00                 ` Kuninori Morimoto
2025-04-09  2:57 ` [PATCH 2/7] ASoC: amd: use snd_soc_dapm_to_component() Kuninori Morimoto
2025-04-09  2:57 ` [PATCH 3/7] ASoC: sma1307: " Kuninori Morimoto
2025-04-09  2:57 ` [PATCH 4/7] ASoC: intel: " Kuninori Morimoto
2025-04-09  8:03   ` Cezary Rojewski
2025-04-10  0:20     ` Kuninori Morimoto
2025-04-09  2:57 ` [PATCH 5/7] ASoC: mediatek: " Kuninori Morimoto
2025-04-09  2:57 ` [PATCH 6/7] ASoC: soc-dapm: " Kuninori Morimoto
2025-04-09  2:57 ` [PATCH 7/7] ASoC: soc-topology: " Kuninori Morimoto

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=fefd793a-3625-41a1-9fa1-ddd6cbbf3612@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=Vijendar.Mukunda@amd.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=benjamin.bara@skidata.com \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=kiseok.jo@irondevice.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=yung-chuan.liao@linux.intel.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