Skip to content

Commit 2993d2d

Browse files
MrVanBartosz Golaszewski
authored andcommitted
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 <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 580b326 commit 2993d2d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/gpio/gpio-timberdale.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,20 +103,26 @@ static void timbgpio_irq_disable(struct irq_data *d)
103103
{
104104
struct timbgpio *tgpio = irq_data_get_irq_chip_data(d);
105105
int offset = d->irq - tgpio->irq_base;
106+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
106107
unsigned long flags;
107108

108109
spin_lock_irqsave(&tgpio->lock, flags);
109110
tgpio->last_ier &= ~(1UL << offset);
110111
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
111112
spin_unlock_irqrestore(&tgpio->lock, flags);
113+
114+
gpiochip_disable_irq(&tgpio->gpio, hwirq);
112115
}
113116

114117
static void timbgpio_irq_enable(struct irq_data *d)
115118
{
116119
struct timbgpio *tgpio = irq_data_get_irq_chip_data(d);
117120
int offset = d->irq - tgpio->irq_base;
121+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
118122
unsigned long flags;
119123

124+
gpiochip_enable_irq(&tgpio->gpio, hwirq);
125+
120126
spin_lock_irqsave(&tgpio->lock, flags);
121127
tgpio->last_ier |= 1UL << offset;
122128
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
@@ -205,11 +211,13 @@ static void timbgpio_irq(struct irq_desc *desc)
205211
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
206212
}
207213

208-
static struct irq_chip timbgpio_irqchip = {
214+
static const struct irq_chip timbgpio_irqchip = {
209215
.name = "GPIO",
210216
.irq_enable = timbgpio_irq_enable,
211217
.irq_disable = timbgpio_irq_disable,
212218
.irq_set_type = timbgpio_irq_type,
219+
.flags = IRQCHIP_IMMUTABLE,
220+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
213221
};
214222

215223
static int timbgpio_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)