Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a180ba45 authored by Bhumika Goyal's avatar Bhumika Goyal Committed by Mark Brown
Browse files

ASoC: codecs: add const to snd_soc_codec_driver structures



Declare snd_soc_codec_driver structures as const as they are only passed
as an argument to the function snd_soc_register_codec. This argument is
of type const, so declare the structures with this property as const.
In file codecs/sn95031.c, snd_soc_codec_driver structure is also used in
a copy operation along with getting passed to snd_soc_register_codec.
So, it can be made const too.
Done using Coccinelle:

@match disable optional_qualifier@
identifier s;
position p;
@@
static struct snd_soc_codec_driver s@p={...};

@good1@
identifier match.s;
position p;
@@
snd_soc_register_codec(...,&s@p,...)

@bad@
identifier match.s;
position p!={match.p,good1.p};
@@
s@p

@depends on !bad disable optional_qualifier@
identifier match.s;
@@
static
+const
struct snd_soc_codec_driver s={...};

Signed-off-by: default avatarBhumika Goyal <bhumirks@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5a36aedb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1355,7 +1355,7 @@ static struct regmap *pm860x_get_regmap(struct device *dev)
	return pm860x->regmap;
}

static struct snd_soc_codec_driver soc_codec_dev_pm860x = {
static const struct snd_soc_codec_driver soc_codec_dev_pm860x = {
	.probe		= pm860x_probe,
	.remove		= pm860x_remove,
	.set_bias_level	= pm860x_set_bias_level,
+1 −1
Original line number Diff line number Diff line
@@ -2523,7 +2523,7 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
	return status;
}

static struct snd_soc_codec_driver ab8500_codec_driver = {
static const struct snd_soc_codec_driver ab8500_codec_driver = {
	.probe =		ab8500_codec_probe,
	.component_driver = {
		.controls =		ab8500_ctrls,
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ static int ac97_soc_resume(struct snd_soc_codec *codec)
#define ac97_soc_resume NULL
#endif

static struct snd_soc_codec_driver soc_codec_dev_ac97 = {
static const struct snd_soc_codec_driver soc_codec_dev_ac97 = {
	.probe = 	ac97_soc_probe,
	.suspend =	ac97_soc_suspend,
	.resume =	ac97_soc_resume,
+1 −1
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@ static int ad1836_remove(struct snd_soc_codec *codec)
		AD1836_ADC_SERFMT_MASK, 0);
}

static struct snd_soc_codec_driver soc_codec_dev_ad1836 = {
static const struct snd_soc_codec_driver soc_codec_dev_ad1836 = {
	.probe = ad1836_probe,
	.remove = ad1836_remove,
	.suspend = ad1836_suspend,
+1 −1
Original line number Diff line number Diff line
@@ -408,7 +408,7 @@ static int ad193x_codec_probe(struct snd_soc_codec *codec)
	return 0;
}

static struct snd_soc_codec_driver soc_codec_dev_ad193x = {
static const struct snd_soc_codec_driver soc_codec_dev_ad193x = {
	.probe = ad193x_codec_probe,
	.component_driver = {
		.controls		= ad193x_snd_controls,
Loading