ASoC: constify snd_soc_component_driver struct

Declare `snd_soc_component_driver` as const to move it to a read-only
section for the drivers that do not modify the struct after its
declaration.

The affected drivers only pass this struct to
`devm_snd_soc_register_component()`, whose argument is const and
therefore does not modify the content of the struct.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240729-const_snd_soc_component_driver-v2-2-1994f44f1ec2@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Javier Carrasco 2024-07-29 11:37:38 +02:00 committed by Mark Brown
parent 46f2dd5ce5
commit 8adff2ff73
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
11 changed files with 12 additions and 12 deletions

View File

@ -311,7 +311,7 @@ static int au1xpsc_pcm_new(struct snd_soc_component *component,
}
/* au1xpsc audio platform */
static struct snd_soc_component_driver au1xpsc_soc_component = {
static const struct snd_soc_component_driver au1xpsc_soc_component = {
.name = DRV_NAME,
.open = au1xpsc_pcm_open,
.close = au1xpsc_pcm_close,

View File

@ -289,7 +289,7 @@ static int alchemy_pcm_new(struct snd_soc_component *component,
return 0;
}
static struct snd_soc_component_driver alchemy_pcm_soc_component = {
static const struct snd_soc_component_driver alchemy_pcm_soc_component = {
.name = DRV_NAME,
.open = alchemy_pcm_open,
.close = alchemy_pcm_close,

View File

@ -707,7 +707,7 @@ static int cygnus_dma_new(struct snd_soc_component *component,
return 0;
}
static struct snd_soc_component_driver cygnus_soc_platform = {
static const struct snd_soc_component_driver cygnus_soc_platform = {
.open = cygnus_pcm_open,
.close = cygnus_pcm_close,
.prepare = cygnus_pcm_prepare,

View File

@ -1649,7 +1649,7 @@ static int cpcap_soc_probe(struct snd_soc_component *component)
return cpcap_audio_reset(component, false);
}
static struct snd_soc_component_driver soc_codec_dev_cpcap = {
static const struct snd_soc_component_driver soc_codec_dev_cpcap = {
.probe = cpcap_soc_probe,
.controls = cpcap_snd_controls,
.num_controls = ARRAY_SIZE(cpcap_snd_controls),

View File

@ -566,7 +566,7 @@ static int pcm186x_set_bias_level(struct snd_soc_component *component,
return 0;
}
static struct snd_soc_component_driver soc_codec_dev_pcm1863 = {
static const struct snd_soc_component_driver soc_codec_dev_pcm1863 = {
.set_bias_level = pcm186x_set_bias_level,
.controls = pcm1863_snd_controls,
.num_controls = ARRAY_SIZE(pcm1863_snd_controls),
@ -579,7 +579,7 @@ static struct snd_soc_component_driver soc_codec_dev_pcm1863 = {
.endianness = 1,
};
static struct snd_soc_component_driver soc_codec_dev_pcm1865 = {
static const struct snd_soc_component_driver soc_codec_dev_pcm1865 = {
.set_bias_level = pcm186x_set_bias_level,
.controls = pcm1865_snd_controls,
.num_controls = ARRAY_SIZE(pcm1865_snd_controls),

View File

@ -24,7 +24,7 @@ static struct snd_soc_dai_driver pcm5102a_dai = {
},
};
static struct snd_soc_component_driver soc_component_dev_pcm5102a = {
static const struct snd_soc_component_driver soc_component_dev_pcm5102a = {
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,

View File

@ -36,7 +36,7 @@ static const struct snd_soc_dapm_route dir_routes[] = {
SNDRV_PCM_FMTBIT_S32_LE | \
SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)
static struct snd_soc_component_driver soc_codec_spdif_dir = {
static const struct snd_soc_component_driver soc_codec_spdif_dir = {
.dapm_widgets = dir_widgets,
.num_dapm_widgets = ARRAY_SIZE(dir_widgets),
.dapm_routes = dir_routes,

View File

@ -36,7 +36,7 @@ static const struct snd_soc_dapm_route dit_routes[] = {
{ "spdif-out", NULL, "Playback" },
};
static struct snd_soc_component_driver soc_codec_spdif_dit = {
static const struct snd_soc_component_driver soc_codec_spdif_dit = {
.dapm_widgets = dit_widgets,
.num_dapm_widgets = ARRAY_SIZE(dit_widgets),
.dapm_routes = dit_routes,

View File

@ -364,7 +364,7 @@ static int tas6424_set_bias_level(struct snd_soc_component *component,
return 0;
}
static struct snd_soc_component_driver soc_codec_dev_tas6424 = {
static const struct snd_soc_component_driver soc_codec_dev_tas6424 = {
.set_bias_level = tas6424_set_bias_level,
.controls = tas6424_snd_controls,
.num_controls = ARRAY_SIZE(tas6424_snd_controls),

View File

@ -309,7 +309,7 @@ static void stm32_adfsdm_cleanup(void *data)
iio_channel_release_all_cb(data);
}
static struct snd_soc_component_driver stm32_adfsdm_soc_platform = {
static const struct snd_soc_component_driver stm32_adfsdm_soc_platform = {
.open = stm32_adfsdm_pcm_open,
.close = stm32_adfsdm_pcm_close,
.hw_params = stm32_adfsdm_pcm_hw_params,

View File

@ -384,7 +384,7 @@ static int evea_codec_resume(struct snd_soc_component *component)
return ret;
}
static struct snd_soc_component_driver soc_codec_evea = {
static const struct snd_soc_component_driver soc_codec_evea = {
.probe = evea_codec_probe,
.suspend = evea_codec_suspend,
.resume = evea_codec_resume,