gpio: ixp4xx: Make irqchip immutable

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>

authored by Linus Walleij and committed by Bartosz Golaszewski 94e9bc73 1660c679

+14 -3
+14 -3
drivers/gpio/gpio-ixp4xx.c
··· 63 __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS); 64 } 65 66 static void ixp4xx_gpio_irq_unmask(struct irq_data *d) 67 { 68 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); ··· 80 if (!(g->irq_edge & BIT(d->hwirq))) 81 ixp4xx_gpio_irq_ack(d); 82 83 irq_chip_unmask_parent(d); 84 } 85 ··· 158 return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH); 159 } 160 161 - static struct irq_chip ixp4xx_gpio_irqchip = { 162 .name = "IXP4GPIO", 163 .irq_ack = ixp4xx_gpio_irq_ack, 164 - .irq_mask = irq_chip_mask_parent, 165 .irq_unmask = ixp4xx_gpio_irq_unmask, 166 .irq_set_type = ixp4xx_gpio_irq_set_type, 167 }; 168 169 static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc, ··· 274 g->gc.owner = THIS_MODULE; 275 276 girq = &g->gc.irq; 277 - girq->chip = &ixp4xx_gpio_irqchip; 278 girq->fwnode = g->fwnode; 279 girq->parent_domain = parent; 280 girq->child_to_parent_hwirq = ixp4xx_gpio_child_to_parent_hwirq;
··· 63 __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS); 64 } 65 66 + static void ixp4xx_gpio_mask_irq(struct irq_data *d) 67 + { 68 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 69 + 70 + irq_chip_mask_parent(d); 71 + gpiochip_disable_irq(gc, d->hwirq); 72 + } 73 + 74 static void ixp4xx_gpio_irq_unmask(struct irq_data *d) 75 { 76 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); ··· 72 if (!(g->irq_edge & BIT(d->hwirq))) 73 ixp4xx_gpio_irq_ack(d); 74 75 + gpiochip_enable_irq(gc, d->hwirq); 76 irq_chip_unmask_parent(d); 77 } 78 ··· 149 return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH); 150 } 151 152 + static const struct irq_chip ixp4xx_gpio_irqchip = { 153 .name = "IXP4GPIO", 154 .irq_ack = ixp4xx_gpio_irq_ack, 155 + .irq_mask = ixp4xx_gpio_mask_irq, 156 .irq_unmask = ixp4xx_gpio_irq_unmask, 157 .irq_set_type = ixp4xx_gpio_irq_set_type, 158 + .flags = IRQCHIP_IMMUTABLE, 159 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 160 }; 161 162 static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc, ··· 263 g->gc.owner = THIS_MODULE; 264 265 girq = &g->gc.irq; 266 + gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip); 267 girq->fwnode = g->fwnode; 268 girq->parent_domain = parent; 269 girq->child_to_parent_hwirq = ixp4xx_gpio_child_to_parent_hwirq;