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

Configure Feed

Select the types of activity you want to include in your feed.

misc: microchip: pci1xxxx: Convert to immutable irqchip

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

Cc: linux-gpio@vger.kernel.org
Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230223133252.2257276-1-linus.walleij@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Linus Walleij and committed by
Greg Kroah-Hartman
1274b37a 995a3bb7

+8 -2
+8 -2
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c
··· 175 175 unsigned int gpio = irqd_to_hwirq(data); 176 176 unsigned long flags; 177 177 178 + if (!set) 179 + gpiochip_enable_irq(chip, gpio); 178 180 spin_lock_irqsave(&priv->lock, flags); 179 181 pci1xxx_assign_bit(priv->reg_base, INTR_MASK_OFFSET(gpio), (gpio % 32), set); 180 182 spin_unlock_irqrestore(&priv->lock, flags); 183 + if (set) 184 + gpiochip_disable_irq(chip, gpio); 181 185 } 182 186 183 187 static void pci1xxxx_gpio_irq_mask(struct irq_data *data) ··· 287 283 return IRQ_HANDLED; 288 284 } 289 285 290 - static struct irq_chip pci1xxxx_gpio_irqchip = { 286 + static const struct irq_chip pci1xxxx_gpio_irqchip = { 291 287 .name = "pci1xxxx_gpio", 292 288 .irq_ack = pci1xxxx_gpio_irq_ack, 293 289 .irq_mask = pci1xxxx_gpio_irq_mask, 294 290 .irq_unmask = pci1xxxx_gpio_irq_unmask, 295 291 .irq_set_type = pci1xxxx_gpio_set_type, 292 + .flags = IRQCHIP_IMMUTABLE, 293 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 296 294 }; 297 295 298 296 static int pci1xxxx_gpio_suspend(struct device *dev) ··· 357 351 return retval; 358 352 359 353 girq = &priv->gpio.irq; 360 - girq->chip = &pci1xxxx_gpio_irqchip; 354 + gpio_irq_chip_set_chip(girq, &pci1xxxx_gpio_irqchip); 361 355 girq->parent_handler = NULL; 362 356 girq->num_parents = 0; 363 357 girq->parents = NULL;