From: "Trevor Wu (吳文良)" <Trevor.Wu@mediatek.com>
To: "pierre-louis.bossart@linux.intel.com"
<pierre-louis.bossart@linux.intel.com>,
"broonie@kernel.org" <broonie@kernel.org>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Cc: "linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"YC Hung (洪堯俊)" <yc.hung@mediatek.com>,
"kai.vehmanen@linux.intel.com" <kai.vehmanen@linux.intel.com>,
"tiwai@suse.com" <tiwai@suse.com>,
"ranjani.sridharan@linux.intel.com"
<ranjani.sridharan@linux.intel.com>,
"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"yung-chuan.liao@linux.intel.com"
<yung-chuan.liao@linux.intel.com>,
"daniel.baluta@nxp.com" <daniel.baluta@nxp.com>,
"peter.ujfalusi@linux.intel.com" <peter.ujfalusi@linux.intel.com>,
"perex@perex.cz" <perex@perex.cz>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"TingHan Shen (沈廷翰)" <TingHan.Shen@mediatek.com>,
"sound-open-firmware@alsa-project.org"
<sound-open-firmware@alsa-project.org>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: [PATCH 1/2] ASoC: SOF: mediatek: add mt8188 audio support
Date: Tue, 16 May 2023 03:34:55 +0000 [thread overview]
Message-ID: <3dd728e8ca50e54b475afec1b70569548f2bee94.camel@mediatek.com> (raw)
In-Reply-To: <8f57c62f-c427-f5df-d517-d4025fe7c65d@linux.intel.com>
On Mon, 2023-05-15 at 10:28 -0500, Pierre-Louis Bossart wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> On 5/15/23 10:05, Mark Brown wrote:
> > On Mon, May 15, 2023 at 01:25:44PM +0200, AngeloGioacchino Del
> > Regno wrote:
> > > Il 15/05/23 07:25, Trevor Wu ha scritto:
> > > > +{
> > > > + /* common defaults */
> > > > + memcpy(&sof_mt8188_ops, &sof_mt8186_ops, sizeof(struct
> > > > snd_sof_dsp_ops));
> > >
> > > Never use sizeof(type), always use destination var size! Anyway,
> > > there's more.
OK, I will use sizeof(sof_mt8188_ops) instead.
> > >
> > > I don't think we need to perform this memcpy: we'll never see an
> > > instance of
> > > both mt8186 and mt8188 drivers on the same machine, so you can
> > > safely just use
> > > sof_mt8186_ops for mt8188...
> > > > + sof_mt8188_ops.drv = mt8188_dai;
> > >
> > > ...which obviously means that this becomes
> > > sof_mt8186_ops.drv = mt8188_dai;
> >
> > This does have the issue that it then means the ops struct isn't
> > const
> > which isn't ideal. It's also not the end of the world though so I
> > don't
> > have super strong feelings.
>
> We do the same for Intel devices, we have a common structure which is
> copied and only the members that differ in specific SOCs are updated.
> You're right that it's not constant, but it avoids copy-paste of a
> rather large structure just to change a couple of lines.
Currently, I prefer to follow the same implementation as Intel devices.
It's easier to see a different ops exists for mt8188 in
sof_of_mt8188_desc and it really avoids copy-paste of a large
structure.
Additionally, I found a typo in the next line.
sof_mt8186_ops.num_drv = ARRAY_SIZE(mt8188_dai);
^
This should be sof_mt8188_ops. I will correct it in V2.
Thanks,
Trevor
next prev parent reply other threads:[~2023-05-16 3:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-15 5:25 [PATCH 0/2] ASoC: SOF: add mt8188 audio support Trevor Wu
2023-05-15 5:25 ` [PATCH 1/2] ASoC: SOF: mediatek: " Trevor Wu
2023-05-15 11:25 ` AngeloGioacchino Del Regno
2023-05-15 15:05 ` Mark Brown
2023-05-15 15:28 ` Pierre-Louis Bossart
2023-05-16 3:34 ` Trevor Wu (吳文良) [this message]
2023-06-01 1:38 ` Trevor Wu (吳文良)
2023-05-15 5:25 ` [PATCH 2/2] ASoC: SOF: mediatek: add adsp debug dump Trevor Wu
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=3dd728e8ca50e54b475afec1b70569548f2bee94.camel@mediatek.com \
--to=trevor.wu@mediatek.com \
--cc=TingHan.Shen@mediatek.com \
--cc=alsa-devel@alsa-project.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=tiwai@suse.com \
--cc=yc.hung@mediatek.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;
as well as URLs for NNTP newsgroup(s).