From: Linus Walleij <linus.wall...@linaro.org>

commit ef902f54e91b3012586f6387daeebec2966312f0 upstream.

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

Whereas in most cases we put the gpiochip_[enable|disable]_irq()
calls in the .irq_mask() and .irq_unmask() callbacks, here
we need to put them in the .irq_enable() and .irq_disable()
callbacks, as this driver uses both .irq_mask() and
.irq_mask_ack().

Cc: Marc Zyngier <m...@kernel.org>
Signed-off-by: Linus Walleij <linus.wall...@linaro.org>
Reviewed-by: Marc Zyngier <m...@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszew...@linaro.org>
Signed-off-by: Ruiqiang Hao <ruiqiang....@windriver.com>
---
 drivers/gpio/gpio-thunderx.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
index 909b31e0e1ae..49c4c28b567f 100644
--- a/drivers/gpio/gpio-thunderx.c
+++ b/drivers/gpio/gpio-thunderx.c
@@ -358,16 +358,22 @@ static int thunderx_gpio_irq_set_type(struct irq_data *d,
        return IRQ_SET_MASK_OK;
 }
 
-static void thunderx_gpio_irq_enable(struct irq_data *data)
+static void thunderx_gpio_irq_enable(struct irq_data *d)
 {
-       irq_chip_enable_parent(data);
-       thunderx_gpio_irq_unmask(data);
+       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+
+       gpiochip_enable_irq(gc, irqd_to_hwirq(d));
+       irq_chip_enable_parent(d);
+       thunderx_gpio_irq_unmask(d);
 }
 
-static void thunderx_gpio_irq_disable(struct irq_data *data)
+static void thunderx_gpio_irq_disable(struct irq_data *d)
 {
-       thunderx_gpio_irq_mask(data);
-       irq_chip_disable_parent(data);
+       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+
+       thunderx_gpio_irq_mask(d);
+       irq_chip_disable_parent(d);
+       gpiochip_disable_irq(gc, irqd_to_hwirq(d));
 }
 
 /*
@@ -376,7 +382,7 @@ static void thunderx_gpio_irq_disable(struct irq_data *data)
  * semantics and other acknowledgment tasks associated with the GPIO
  * mechanism.
  */
-static struct irq_chip thunderx_gpio_irq_chip = {
+static const struct irq_chip thunderx_gpio_irq_chip = {
        .name                   = "GPIO",
        .irq_enable             = thunderx_gpio_irq_enable,
        .irq_disable            = thunderx_gpio_irq_disable,
@@ -387,8 +393,8 @@ static struct irq_chip thunderx_gpio_irq_chip = {
        .irq_eoi                = irq_chip_eoi_parent,
        .irq_set_affinity       = irq_chip_set_affinity_parent,
        .irq_set_type           = thunderx_gpio_irq_set_type,
-
-       .flags                  = IRQCHIP_SET_TYPE_MASKED
+       .flags                  = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_IMMUTABLE,
+       GPIOCHIP_IRQ_RESOURCE_HELPERS,
 };
 
 static int thunderx_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
@@ -555,7 +561,7 @@ static int thunderx_gpio_probe(struct pci_dev *pdev,
        chip->set_multiple = thunderx_gpio_set_multiple;
        chip->set_config = thunderx_gpio_set_config;
        girq = &chip->irq;
-       girq->chip = &thunderx_gpio_irq_chip;
+       gpio_irq_chip_set_chip(girq, &thunderx_gpio_irq_chip);
        girq->fwnode = of_node_to_fwnode(dev->of_node);
        girq->parent_domain =
                irq_get_irq_data(txgpio->msix_entries[0].vector)->domain;
-- 
2.43.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13622): 
https://lists.yoctoproject.org/g/linux-yocto/message/13622
Mute This Topic: https://lists.yoctoproject.org/mt/104661507/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to