]> git.karo-electronics.de Git - karo-tx-linux.git/commit
pinctrl: ns2: constify pinctrl_ops and pinmux_ops structures
authorJulia Lawall <Julia.Lawall@lip6.fr>
Thu, 1 Sep 2016 18:42:19 +0000 (20:42 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 7 Sep 2016 20:39:44 +0000 (22:39 +0200)
commitf3b4b7c48e5998af8c009821c7dbb2137db33b35
tree2762fc6a74cc961b506b2b33f980960cf7e7e9c6
parent499c7196dd182ba513ccb9620ee22aed3f9096fd
pinctrl: ns2: constify pinctrl_ops and pinmux_ops structures

Check for pinctrl_ops and pinmux_ops structures that are only stored in the
pctlops field and the pmxops field, respectively, of a pinctrl_desc
structure.  These fields are declared const, so pinctrl_ops and pinmux_ops
structures that have this property can be declared as const also.

The semantic patch that makes this change in the pinctrl_ops is as
follows.  The pinmux_ops case is similar.  (http://coccinelle.lip6.fr/)

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

@ok@
identifier r.i;
struct pinctrl_desc e;
position p;
@@
e.pctlops = &i@p;

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

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

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/bcm/pinctrl-ns2-mux.c