Thread (8 messages) flat view 8 messages, 3 authors, 2016-09-13

[PATCH 1/6] gpio: constify gpio_chip structures

From: Joachim Eastwood <hidden>
Date: 2016-09-11 13:31:41
Also in: kernel-janitors, linux-gpio, lkml

Hi Julia,

On 11 September 2016 at 14:14, Julia Lawall [off-list ref] wrote:
quoted hunk ↗ jump to hunk
These structures are only used to copy into other structures, so declare
them as const.

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 gpio_chip i at p = { ... };

@ok@
identifier r.i;
expression e;
position p;
@@
e = i at p;

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

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

Signed-off-by: Julia Lawall <redacted>

---
 drivers/gpio/gpio-arizona.c  |    2 +-
 drivers/gpio/gpio-bcm-kona.c |    2 +-
 drivers/gpio/gpio-da9052.c   |    2 +-
 drivers/gpio/gpio-da9055.c   |    2 +-
 drivers/gpio/gpio-it87.c     |    2 +-
 drivers/gpio/gpio-lp873x.c   |    2 +-
 drivers/gpio/gpio-lpc18xx.c  |    2 +-
 drivers/gpio/gpio-pisosr.c   |    2 +-
 drivers/gpio/gpio-sch.c      |    2 +-
 drivers/gpio/gpio-stmpe.c    |    2 +-
 drivers/gpio/gpio-tc3589x.c  |    2 +-
 drivers/gpio/gpio-tpic2810.c |    2 +-
 drivers/gpio/gpio-tps65086.c |    2 +-
 drivers/gpio/gpio-tps65218.c |    2 +-
 drivers/gpio/gpio-tps65912.c |    2 +-
 drivers/gpio/gpio-ts4900.c   |    2 +-
 drivers/gpio/gpio-twl4030.c  |    2 +-
 drivers/gpio/gpio-wm831x.c   |    2 +-
 drivers/gpio/gpio-wm8350.c   |    2 +-
 drivers/gpio/gpio-wm8994.c   |    2 +-
 20 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/gpio/gpio-lpc18xx.c b/drivers/gpio/gpio-lpc18xx.c
index 98832c9..f12e02e 100644
--- a/drivers/gpio/gpio-lpc18xx.c
+++ b/drivers/gpio/gpio-lpc18xx.c
@@ -78,7 +78,7 @@ static int lpc18xx_gpio_direction_output(struct gpio_chip *chip,
        return lpc18xx_gpio_direction(chip, offset, true);
 }

-static struct gpio_chip lpc18xx_chip = {
+static const struct gpio_chip lpc18xx_chip = {
        .label                  = "lpc18xx/43xx-gpio",
        .request                = gpiochip_generic_request,
        .free                   = gpiochip_generic_free,
For lpc18xx:
Acked-by: Joachim Eastwood <redacted>


regards,
Joachim Eastwood
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help