ASoC: constify snd_soc_codec_driver structures

Check for snd_soc_codec_driver structures that are only passed to
snd_soc_register_codec or memcpy (2nd arg), for which the corresponding
parameters are declared const.  Declare as const snd_soc_codec_driver
structures that have these properties.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_soc_codec_driver i@p = { ... };

@ok@
identifier r.i;
expression e1,e2,e3;
position p;
@@
(
snd_soc_register_codec(e1,&i@p,e2,e3)
|
memcpy(e1,&i@p,e2)
)

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct snd_soc_codec_driver i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Julia Lawall
2016-08-31 23:52:27 +02:00
committed by Mark Brown
parent 2c452dd8af
commit f802d6c020
48 changed files with 48 additions and 48 deletions
+1 -1
View File
@@ -789,7 +789,7 @@ static int wm0010_set_sysclk(struct snd_soc_codec *codec, int source,
static int wm0010_probe(struct snd_soc_codec *codec);
static struct snd_soc_codec_driver soc_codec_dev_wm0010 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm0010 = {
.probe = wm0010_probe,
.set_bias_level = wm0010_set_bias_level,
.set_sysclk = wm0010_set_sysclk,
+1 -1
View File
@@ -141,7 +141,7 @@ static struct snd_soc_dai_driver wm1250_ev1_dai = {
.ops = &wm1250_ev1_ops,
};
static struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1 = {
.component_driver = {
.dapm_widgets = wm1250_ev1_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm1250_ev1_dapm_widgets),
+1 -1
View File
@@ -799,7 +799,7 @@ static int wm2000_remove(struct snd_soc_codec *codec)
return wm2000_anc_transition(wm2000, ANC_OFF);
}
static struct snd_soc_codec_driver soc_codec_dev_wm2000 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm2000 = {
.probe = wm2000_probe,
.remove = wm2000_remove,
.suspend = wm2000_suspend,
+1 -1
View File
@@ -2103,7 +2103,7 @@ static struct snd_soc_dai_driver wm2200_dai = {
.ops = &wm2200_dai_ops,
};
static struct snd_soc_codec_driver soc_codec_wm2200 = {
static const struct snd_soc_codec_driver soc_codec_wm2200 = {
.probe = wm2200_probe,
.idle_bias_off = true,
+1 -1
View File
@@ -2381,7 +2381,7 @@ static int wm5100_remove(struct snd_soc_codec *codec)
return 0;
}
static struct snd_soc_codec_driver soc_codec_dev_wm5100 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm5100 = {
.probe = wm5100_probe,
.remove = wm5100_remove,
+1 -1
View File
@@ -1990,7 +1990,7 @@ static struct regmap *wm5102_get_regmap(struct device *dev)
return priv->core.arizona->regmap;
}
static struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
.probe = wm5102_codec_probe,
.remove = wm5102_codec_remove,
.get_regmap = wm5102_get_regmap,
+1 -1
View File
@@ -2347,7 +2347,7 @@ static struct regmap *wm5110_get_regmap(struct device *dev)
return priv->core.arizona->regmap;
}
static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
.probe = wm5110_codec_probe,
.remove = wm5110_codec_remove,
.get_regmap = wm5110_get_regmap,
+1 -1
View File
@@ -1587,7 +1587,7 @@ static struct regmap *wm8350_get_regmap(struct device *dev)
return wm8350->regmap;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8350 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8350 = {
.probe = wm8350_codec_probe,
.remove = wm8350_codec_remove,
.get_regmap = wm8350_get_regmap,
+1 -1
View File
@@ -1332,7 +1332,7 @@ static struct regmap *wm8400_get_regmap(struct device *dev)
return wm8400->regmap;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
.probe = wm8400_codec_probe,
.remove = wm8400_codec_remove,
.get_regmap = wm8400_get_regmap,
+1 -1
View File
@@ -581,7 +581,7 @@ static int wm8510_probe(struct snd_soc_codec *codec)
return 0;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8510 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8510 = {
.probe = wm8510_probe,
.set_bias_level = wm8510_set_bias_level,
.suspend_bias_off = true,
+1 -1
View File
@@ -413,7 +413,7 @@ static int wm8523_probe(struct snd_soc_codec *codec)
return 0;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8523 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8523 = {
.probe = wm8523_probe,
.set_bias_level = wm8523_set_bias_level,
.suspend_bias_off = true,
+1 -1
View File
@@ -899,7 +899,7 @@ static int wm8580_remove(struct snd_soc_codec *codec)
return 0;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8580 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8580 = {
.probe = wm8580_probe,
.remove = wm8580_remove,
.set_bias_level = wm8580_set_bias_level,
+1 -1
View File
@@ -367,7 +367,7 @@ static int wm8711_probe(struct snd_soc_codec *codec)
}
static struct snd_soc_codec_driver soc_codec_dev_wm8711 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8711 = {
.probe = wm8711_probe,
.set_bias_level = wm8711_set_bias_level,
.suspend_bias_off = true,
+1 -1
View File
@@ -53,7 +53,7 @@ static struct snd_soc_dai_driver wm8727_dai = {
},
};
static struct snd_soc_codec_driver soc_codec_dev_wm8727 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8727 = {
.component_driver = {
.dapm_widgets = wm8727_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8727_dapm_widgets),
+1 -1
View File
@@ -211,7 +211,7 @@ static struct snd_soc_dai_driver wm8728_dai = {
.ops = &wm8728_dai_ops,
};
static struct snd_soc_codec_driver soc_codec_dev_wm8728 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8728 = {
.set_bias_level = wm8728_set_bias_level,
.suspend_bias_off = true,
+1 -1
View File
@@ -628,7 +628,7 @@ err_regulator_enable:
return ret;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8731 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8731 = {
.set_bias_level = wm8731_set_bias_level,
.suspend_bias_off = true,
+1 -1
View File
@@ -573,7 +573,7 @@ err_get:
return ret;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8737 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8737 = {
.probe = wm8737_probe,
.set_bias_level = wm8737_set_bias_level,
.suspend_bias_off = true,
+1 -1
View File
@@ -497,7 +497,7 @@ static int wm8741_remove(struct snd_soc_codec *codec)
return 0;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8741 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8741 = {
.probe = wm8741_probe,
.remove = wm8741_remove,
.resume = wm8741_resume,
+1 -1
View File
@@ -708,7 +708,7 @@ static int wm8750_probe(struct snd_soc_codec *codec)
return ret;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8750 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8750 = {
.probe = wm8750_probe,
.set_bias_level = wm8750_set_bias_level,
.suspend_bias_off = true,
+1 -1
View File
@@ -1478,7 +1478,7 @@ static int wm8753_probe(struct snd_soc_codec *codec)
return 0;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8753 = {
static const struct snd_soc_codec_driver soc_codec_dev_wm8753 = {
.probe = wm8753_probe,
.resume = wm8753_resume,
.set_bias_level = wm8753_set_bias_level,

Some files were not shown because too many files have changed in this diff Show More