From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Tim Harvey <tharvey@gateworks.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>, Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
David Rhodes <david.rhodes@cirrus.com>,
Richard Fitzgerald <rf@opensource.cirrus.com>,
Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>,
Baojun Xu <baojun.xu@ti.com>,
Olivier Moysan <olivier.moysan@foss.st.com>,
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-sound@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
alsa-devel@alsa-project.org, patches@opensource.cirrus.com,
linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH 2/2] ASoC: constify snd_soc_component_driver struct
Date: Fri, 26 Jul 2024 11:07:01 +0200 [thread overview]
Message-ID: <1819d604-a879-40a1-8127-5c9265eb8af9@gmail.com> (raw)
In-Reply-To: <ZqNawRmAqBRLIoQq@opensource.cirrus.com>
On 26/07/2024 10:13, Charles Keepax wrote:
> On Thu, Jul 25, 2024 at 12:31:40PM +0200, Javier Carrasco wrote:
>> The instances of the `snd_soc_component_driver` struct are not modified
>> after their declaration, and they are only passed to
>> `devm_snd_soc_register_component()`, which expects a constant
>> `snd_soc_component_driver`.
>>
>> Move all instances of `snd_soc_component_driver` to read-only sections
>> by declaring them const.
>>
>> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
>> ---
>> sound/soc/codecs/cs43130.c | 2 +-
>
>> -static struct snd_soc_component_driver soc_component_dev_cs43130 = {
>> +static const struct snd_soc_component_driver soc_component_dev_cs43130 = {
>> .probe = cs43130_probe,
>> .controls = cs43130_snd_controls,
>> .num_controls = ARRAY_SIZE(cs43130_snd_controls),
>
> This won't work for cs43130, whilst what the driver does is
> clearly slightly sketch it directly modifies this struct before
> registering it with ASoC. That would need fixed first before this
> change can be made.
>
> Thanks,
> Charles
Hi Charles,
thanks a lot for pointing this out, somehow I failed to compile cs43130
and sti-sas, which are the only two cases in the kernel that do modify
snd_soc_component_driver after the declaration. The rest don't do that
and I just double checked that they compile cleanly.
Those two cases where modifications are required rely on values that are
not known until they are probed. I think it makes then sense that they
are left as they are, so I will drop both drivers for v2.
Best regards,
Javier Carrasco
next prev parent reply other threads:[~2024-07-26 9:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-25 10:31 [PATCH 0/2] {ASoC,media}: constify snd_soc_component_driver struct Javier Carrasco
2024-07-25 10:31 ` [PATCH 1/2] media: i2c: tda1997x: " Javier Carrasco
2024-07-25 10:31 ` [PATCH 2/2] ASoC: " Javier Carrasco
2024-07-26 8:13 ` Charles Keepax
2024-07-26 9:07 ` Javier Carrasco [this message]
2024-07-26 9:39 ` kernel test robot
2024-07-26 11:27 ` kernel test robot
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=1819d604-a879-40a1-8127-5c9265eb8af9@gmail.com \
--to=javier.carrasco.cruz@gmail.com \
--cc=alexandre.torgue@foss.st.com \
--cc=alsa-devel@alsa-project.org \
--cc=arnaud.pouliquen@foss.st.com \
--cc=baojun.xu@ti.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=david.rhodes@cirrus.com \
--cc=hayashi.kunihiko@socionext.com \
--cc=kevin-lu@ti.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mchehab@kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=mhiramat@kernel.org \
--cc=olivier.moysan@foss.st.com \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=rf@opensource.cirrus.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=shenghao-ding@ti.com \
--cc=tharvey@gateworks.com \
--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