Commit 1274b37a authored by Linus Walleij's avatar Linus Walleij Committed by Greg Kroah-Hartman

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: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230223133252.2257276-1-linus.walleij@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 995a3bb7
...@@ -175,9 +175,13 @@ static void pci1xxxx_gpio_irq_set_mask(struct irq_data *data, bool set) ...@@ -175,9 +175,13 @@ static void pci1xxxx_gpio_irq_set_mask(struct irq_data *data, bool set)
unsigned int gpio = irqd_to_hwirq(data); unsigned int gpio = irqd_to_hwirq(data);
unsigned long flags; unsigned long flags;
if (!set)
gpiochip_enable_irq(chip, gpio);
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
pci1xxx_assign_bit(priv->reg_base, INTR_MASK_OFFSET(gpio), (gpio % 32), set); pci1xxx_assign_bit(priv->reg_base, INTR_MASK_OFFSET(gpio), (gpio % 32), set);
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
if (set)
gpiochip_disable_irq(chip, gpio);
} }
static void pci1xxxx_gpio_irq_mask(struct irq_data *data) static void pci1xxxx_gpio_irq_mask(struct irq_data *data)
...@@ -283,12 +287,14 @@ static irqreturn_t pci1xxxx_gpio_irq_handler(int irq, void *dev_id) ...@@ -283,12 +287,14 @@ static irqreturn_t pci1xxxx_gpio_irq_handler(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static struct irq_chip pci1xxxx_gpio_irqchip = { static const struct irq_chip pci1xxxx_gpio_irqchip = {
.name = "pci1xxxx_gpio", .name = "pci1xxxx_gpio",
.irq_ack = pci1xxxx_gpio_irq_ack, .irq_ack = pci1xxxx_gpio_irq_ack,
.irq_mask = pci1xxxx_gpio_irq_mask, .irq_mask = pci1xxxx_gpio_irq_mask,
.irq_unmask = pci1xxxx_gpio_irq_unmask, .irq_unmask = pci1xxxx_gpio_irq_unmask,
.irq_set_type = pci1xxxx_gpio_set_type, .irq_set_type = pci1xxxx_gpio_set_type,
.flags = IRQCHIP_IMMUTABLE,
GPIOCHIP_IRQ_RESOURCE_HELPERS,
}; };
static int pci1xxxx_gpio_suspend(struct device *dev) static int pci1xxxx_gpio_suspend(struct device *dev)
...@@ -351,7 +357,7 @@ static int pci1xxxx_gpio_setup(struct pci1xxxx_gpio *priv, int irq) ...@@ -351,7 +357,7 @@ static int pci1xxxx_gpio_setup(struct pci1xxxx_gpio *priv, int irq)
return retval; return retval;
girq = &priv->gpio.irq; girq = &priv->gpio.irq;
girq->chip = &pci1xxxx_gpio_irqchip; gpio_irq_chip_set_chip(girq, &pci1xxxx_gpio_irqchip);
girq->parent_handler = NULL; girq->parent_handler = NULL;
girq->num_parents = 0; girq->num_parents = 0;
girq->parents = NULL; girq->parents = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment