diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2016-09-01 14:42:20 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-09-07 16:40:40 -0400 |
commit | c87da270c11fcf995fb0bc7248e446821b32f573 (patch) | |
tree | fdd37e0501e9bcd9afaf83bc3c300c6e0cfd7d58 | |
parent | f3b4b7c48e5998af8c009821c7dbb2137db33b35 (diff) |
pinctrl: nsp: 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-nsp-mux.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c index 4149db309c8b..35c17653c694 100644 --- a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c +++ b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c | |||
@@ -348,7 +348,7 @@ static void nsp_pin_dbg_show(struct pinctrl_dev *pctrl_dev, | |||
348 | seq_printf(s, " %s", dev_name(pctrl_dev->dev)); | 348 | seq_printf(s, " %s", dev_name(pctrl_dev->dev)); |
349 | } | 349 | } |
350 | 350 | ||
351 | static struct pinctrl_ops nsp_pinctrl_ops = { | 351 | static const struct pinctrl_ops nsp_pinctrl_ops = { |
352 | .get_groups_count = nsp_get_groups_count, | 352 | .get_groups_count = nsp_get_groups_count, |
353 | .get_group_name = nsp_get_group_name, | 353 | .get_group_name = nsp_get_group_name, |
354 | .get_group_pins = nsp_get_group_pins, | 354 | .get_group_pins = nsp_get_group_pins, |
@@ -518,7 +518,7 @@ static void nsp_gpio_disable_free(struct pinctrl_dev *pctrl_dev, | |||
518 | spin_unlock_irqrestore(&pinctrl->lock, flags); | 518 | spin_unlock_irqrestore(&pinctrl->lock, flags); |
519 | } | 519 | } |
520 | 520 | ||
521 | static struct pinmux_ops nsp_pinmux_ops = { | 521 | static const struct pinmux_ops nsp_pinmux_ops = { |
522 | .get_functions_count = nsp_get_functions_count, | 522 | .get_functions_count = nsp_get_functions_count, |
523 | .get_function_name = nsp_get_function_name, | 523 | .get_function_name = nsp_get_function_name, |
524 | .get_function_groups = nsp_get_function_groups, | 524 | .get_function_groups = nsp_get_function_groups, |