Skip to content

Commit 32585b5

Browse files
Linus WalleijBartosz Golaszewski
authored andcommitted
gpio: stmpe: Convert to immutable irq_chip
Convert the driver to immutable irq-chip with a bit of intuition. 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 5ff8240 commit 32585b5

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/gpio/gpio-stmpe.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ static void stmpe_gpio_irq_mask(struct irq_data *d)
234234
int mask = BIT(offset % 8);
235235

236236
stmpe_gpio->regs[REG_IE][regoffset] &= ~mask;
237+
gpiochip_disable_irq(gc, offset);
237238
}
238239

239240
static void stmpe_gpio_irq_unmask(struct irq_data *d)
@@ -244,6 +245,7 @@ static void stmpe_gpio_irq_unmask(struct irq_data *d)
244245
int regoffset = offset / 8;
245246
int mask = BIT(offset % 8);
246247

248+
gpiochip_enable_irq(gc, offset);
247249
stmpe_gpio->regs[REG_IE][regoffset] |= mask;
248250
}
249251

@@ -357,13 +359,15 @@ static void stmpe_dbg_show(struct seq_file *s, struct gpio_chip *gc)
357359
}
358360
}
359361

360-
static struct irq_chip stmpe_gpio_irq_chip = {
362+
static const struct irq_chip stmpe_gpio_irq_chip = {
361363
.name = "stmpe-gpio",
362364
.irq_bus_lock = stmpe_gpio_irq_lock,
363365
.irq_bus_sync_unlock = stmpe_gpio_irq_sync_unlock,
364366
.irq_mask = stmpe_gpio_irq_mask,
365367
.irq_unmask = stmpe_gpio_irq_unmask,
366368
.irq_set_type = stmpe_gpio_irq_set_type,
369+
.flags = IRQCHIP_IMMUTABLE,
370+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
367371
};
368372

369373
#define MAX_GPIOS 24
@@ -511,7 +515,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
511515
}
512516

513517
girq = &stmpe_gpio->chip.irq;
514-
girq->chip = &stmpe_gpio_irq_chip;
518+
gpio_irq_chip_set_chip(girq, &stmpe_gpio_irq_chip);
515519
/* This will let us handle the parent IRQ in the driver */
516520
girq->parent_handler = NULL;
517521
girq->num_parents = 0;

0 commit comments

Comments
 (0)