Skip to content

Commit 3f50bb3

Browse files
MrVanBartosz Golaszewski
authored andcommitted
gpio: davinci: Make irq_chip immutable
Kernel warns about mutable irq_chips: "not an immutable chip, please consider fixing!" Constify gpio_irqchip, flag the irq_chip as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 62be72b commit 3f50bb3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/gpio/gpio-davinci.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ static void gpio_irq_mask(struct irq_data *d)
253253

254254
writel_relaxed(mask, &g->clr_falling);
255255
writel_relaxed(mask, &g->clr_rising);
256+
257+
gpiochip_disable_irq(&chips->chip, hwirq);
256258
}
257259

258260
static void gpio_irq_unmask(struct irq_data *d)
@@ -263,6 +265,8 @@ static void gpio_irq_unmask(struct irq_data *d)
263265
uintptr_t mask = (uintptr_t)irq_data_get_irq_handler_data(d);
264266
unsigned status = irqd_get_trigger_type(d);
265267

268+
gpiochip_enable_irq(&chips->chip, hwirq);
269+
266270
status &= IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
267271
if (!status)
268272
status = IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
@@ -281,12 +285,13 @@ static int gpio_irq_type(struct irq_data *d, unsigned trigger)
281285
return 0;
282286
}
283287

284-
static struct irq_chip gpio_irqchip = {
288+
static const struct irq_chip gpio_irqchip = {
285289
.name = "GPIO",
286290
.irq_unmask = gpio_irq_unmask,
287291
.irq_mask = gpio_irq_mask,
288292
.irq_set_type = gpio_irq_type,
289-
.flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_SKIP_SET_WAKE,
293+
.flags = IRQCHIP_IMMUTABLE | IRQCHIP_SET_TYPE_MASKED | IRQCHIP_SKIP_SET_WAKE,
294+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
290295
};
291296

292297
static void gpio_irq_handler(struct irq_desc *desc)

0 commit comments

Comments
 (0)