]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: constify snd_soc_component_driver struct
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Mon, 29 Jul 2024 09:37:38 +0000 (11:37 +0200)
committerMark Brown <broonie@kernel.org>
Sun, 29 Sep 2024 23:10:48 +0000 (01:10 +0200)
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>
sound/soc/au1x/dbdma2.c
sound/soc/au1x/dma.c
sound/soc/bcm/cygnus-pcm.c
sound/soc/codecs/cpcap.c
sound/soc/codecs/pcm186x.c
sound/soc/codecs/pcm5102a.c
sound/soc/codecs/spdif_receiver.c
sound/soc/codecs/spdif_transmitter.c
sound/soc/codecs/tas6424.c
sound/soc/stm/stm32_adfsdm.c
sound/soc/uniphier/evea.c

index ea01d6490cec0b671de1f36bc926242870842ce4..3392693faeb93245b895a6abd82038e9e021e4dd 100644 (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,
index d2fdebd8881bbc4c3137c00aacd0bda2d158bdc9..c9c2b1e71d55c0bdb6a2892bc3beffa27a1b431f 100644 (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,
index 2d1e241d836736212b869ea2bb878decae0d5c9e..4cb2fe10bcdc106534e49087943c2e208cbb2349 100644 (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,
index 4f9dabd9d78a671cf2bcc48c1b65285388c68a3b..04304a7ad9153d1fb68185031f3ab0b091d4e905 100644 (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),
index 451a8fd8fac5065d3ea72d6673a4a2fac4529da4..13443f569ddb4d33f034c689900773ec6e99f41c 100644 (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),
index 3401a25341e616e74769c5668a13dfe97fab29e8..9bca53de2475f08fa7fe08ede68c4622d9b54695 100644 (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,
index 310123d2bb5fb90c54f200336637c4d60ea9f0d1..c9766979b1d7e2e5e790b027746313249e68783c 100644 (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,
index db51a46e689dffadbbb8e274f617e12f6ffa354f..2409fd834f8427901340a7bc0ede4885798727f6 100644 (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,
index bb0500e9d3eacf888cd049b947f54fbd0c54cc27..9be054837f68eb3aa64a9037e89a9e966d34b155 100644 (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),
index 9351727dce1acde1705b62caf1f509630664ffa4..78bd817af839e382bf67a217574d30a62ff2ed13 100644 (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,
index 662e45882c90d69a1c7139d9b872944dfaf689ef..f6c6eb95262a4206838626413a01bca5a3ffe912 100644 (file)
@@ -384,7 +384,7 @@ err_out_clock:
        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,