diff mbox series

[v2] gpio: tc3589x: Make irqchip immutable

Message ID 20221003074520.2526581-1-linus.walleij@linaro.org
State New
Headers show
Series [v2] gpio: tc3589x: Make irqchip immutable | expand

Commit Message

Linus Walleij Oct. 3, 2022, 7:45 a.m. UTC
This turns the Toshiba tc3589x gpio irqchip immutable.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Add the proper gpiochip_disable|enable_irq() calls in
  mask|unmask, oops.
---
 drivers/gpio/gpio-tc3589x.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Marc Zyngier Oct. 3, 2022, 3:20 p.m. UTC | #1
On Mon, 03 Oct 2022 08:45:20 +0100,
Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> This turns the Toshiba tc3589x gpio irqchip immutable.
> 
> Cc: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Add the proper gpiochip_disable|enable_irq() calls in
>   mask|unmask, oops.
> ---
>  drivers/gpio/gpio-tc3589x.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Acked-by: Marc Zyngier <maz@kernel.org>

	M.
Bartosz Golaszewski Oct. 3, 2022, 6:57 p.m. UTC | #2
On Mon, Oct 3, 2022 at 9:45 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> This turns the Toshiba tc3589x gpio irqchip immutable.
>
> Cc: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---

I applied it to my for-next tree and will send it to Linus T. together
with my GPIO PR later this week.

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
index 443fe975bf13..e62ee7e56908 100644
--- a/drivers/gpio/gpio-tc3589x.c
+++ b/drivers/gpio/gpio-tc3589x.c
@@ -230,6 +230,7 @@  static void tc3589x_gpio_irq_mask(struct irq_data *d)
 
 	tc3589x_gpio->regs[REG_IE][regoffset] &= ~mask;
 	tc3589x_gpio->regs[REG_DIRECT][regoffset] |= mask;
+	gpiochip_disable_irq(gc, offset);
 }
 
 static void tc3589x_gpio_irq_unmask(struct irq_data *d)
@@ -240,17 +241,20 @@  static void tc3589x_gpio_irq_unmask(struct irq_data *d)
 	int regoffset = offset / 8;
 	int mask = BIT(offset % 8);
 
+	gpiochip_enable_irq(gc, offset);
 	tc3589x_gpio->regs[REG_IE][regoffset] |= mask;
 	tc3589x_gpio->regs[REG_DIRECT][regoffset] &= ~mask;
 }
 
-static struct irq_chip tc3589x_gpio_irq_chip = {
+static const struct irq_chip tc3589x_gpio_irq_chip = {
 	.name			= "tc3589x-gpio",
 	.irq_bus_lock		= tc3589x_gpio_irq_lock,
 	.irq_bus_sync_unlock	= tc3589x_gpio_irq_sync_unlock,
 	.irq_mask		= tc3589x_gpio_irq_mask,
 	.irq_unmask		= tc3589x_gpio_irq_unmask,
 	.irq_set_type		= tc3589x_gpio_irq_set_type,
+	.flags =		IRQCHIP_IMMUTABLE,
+	GPIOCHIP_IRQ_RESOURCE_HELPERS,
 };
 
 static irqreturn_t tc3589x_gpio_irq(int irq, void *dev)
@@ -321,7 +325,7 @@  static int tc3589x_gpio_probe(struct platform_device *pdev)
 	tc3589x_gpio->chip.base = -1;
 
 	girq = &tc3589x_gpio->chip.irq;
-	girq->chip = &tc3589x_gpio_irq_chip;
+	gpio_irq_chip_set_chip(girq, &tc3589x_gpio_irq_chip);
 	/* This will let us handle the parent IRQ in the driver */
 	girq->parent_handler = NULL;
 	girq->num_parents = 0;