1 From b11ce7e48121a02ceedec9f4dfcab4f2bee8f35f Mon Sep 17 00:00:00 2001
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Thu, 9 Mar 2023 08:45:54 +0100
4 Subject: gpio: ath79: Convert to immutable irq_chip
6 Convert the driver to immutable irq-chip with a bit of
9 Cc: Marc Zyngier <maz@kernel.org>
10 Acked-by: Marc Zyngier <maz@kernel.org>
11 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
12 Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
14 drivers/gpio/gpio-ath79.c | 8 ++++++--
15 1 file changed, 6 insertions(+), 2 deletions(-)
17 --- a/drivers/gpio/gpio-ath79.c
18 +++ b/drivers/gpio/gpio-ath79.c
19 @@ -71,6 +71,7 @@ static void ath79_gpio_irq_unmask(struct
20 u32 mask = BIT(irqd_to_hwirq(data));
23 + gpiochip_enable_irq(&ctrl->gc, irqd_to_hwirq(data));
24 raw_spin_lock_irqsave(&ctrl->lock, flags);
25 ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, mask);
26 raw_spin_unlock_irqrestore(&ctrl->lock, flags);
27 @@ -85,6 +86,7 @@ static void ath79_gpio_irq_mask(struct i
28 raw_spin_lock_irqsave(&ctrl->lock, flags);
29 ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, 0);
30 raw_spin_unlock_irqrestore(&ctrl->lock, flags);
31 + gpiochip_disable_irq(&ctrl->gc, irqd_to_hwirq(data));
34 static void ath79_gpio_irq_enable(struct irq_data *data)
35 @@ -169,13 +171,15 @@ static int ath79_gpio_irq_set_type(struc
39 -static struct irq_chip ath79_gpio_irqchip = {
40 +static const struct irq_chip ath79_gpio_irqchip = {
42 .irq_enable = ath79_gpio_irq_enable,
43 .irq_disable = ath79_gpio_irq_disable,
44 .irq_mask = ath79_gpio_irq_mask,
45 .irq_unmask = ath79_gpio_irq_unmask,
46 .irq_set_type = ath79_gpio_irq_set_type,
47 + .flags = IRQCHIP_IMMUTABLE,
48 + GPIOCHIP_IRQ_RESOURCE_HELPERS,
51 static void ath79_gpio_irq_handler(struct irq_desc *desc)
52 @@ -274,7 +278,7 @@ static int ath79_gpio_probe(struct platf
53 /* Optional interrupt setup */
54 if (!np || of_property_read_bool(np, "interrupt-controller")) {
56 - girq->chip = &ath79_gpio_irqchip;
57 + gpio_irq_chip_set_chip(girq, &ath79_gpio_irqchip);
58 girq->parent_handler = ath79_gpio_irq_handler;
59 girq->num_parents = 1;
60 girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),