Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: stmpe: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Linus Walleij and committed by
Bartosz Golaszewski
32585b56 5ff8240e

+6 -2
+6 -2
drivers/gpio/gpio-stmpe.c
··· 234 234 int mask = BIT(offset % 8); 235 235 236 236 stmpe_gpio->regs[REG_IE][regoffset] &= ~mask; 237 + gpiochip_disable_irq(gc, offset); 237 238 } 238 239 239 240 static void stmpe_gpio_irq_unmask(struct irq_data *d) ··· 245 244 int regoffset = offset / 8; 246 245 int mask = BIT(offset % 8); 247 246 247 + gpiochip_enable_irq(gc, offset); 248 248 stmpe_gpio->regs[REG_IE][regoffset] |= mask; 249 249 } 250 250 ··· 359 357 } 360 358 } 361 359 362 - static struct irq_chip stmpe_gpio_irq_chip = { 360 + static const struct irq_chip stmpe_gpio_irq_chip = { 363 361 .name = "stmpe-gpio", 364 362 .irq_bus_lock = stmpe_gpio_irq_lock, 365 363 .irq_bus_sync_unlock = stmpe_gpio_irq_sync_unlock, 366 364 .irq_mask = stmpe_gpio_irq_mask, 367 365 .irq_unmask = stmpe_gpio_irq_unmask, 368 366 .irq_set_type = stmpe_gpio_irq_set_type, 367 + .flags = IRQCHIP_IMMUTABLE, 368 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 369 369 }; 370 370 371 371 #define MAX_GPIOS 24 ··· 515 511 } 516 512 517 513 girq = &stmpe_gpio->chip.irq; 518 - girq->chip = &stmpe_gpio_irq_chip; 514 + gpio_irq_chip_set_chip(girq, &stmpe_gpio_irq_chip); 519 515 /* This will let us handle the parent IRQ in the driver */ 520 516 girq->parent_handler = NULL; 521 517 girq->num_parents = 0;