Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Javier Carrasco and committed by
Mark Brown
8adff2ff 46f2dd5c

+12 -12
+1 -1
sound/soc/au1x/dbdma2.c
··· 311 311 } 312 312 313 313 /* au1xpsc audio platform */ 314 - static struct snd_soc_component_driver au1xpsc_soc_component = { 314 + static const struct snd_soc_component_driver au1xpsc_soc_component = { 315 315 .name = DRV_NAME, 316 316 .open = au1xpsc_pcm_open, 317 317 .close = au1xpsc_pcm_close,
+1 -1
sound/soc/au1x/dma.c
··· 289 289 return 0; 290 290 } 291 291 292 - static struct snd_soc_component_driver alchemy_pcm_soc_component = { 292 + static const struct snd_soc_component_driver alchemy_pcm_soc_component = { 293 293 .name = DRV_NAME, 294 294 .open = alchemy_pcm_open, 295 295 .close = alchemy_pcm_close,
+1 -1
sound/soc/bcm/cygnus-pcm.c
··· 707 707 return 0; 708 708 } 709 709 710 - static struct snd_soc_component_driver cygnus_soc_platform = { 710 + static const struct snd_soc_component_driver cygnus_soc_platform = { 711 711 .open = cygnus_pcm_open, 712 712 .close = cygnus_pcm_close, 713 713 .prepare = cygnus_pcm_prepare,
+1 -1
sound/soc/codecs/cpcap.c
··· 1649 1649 return cpcap_audio_reset(component, false); 1650 1650 } 1651 1651 1652 - static struct snd_soc_component_driver soc_codec_dev_cpcap = { 1652 + static const struct snd_soc_component_driver soc_codec_dev_cpcap = { 1653 1653 .probe = cpcap_soc_probe, 1654 1654 .controls = cpcap_snd_controls, 1655 1655 .num_controls = ARRAY_SIZE(cpcap_snd_controls),
+2 -2
sound/soc/codecs/pcm186x.c
··· 566 566 return 0; 567 567 } 568 568 569 - static struct snd_soc_component_driver soc_codec_dev_pcm1863 = { 569 + static const struct snd_soc_component_driver soc_codec_dev_pcm1863 = { 570 570 .set_bias_level = pcm186x_set_bias_level, 571 571 .controls = pcm1863_snd_controls, 572 572 .num_controls = ARRAY_SIZE(pcm1863_snd_controls), ··· 579 579 .endianness = 1, 580 580 }; 581 581 582 - static struct snd_soc_component_driver soc_codec_dev_pcm1865 = { 582 + static const struct snd_soc_component_driver soc_codec_dev_pcm1865 = { 583 583 .set_bias_level = pcm186x_set_bias_level, 584 584 .controls = pcm1865_snd_controls, 585 585 .num_controls = ARRAY_SIZE(pcm1865_snd_controls),
+1 -1
sound/soc/codecs/pcm5102a.c
··· 24 24 }, 25 25 }; 26 26 27 - static struct snd_soc_component_driver soc_component_dev_pcm5102a = { 27 + static const struct snd_soc_component_driver soc_component_dev_pcm5102a = { 28 28 .idle_bias_on = 1, 29 29 .use_pmdown_time = 1, 30 30 .endianness = 1,
+1 -1
sound/soc/codecs/spdif_receiver.c
··· 36 36 SNDRV_PCM_FMTBIT_S32_LE | \ 37 37 SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE) 38 38 39 - static struct snd_soc_component_driver soc_codec_spdif_dir = { 39 + static const struct snd_soc_component_driver soc_codec_spdif_dir = { 40 40 .dapm_widgets = dir_widgets, 41 41 .num_dapm_widgets = ARRAY_SIZE(dir_widgets), 42 42 .dapm_routes = dir_routes,
+1 -1
sound/soc/codecs/spdif_transmitter.c
··· 36 36 { "spdif-out", NULL, "Playback" }, 37 37 }; 38 38 39 - static struct snd_soc_component_driver soc_codec_spdif_dit = { 39 + static const struct snd_soc_component_driver soc_codec_spdif_dit = { 40 40 .dapm_widgets = dit_widgets, 41 41 .num_dapm_widgets = ARRAY_SIZE(dit_widgets), 42 42 .dapm_routes = dit_routes,
+1 -1
sound/soc/codecs/tas6424.c
··· 364 364 return 0; 365 365 } 366 366 367 - static struct snd_soc_component_driver soc_codec_dev_tas6424 = { 367 + static const struct snd_soc_component_driver soc_codec_dev_tas6424 = { 368 368 .set_bias_level = tas6424_set_bias_level, 369 369 .controls = tas6424_snd_controls, 370 370 .num_controls = ARRAY_SIZE(tas6424_snd_controls),
+1 -1
sound/soc/stm/stm32_adfsdm.c
··· 309 309 iio_channel_release_all_cb(data); 310 310 } 311 311 312 - static struct snd_soc_component_driver stm32_adfsdm_soc_platform = { 312 + static const struct snd_soc_component_driver stm32_adfsdm_soc_platform = { 313 313 .open = stm32_adfsdm_pcm_open, 314 314 .close = stm32_adfsdm_pcm_close, 315 315 .hw_params = stm32_adfsdm_pcm_hw_params,
+1 -1
sound/soc/uniphier/evea.c
··· 384 384 return ret; 385 385 } 386 386 387 - static struct snd_soc_component_driver soc_codec_evea = { 387 + static const struct snd_soc_component_driver soc_codec_evea = { 388 388 .probe = evea_codec_probe, 389 389 .suspend = evea_codec_suspend, 390 390 .resume = evea_codec_resume,