Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: ath79: Convert to immutable irq_chip

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

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Linus Walleij and committed by
Bartosz Golaszewski
b11ce7e4 c5dcf768

+6 -2
+6 -2
drivers/gpio/gpio-ath79.c
··· 71 71 u32 mask = BIT(irqd_to_hwirq(data)); 72 72 unsigned long flags; 73 73 74 + gpiochip_enable_irq(&ctrl->gc, irqd_to_hwirq(data)); 74 75 raw_spin_lock_irqsave(&ctrl->lock, flags); 75 76 ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, mask); 76 77 raw_spin_unlock_irqrestore(&ctrl->lock, flags); ··· 86 85 raw_spin_lock_irqsave(&ctrl->lock, flags); 87 86 ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, 0); 88 87 raw_spin_unlock_irqrestore(&ctrl->lock, flags); 88 + gpiochip_disable_irq(&ctrl->gc, irqd_to_hwirq(data)); 89 89 } 90 90 91 91 static void ath79_gpio_irq_enable(struct irq_data *data) ··· 171 169 return 0; 172 170 } 173 171 174 - static struct irq_chip ath79_gpio_irqchip = { 172 + static const struct irq_chip ath79_gpio_irqchip = { 175 173 .name = "gpio-ath79", 176 174 .irq_enable = ath79_gpio_irq_enable, 177 175 .irq_disable = ath79_gpio_irq_disable, 178 176 .irq_mask = ath79_gpio_irq_mask, 179 177 .irq_unmask = ath79_gpio_irq_unmask, 180 178 .irq_set_type = ath79_gpio_irq_set_type, 179 + .flags = IRQCHIP_IMMUTABLE, 180 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 181 181 }; 182 182 183 183 static void ath79_gpio_irq_handler(struct irq_desc *desc) ··· 278 274 /* Optional interrupt setup */ 279 275 if (!np || of_property_read_bool(np, "interrupt-controller")) { 280 276 girq = &ctrl->gc.irq; 281 - girq->chip = &ath79_gpio_irqchip; 277 + gpio_irq_chip_set_chip(girq, &ath79_gpio_irqchip); 282 278 girq->parent_handler = ath79_gpio_irq_handler; 283 279 girq->num_parents = 1; 284 280 girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),