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

Commit f802d6c0 authored by Julia Lawall's avatar Julia Lawall Committed by Mark Brown
Browse files

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: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2c452dd8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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,

Loading