Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e35b5ab0 authored by Julia Lawall's avatar Julia Lawall Committed by Linus Walleij
Browse files

gpio: constify gpio_chip structures

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@p = { ... };

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

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

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

Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Acked-by: default avatarJoachim Eastwood <manabian@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 9d99c41a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
			   ARIZONA_GPN_LVL, value);
}

static struct gpio_chip template_chip = {
static const struct gpio_chip template_chip = {
	.label			= "arizona",
	.owner			= THIS_MODULE,
	.direction_input	= arizona_gpio_direction_in,
+1 −1
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ static int bcm_kona_gpio_set_debounce(struct gpio_chip *chip, unsigned gpio,
	return 0;
}

static struct gpio_chip template_chip = {
static const struct gpio_chip template_chip = {
	.label = "bcm-kona-gpio",
	.owner = THIS_MODULE,
	.request = bcm_kona_gpio_request,
+1 −1
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ static int da9052_gpio_to_irq(struct gpio_chip *gc, u32 offset)
	return irq;
}

static struct gpio_chip reference_gp = {
static const struct gpio_chip reference_gp = {
	.label = "da9052-gpio",
	.owner = THIS_MODULE,
	.get = da9052_gpio_get,
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ static int da9055_gpio_to_irq(struct gpio_chip *gc, u32 offset)
				  DA9055_IRQ_GPI0 + offset);
}

static struct gpio_chip reference_gp = {
static const struct gpio_chip reference_gp = {
	.label = "da9055-gpio",
	.owner = THIS_MODULE,
	.get = da9055_gpio_get,
+1 −1
Original line number Diff line number Diff line
@@ -273,7 +273,7 @@ static int it87_gpio_direction_out(struct gpio_chip *chip,
	return rc;
}

static struct gpio_chip it87_template_chip = {
static const struct gpio_chip it87_template_chip = {
	.label			= KBUILD_MODNAME,
	.owner			= THIS_MODULE,
	.request		= it87_gpio_request,
Loading