From f802d6c020658b5dce1732da0d5999a1a65afdd6 Mon Sep 17 00:00:00 2001
From: Julia Lawall
Date: Wed, 31 Aug 2016 23:52:27 +0200
Subject: 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/)
//
@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 = { ... };
//
Signed-off-by: Julia Lawall
Acked-by: Charles Keepax
Signed-off-by: Mark Brown
---
sound/soc/codecs/wm8750.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'sound/soc/codecs/wm8750.c')
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index a96a1456897b..0da2bbaf06d1 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -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,
--
cgit v1.2.3-55-g7522