Skip to content

Commit 35f0aa7

Browse files
William Breathitt Graybrgl
authored andcommitted
gpio: 104-dio-48e: Make irq_chip immutable
Kernel warns about mutable irq_chips: "not an immutable chip, please consider fixing!" Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions. Signed-off-by: William Breathitt Gray <william.gray@linaro.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
1 parent ee0175b commit 35f0aa7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/gpio/gpio-104-dio-48e.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ static void dio48e_irq_mask(struct irq_data *data)
164164
dio48egpio->irq_mask &= ~BIT(0);
165165
else
166166
dio48egpio->irq_mask &= ~BIT(1);
167+
gpiochip_disable_irq(chip, offset);
167168

168169
if (!dio48egpio->irq_mask)
169170
/* disable interrupts */
@@ -191,6 +192,7 @@ static void dio48e_irq_unmask(struct irq_data *data)
191192
iowrite8(0x00, &dio48egpio->reg->enable_interrupt);
192193
}
193194

195+
gpiochip_enable_irq(chip, offset);
194196
if (offset == 19)
195197
dio48egpio->irq_mask |= BIT(0);
196198
else
@@ -213,12 +215,14 @@ static int dio48e_irq_set_type(struct irq_data *data, unsigned int flow_type)
213215
return 0;
214216
}
215217

216-
static struct irq_chip dio48e_irqchip = {
218+
static const struct irq_chip dio48e_irqchip = {
217219
.name = "104-dio-48e",
218220
.irq_ack = dio48e_irq_ack,
219221
.irq_mask = dio48e_irq_mask,
220222
.irq_unmask = dio48e_irq_unmask,
221-
.irq_set_type = dio48e_irq_set_type
223+
.irq_set_type = dio48e_irq_set_type,
224+
.flags = IRQCHIP_IMMUTABLE,
225+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
222226
};
223227

224228
static irqreturn_t dio48e_irq_handler(int irq, void *dev_id)
@@ -322,7 +326,7 @@ static int dio48e_probe(struct device *dev, unsigned int id)
322326
dio48egpio->chip.set_multiple = dio48e_gpio_set_multiple;
323327

324328
girq = &dio48egpio->chip.irq;
325-
girq->chip = &dio48e_irqchip;
329+
gpio_irq_chip_set_chip(girq, &dio48e_irqchip);
326330
/* This will let us handle the parent IRQ in the driver */
327331
girq->parent_handler = NULL;
328332
girq->num_parents = 0;

0 commit comments

Comments
 (0)