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: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Julia Lawall 2016-09-11 14:14:37 +02:00 committed by Linus Walleij
parent 9d99c41a12
commit e35b5ab0a7
20 changed files with 20 additions and 20 deletions

View File

@ -79,7 +79,7 @@ static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
ARIZONA_GPN_LVL, value); ARIZONA_GPN_LVL, value);
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "arizona", .label = "arizona",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.direction_input = arizona_gpio_direction_in, .direction_input = arizona_gpio_direction_in,

View File

@ -308,7 +308,7 @@ static int bcm_kona_gpio_set_debounce(struct gpio_chip *chip, unsigned gpio,
return 0; return 0;
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "bcm-kona-gpio", .label = "bcm-kona-gpio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.request = bcm_kona_gpio_request, .request = bcm_kona_gpio_request,

View File

@ -184,7 +184,7 @@ static int da9052_gpio_to_irq(struct gpio_chip *gc, u32 offset)
return irq; return irq;
} }
static struct gpio_chip reference_gp = { static const struct gpio_chip reference_gp = {
.label = "da9052-gpio", .label = "da9052-gpio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get = da9052_gpio_get, .get = da9052_gpio_get,

View File

@ -121,7 +121,7 @@ static int da9055_gpio_to_irq(struct gpio_chip *gc, u32 offset)
DA9055_IRQ_GPI0 + offset); DA9055_IRQ_GPI0 + offset);
} }
static struct gpio_chip reference_gp = { static const struct gpio_chip reference_gp = {
.label = "da9055-gpio", .label = "da9055-gpio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get = da9055_gpio_get, .get = da9055_gpio_get,

View File

@ -273,7 +273,7 @@ exit:
return rc; return rc;
} }
static struct gpio_chip it87_template_chip = { static const struct gpio_chip it87_template_chip = {
.label = KBUILD_MODNAME, .label = KBUILD_MODNAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.request = it87_gpio_request, .request = it87_gpio_request,

View File

@ -124,7 +124,7 @@ static int lp873x_gpio_set_single_ended(struct gpio_chip *gc,
} }
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "lp873x-gpio", .label = "lp873x-gpio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.request = lp873x_gpio_request, .request = lp873x_gpio_request,

View File

@ -78,7 +78,7 @@ static int lpc18xx_gpio_direction_output(struct gpio_chip *chip,
return lpc18xx_gpio_direction(chip, offset, true); return lpc18xx_gpio_direction(chip, offset, true);
} }
static struct gpio_chip lpc18xx_chip = { static const struct gpio_chip lpc18xx_chip = {
.label = "lpc18xx/43xx-gpio", .label = "lpc18xx/43xx-gpio",
.request = gpiochip_generic_request, .request = gpiochip_generic_request,
.free = gpiochip_generic_free, .free = gpiochip_generic_free,

View File

@ -90,7 +90,7 @@ static int pisosr_gpio_get(struct gpio_chip *chip, unsigned offset)
return (gpio->buffer[offset / 8] >> (offset % 8)) & 0x1; return (gpio->buffer[offset / 8] >> (offset % 8)) & 0x1;
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "pisosr-gpio", .label = "pisosr-gpio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get_direction = pisosr_gpio_get_direction, .get_direction = pisosr_gpio_get_direction,

View File

@ -138,7 +138,7 @@ static int sch_gpio_direction_out(struct gpio_chip *gc, unsigned gpio_num,
return 0; return 0;
} }
static struct gpio_chip sch_gpio_chip = { static const struct gpio_chip sch_gpio_chip = {
.label = "sch_gpio", .label = "sch_gpio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.direction_input = sch_gpio_direction_in, .direction_input = sch_gpio_direction_in,

View File

@ -121,7 +121,7 @@ static int stmpe_gpio_request(struct gpio_chip *chip, unsigned offset)
return stmpe_set_altfunc(stmpe, 1 << offset, STMPE_BLOCK_GPIO); return stmpe_set_altfunc(stmpe, 1 << offset, STMPE_BLOCK_GPIO);
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "stmpe", .label = "stmpe",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get_direction = stmpe_gpio_get_direction, .get_direction = stmpe_gpio_get_direction,

View File

@ -124,7 +124,7 @@ static int tc3589x_gpio_single_ended(struct gpio_chip *chip,
return -ENOTSUPP; return -ENOTSUPP;
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "tc3589x", .label = "tc3589x",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.direction_input = tc3589x_gpio_direction_input, .direction_input = tc3589x_gpio_direction_input,

View File

@ -87,7 +87,7 @@ static void tpic2810_set_multiple(struct gpio_chip *chip, unsigned long *mask,
tpic2810_set_mask_bits(chip, *mask, *bits); tpic2810_set_mask_bits(chip, *mask, *bits);
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "tpic2810", .label = "tpic2810",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get_direction = tpic2810_get_direction, .get_direction = tpic2810_get_direction,

View File

@ -72,7 +72,7 @@ static void tps65086_gpio_set(struct gpio_chip *chip, unsigned offset,
BIT(4 + offset), value ? BIT(4 + offset) : 0); BIT(4 + offset), value ? BIT(4 + offset) : 0);
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "tps65086-gpio", .label = "tps65086-gpio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get_direction = tps65086_gpio_get_direction, .get_direction = tps65086_gpio_get_direction,

View File

@ -172,7 +172,7 @@ static int tps65218_gpio_set_single_ended(struct gpio_chip *gc,
return -ENOTSUPP; return -ENOTSUPP;
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "gpio-tps65218", .label = "gpio-tps65218",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.request = tps65218_gpio_request, .request = tps65218_gpio_request,

View File

@ -90,7 +90,7 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,
GPIO_SET_MASK, value ? GPIO_SET_MASK : 0); GPIO_SET_MASK, value ? GPIO_SET_MASK : 0);
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "tps65912-gpio", .label = "tps65912-gpio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get_direction = tps65912_gpio_get_direction, .get_direction = tps65912_gpio_get_direction,

View File

@ -101,7 +101,7 @@ static const struct regmap_config ts4900_regmap_config = {
.val_bits = 8, .val_bits = 8,
}; };
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "ts4900-gpio", .label = "ts4900-gpio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get_direction = ts4900_gpio_get_direction, .get_direction = ts4900_gpio_get_direction,

View File

@ -381,7 +381,7 @@ static int twl_to_irq(struct gpio_chip *chip, unsigned offset)
: -EINVAL; : -EINVAL;
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "twl4030", .label = "twl4030",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.request = twl_request, .request = twl_request,

View File

@ -247,7 +247,7 @@ static void wm831x_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
#define wm831x_gpio_dbg_show NULL #define wm831x_gpio_dbg_show NULL
#endif #endif
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "wm831x", .label = "wm831x",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.direction_input = wm831x_gpio_direction_in, .direction_input = wm831x_gpio_direction_in,

View File

@ -93,7 +93,7 @@ static int wm8350_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
return wm8350->irq_base + WM8350_IRQ_GPIO(offset); return wm8350->irq_base + WM8350_IRQ_GPIO(offset);
} }
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "wm8350", .label = "wm8350",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.direction_input = wm8350_gpio_direction_in, .direction_input = wm8350_gpio_direction_in,

View File

@ -249,7 +249,7 @@ static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
#define wm8994_gpio_dbg_show NULL #define wm8994_gpio_dbg_show NULL
#endif #endif
static struct gpio_chip template_chip = { static const struct gpio_chip template_chip = {
.label = "wm8994", .label = "wm8994",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.request = wm8994_gpio_request, .request = wm8994_gpio_request,