Thread (7 messages) 7 messages, 3 authors, 2024-07-26

Re: [PATCH 2/2] ASoC: constify snd_soc_component_driver struct

From: Charles Keepax <ckeepax@opensource.cirrus.com>
Date: 2024-07-26 08:14:42
Also in: alsa-devel, linux-media, linux-sound, lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help