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

gpio: msc313: Convert to immutable irq_chip

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

This conversion follows the pattern of the gpio-ixp4xx
hierarchical GPIO interrupt driver.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Linus Walleij and committed by
Bartosz Golaszewski
db45f0e1 9cd9e23a

+22 -4
+22 -4
drivers/gpio/gpio-msc313.c
··· 532 532 return 0; 533 533 } 534 534 535 + static void msc313_gpio_irq_mask(struct irq_data *d) 536 + { 537 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 538 + 539 + irq_chip_mask_parent(d); 540 + gpiochip_disable_irq(gc, d->hwirq); 541 + } 542 + 543 + static void msc313_gpio_irq_unmask(struct irq_data *d) 544 + { 545 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 546 + 547 + gpiochip_enable_irq(gc, d->hwirq); 548 + irq_chip_unmask_parent(d); 549 + } 550 + 535 551 /* 536 552 * The interrupt handling happens in the parent interrupt controller, 537 553 * we don't do anything here. 538 554 */ 539 - static struct irq_chip msc313_gpio_irqchip = { 555 + static const struct irq_chip msc313_gpio_irqchip = { 540 556 .name = "GPIO", 541 557 .irq_eoi = irq_chip_eoi_parent, 542 - .irq_mask = irq_chip_mask_parent, 543 - .irq_unmask = irq_chip_unmask_parent, 558 + .irq_mask = msc313_gpio_irq_mask, 559 + .irq_unmask = msc313_gpio_irq_unmask, 544 560 .irq_set_type = irq_chip_set_type_parent, 545 561 .irq_set_affinity = irq_chip_set_affinity_parent, 562 + .flags = IRQCHIP_IMMUTABLE, 563 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 546 564 }; 547 565 548 566 /* ··· 662 644 gpiochip->names = gpio->gpio_data->names; 663 645 664 646 gpioirqchip = &gpiochip->irq; 665 - gpioirqchip->chip = &msc313_gpio_irqchip; 647 + gpio_irq_chip_set_chip(gpioirqchip, &msc313_gpio_irqchip); 666 648 gpioirqchip->fwnode = of_node_to_fwnode(dev->of_node); 667 649 gpioirqchip->parent_domain = parent_domain; 668 650 gpioirqchip->child_to_parent_hwirq = msc313e_gpio_child_to_parent_hwirq;