Skip to content

Commit 2093bcd

Browse files
Linus WalleijBartosz Golaszewski
authored andcommitted
gpio: xlp: Convert to immutable irq_chip
Convert the driver to immutable irq-chip with a bit of intuition. In this case the driver uses .mask_ack() and .unmask() and since I have a vague idea about the semantics of .mask_ack() I added .irq_enable() to the existing .irq_disable() and called into the gpiolib core from those callbacks instead of mask/unmask. Cc: Marc Zyngier <maz@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent b4510f8 commit 2093bcd

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

drivers/gpio/gpio-xlp.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ static void xlp_gpio_set_reg(void __iomem *addr, unsigned gpio, int state)
9090
writel(value, addr + regset);
9191
}
9292

93+
static void xlp_gpio_irq_enable(struct irq_data *d)
94+
{
95+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
96+
97+
gpiochip_enable_irq(gc, irqd_to_hwirq(d));
98+
}
99+
93100
static void xlp_gpio_irq_disable(struct irq_data *d)
94101
{
95102
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -100,6 +107,7 @@ static void xlp_gpio_irq_disable(struct irq_data *d)
100107
xlp_gpio_set_reg(priv->gpio_intr_en, d->hwirq, 0x0);
101108
__clear_bit(d->hwirq, priv->gpio_enabled_mask);
102109
spin_unlock_irqrestore(&priv->lock, flags);
110+
gpiochip_disable_irq(gc, irqd_to_hwirq(d));
103111
}
104112

105113
static void xlp_gpio_irq_mask_ack(struct irq_data *d)
@@ -163,10 +171,12 @@ static int xlp_gpio_set_irq_type(struct irq_data *d, unsigned int type)
163171
static struct irq_chip xlp_gpio_irq_chip = {
164172
.name = "XLP-GPIO",
165173
.irq_mask_ack = xlp_gpio_irq_mask_ack,
174+
.irq_enable = xlp_gpio_irq_enable,
166175
.irq_disable = xlp_gpio_irq_disable,
167176
.irq_set_type = xlp_gpio_set_irq_type,
168177
.irq_unmask = xlp_gpio_irq_unmask,
169-
.flags = IRQCHIP_ONESHOT_SAFE,
178+
.flags = IRQCHIP_ONESHOT_SAFE | IRQCHIP_IMMUTABLE,
179+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
170180
};
171181

172182
static void xlp_gpio_generic_handler(struct irq_desc *desc)
@@ -272,7 +282,7 @@ static int xlp_gpio_probe(struct platform_device *pdev)
272282
spin_lock_init(&priv->lock);
273283

274284
girq = &gc->irq;
275-
girq->chip = &xlp_gpio_irq_chip;
285+
gpio_irq_chip_set_chip(girq, &xlp_gpio_irq_chip);
276286
girq->parent_handler = xlp_gpio_generic_handler;
277287
girq->num_parents = 1;
278288
girq->parents = devm_kcalloc(&pdev->dev, 1,

0 commit comments

Comments
 (0)