diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2016-09-01 14:42:21 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-09-07 16:41:30 -0400 |
commit | 5fe2501fbf8d21d57fef2eb0a54d50f5a0c6f4c4 (patch) | |
tree | ca2d4e54b7f19523767badd4b190eef611b8d7be | |
parent | c87da270c11fcf995fb0bc7248e446821b32f573 (diff) |
pinctrl: bcm281xx: 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>
-rw-r--r-- | drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c index 582f6df446e8..a5331fdfc795 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c | |||
@@ -1018,7 +1018,7 @@ static void bcm281xx_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev, | |||
1018 | seq_printf(s, " %s", dev_name(pctldev->dev)); | 1018 | seq_printf(s, " %s", dev_name(pctldev->dev)); |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | static struct pinctrl_ops bcm281xx_pinctrl_ops = { | 1021 | static const struct pinctrl_ops bcm281xx_pinctrl_ops = { |
1022 | .get_groups_count = bcm281xx_pinctrl_get_groups_count, | 1022 | .get_groups_count = bcm281xx_pinctrl_get_groups_count, |
1023 | .get_group_name = bcm281xx_pinctrl_get_group_name, | 1023 | .get_group_name = bcm281xx_pinctrl_get_group_name, |
1024 | .get_group_pins = bcm281xx_pinctrl_get_group_pins, | 1024 | .get_group_pins = bcm281xx_pinctrl_get_group_pins, |
@@ -1080,7 +1080,7 @@ static int bcm281xx_pinmux_set(struct pinctrl_dev *pctldev, | |||
1080 | return rc; | 1080 | return rc; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | static struct pinmux_ops bcm281xx_pinctrl_pinmux_ops = { | 1083 | static const struct pinmux_ops bcm281xx_pinctrl_pinmux_ops = { |
1084 | .get_functions_count = bcm281xx_pinctrl_get_fcns_count, | 1084 | .get_functions_count = bcm281xx_pinctrl_get_fcns_count, |
1085 | .get_function_name = bcm281xx_pinctrl_get_fcn_name, | 1085 | .get_function_name = bcm281xx_pinctrl_get_fcn_name, |
1086 | .get_function_groups = bcm281xx_pinctrl_get_fcn_groups, | 1086 | .get_function_groups = bcm281xx_pinctrl_get_fcn_groups, |