[PATCH 5.4 097/120] gpio: ixp4xx: Make irqchip immutable

Greg Kroah-Hartman posted 120 patches 3 years, 6 months ago
[PATCH 5.4 097/120] gpio: ixp4xx: Make irqchip immutable
Posted by Greg Kroah-Hartman 3 years, 6 months ago
From: Linus Walleij <linus.walleij@linaro.org>

[ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ]

This turns the IXP4xx GPIO irqchip into an immutable
irqchip, a bit different from the standard template due
to being hierarchical.

Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
for a rootfs on compact flash with IRQs from this GPIO
block to the CF ATA controller.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpio/gpio-ixp4xx.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-ixp4xx.c b/drivers/gpio/gpio-ixp4xx.c
index b3b050604e0b..6bd047e2ca46 100644
--- a/drivers/gpio/gpio-ixp4xx.c
+++ b/drivers/gpio/gpio-ixp4xx.c
@@ -67,6 +67,14 @@ static void ixp4xx_gpio_irq_ack(struct irq_data *d)
 	__raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS);
 }
 
+static void ixp4xx_gpio_mask_irq(struct irq_data *d)
+{
+	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+
+	irq_chip_mask_parent(d);
+	gpiochip_disable_irq(gc, d->hwirq);
+}
+
 static void ixp4xx_gpio_irq_unmask(struct irq_data *d)
 {
 	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -76,6 +84,7 @@ static void ixp4xx_gpio_irq_unmask(struct irq_data *d)
 	if (!(g->irq_edge & BIT(d->hwirq)))
 		ixp4xx_gpio_irq_ack(d);
 
+	gpiochip_enable_irq(gc, d->hwirq);
 	irq_chip_unmask_parent(d);
 }
 
@@ -153,12 +162,14 @@ static int ixp4xx_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 	return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH);
 }
 
-static struct irq_chip ixp4xx_gpio_irqchip = {
+static const struct irq_chip ixp4xx_gpio_irqchip = {
 	.name = "IXP4GPIO",
 	.irq_ack = ixp4xx_gpio_irq_ack,
-	.irq_mask = irq_chip_mask_parent,
+	.irq_mask = ixp4xx_gpio_mask_irq,
 	.irq_unmask = ixp4xx_gpio_irq_unmask,
 	.irq_set_type = ixp4xx_gpio_irq_set_type,
+	.flags = IRQCHIP_IMMUTABLE,
+	GPIOCHIP_IRQ_RESOURCE_HELPERS,
 };
 
 static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
@@ -282,7 +293,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev)
 	g->gc.owner = THIS_MODULE;
 
 	girq = &g->gc.irq;
-	girq->chip = &ixp4xx_gpio_irqchip;
+	gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip);
 	girq->fwnode = g->fwnode;
 	girq->parent_domain = parent;
 	girq->child_to_parent_hwirq = ixp4xx_gpio_child_to_parent_hwirq;
-- 
2.35.1
Re: [PATCH 5.4 097/120] gpio: ixp4xx: Make irqchip immutable
Posted by Marc Zyngier 3 years, 6 months ago
Greg,

On Mon, 26 Sep 2022 06:12:10 -0400,
Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> 
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ]
> 
> This turns the IXP4xx GPIO irqchip into an immutable
> irqchip, a bit different from the standard template due
> to being hierarchical.
> 
> Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
> for a rootfs on compact flash with IRQs from this GPIO
> block to the CF ATA controller.
> 
> Cc: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> Acked-by: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> Signed-off-by: Sasha Levin <sashal@kernel.org>

We had that discussion[1], and concluded that none of these should be
backported to a kernel earlier than 5.19. 5.4 doesn't currently
contain the relevant infrastructure, nor should that infrastructure
should be backported either.

Can we *please* stop this?

	M.

[1] https://lore.kernel.org/all/CAMRc=Md9JKdW8wmbun_0_1y2RQbck7q=vzOkdw6n+FBgpf0h8w@mail.gmail.com/

-- 
Without deviation from the norm, progress is not possible.
Re: [PATCH 5.4 097/120] gpio: ixp4xx: Make irqchip immutable
Posted by Greg Kroah-Hartman 3 years, 6 months ago
On Mon, Sep 26, 2022 at 06:40:02AM -0400, Marc Zyngier wrote:
> Greg,
> 
> On Mon, 26 Sep 2022 06:12:10 -0400,
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> > 
> > From: Linus Walleij <linus.walleij@linaro.org>
> > 
> > [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ]
> > 
> > This turns the IXP4xx GPIO irqchip into an immutable
> > irqchip, a bit different from the standard template due
> > to being hierarchical.
> > 
> > Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
> > for a rootfs on compact flash with IRQs from this GPIO
> > block to the CF ATA controller.
> > 
> > Cc: Marc Zyngier <maz@kernel.org>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > Acked-by: Marc Zyngier <maz@kernel.org>
> > Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> > Signed-off-by: Sasha Levin <sashal@kernel.org>
> 
> We had that discussion[1], and concluded that none of these should be
> backported to a kernel earlier than 5.19. 5.4 doesn't currently
> contain the relevant infrastructure, nor should that infrastructure
> should be backported either.
> 
> Can we *please* stop this?
> 
> 	M.
> 
> [1] https://lore.kernel.org/all/CAMRc=Md9JKdW8wmbun_0_1y2RQbck7q=vzOkdw6n+FBgpf0h8w@mail.gmail.com/

Sasha, what went wrong here?

Now dropped from all but 5.19.y, thanks.

greg k-h
Re: [PATCH 5.4 097/120] gpio: ixp4xx: Make irqchip immutable
Posted by Sasha Levin 3 years, 6 months ago
On Mon, Sep 26, 2022 at 05:58:49PM +0200, Greg Kroah-Hartman wrote:
>On Mon, Sep 26, 2022 at 06:40:02AM -0400, Marc Zyngier wrote:
>> Greg,
>>
>> On Mon, 26 Sep 2022 06:12:10 -0400,
>> Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>> >
>> > From: Linus Walleij <linus.walleij@linaro.org>
>> >
>> > [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ]
>> >
>> > This turns the IXP4xx GPIO irqchip into an immutable
>> > irqchip, a bit different from the standard template due
>> > to being hierarchical.
>> >
>> > Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
>> > for a rootfs on compact flash with IRQs from this GPIO
>> > block to the CF ATA controller.
>> >
>> > Cc: Marc Zyngier <maz@kernel.org>
>> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>> > Acked-by: Marc Zyngier <maz@kernel.org>
>> > Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
>> > Signed-off-by: Sasha Levin <sashal@kernel.org>
>>
>> We had that discussion[1], and concluded that none of these should be
>> backported to a kernel earlier than 5.19. 5.4 doesn't currently
>> contain the relevant infrastructure, nor should that infrastructure
>> should be backported either.
>>
>> Can we *please* stop this?
>>
>> 	M.
>>
>> [1] https://lore.kernel.org/all/CAMRc=Md9JKdW8wmbun_0_1y2RQbck7q=vzOkdw6n+FBgpf0h8w@mail.gmail.com/
>
>Sasha, what went wrong here?
>
>Now dropped from all but 5.19.y, thanks.

Sorry about that, I misunderstood Bartosz's reply and went off based on
that.

-- 
Thanks,
Sasha