mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
gpio: timberdale: Make irq_chip immutable
Kernel warns about mutable irq_chips: "not an immutable chip, please consider fixing!" Constify timbgpio_irqchip, flag the irq_chip as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20250509-gpio-v1-8-639377c98288@nxp.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
580b3264cb
commit
2993d2dd8f
1 changed files with 9 additions and 1 deletions
|
@ -103,20 +103,26 @@ static void timbgpio_irq_disable(struct irq_data *d)
|
||||||
{
|
{
|
||||||
struct timbgpio *tgpio = irq_data_get_irq_chip_data(d);
|
struct timbgpio *tgpio = irq_data_get_irq_chip_data(d);
|
||||||
int offset = d->irq - tgpio->irq_base;
|
int offset = d->irq - tgpio->irq_base;
|
||||||
|
irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&tgpio->lock, flags);
|
spin_lock_irqsave(&tgpio->lock, flags);
|
||||||
tgpio->last_ier &= ~(1UL << offset);
|
tgpio->last_ier &= ~(1UL << offset);
|
||||||
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
|
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
|
||||||
spin_unlock_irqrestore(&tgpio->lock, flags);
|
spin_unlock_irqrestore(&tgpio->lock, flags);
|
||||||
|
|
||||||
|
gpiochip_disable_irq(&tgpio->gpio, hwirq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void timbgpio_irq_enable(struct irq_data *d)
|
static void timbgpio_irq_enable(struct irq_data *d)
|
||||||
{
|
{
|
||||||
struct timbgpio *tgpio = irq_data_get_irq_chip_data(d);
|
struct timbgpio *tgpio = irq_data_get_irq_chip_data(d);
|
||||||
int offset = d->irq - tgpio->irq_base;
|
int offset = d->irq - tgpio->irq_base;
|
||||||
|
irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
gpiochip_enable_irq(&tgpio->gpio, hwirq);
|
||||||
|
|
||||||
spin_lock_irqsave(&tgpio->lock, flags);
|
spin_lock_irqsave(&tgpio->lock, flags);
|
||||||
tgpio->last_ier |= 1UL << offset;
|
tgpio->last_ier |= 1UL << offset;
|
||||||
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
|
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
|
||||||
|
@ -205,11 +211,13 @@ static void timbgpio_irq(struct irq_desc *desc)
|
||||||
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
|
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct irq_chip timbgpio_irqchip = {
|
static const struct irq_chip timbgpio_irqchip = {
|
||||||
.name = "GPIO",
|
.name = "GPIO",
|
||||||
.irq_enable = timbgpio_irq_enable,
|
.irq_enable = timbgpio_irq_enable,
|
||||||
.irq_disable = timbgpio_irq_disable,
|
.irq_disable = timbgpio_irq_disable,
|
||||||
.irq_set_type = timbgpio_irq_type,
|
.irq_set_type = timbgpio_irq_type,
|
||||||
|
.flags = IRQCHIP_IMMUTABLE,
|
||||||
|
GPIOCHIP_IRQ_RESOURCE_HELPERS,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int timbgpio_probe(struct platform_device *pdev)
|
static int timbgpio_probe(struct platform_device *pdev)
|
||||||
|
|
Loading…
Add table
Reference in a new issue