010-v6.4-gpio-ath79-Convert-to-immutable-irq_chip.patch 2.2 KB

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