Skip to content

Commit 6890381

Browse files
William Breathitt Graybrgl
authored andcommitted
gpio: ws16c48: 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 410a504 commit 6890381

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/gpio/gpio-ws16c48.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ static void ws16c48_irq_mask(struct irq_data *data)
265265
raw_spin_lock_irqsave(&ws16c48gpio->lock, flags);
266266

267267
ws16c48gpio->irq_mask &= ~mask;
268+
gpiochip_disable_irq(chip, offset);
268269
port_state = ws16c48gpio->irq_mask >> (8 * port);
269270

270271
/* Select Register Page 2; Unlock all I/O ports */
@@ -295,6 +296,7 @@ static void ws16c48_irq_unmask(struct irq_data *data)
295296

296297
raw_spin_lock_irqsave(&ws16c48gpio->lock, flags);
297298

299+
gpiochip_enable_irq(chip, offset);
298300
ws16c48gpio->irq_mask |= mask;
299301
port_state = ws16c48gpio->irq_mask >> (8 * port);
300302

@@ -356,12 +358,14 @@ static int ws16c48_irq_set_type(struct irq_data *data, unsigned flow_type)
356358
return 0;
357359
}
358360

359-
static struct irq_chip ws16c48_irqchip = {
361+
static const struct irq_chip ws16c48_irqchip = {
360362
.name = "ws16c48",
361363
.irq_ack = ws16c48_irq_ack,
362364
.irq_mask = ws16c48_irq_mask,
363365
.irq_unmask = ws16c48_irq_unmask,
364-
.irq_set_type = ws16c48_irq_set_type
366+
.irq_set_type = ws16c48_irq_set_type,
367+
.flags = IRQCHIP_IMMUTABLE,
368+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
365369
};
366370

367371
static irqreturn_t ws16c48_irq_handler(int irq, void *dev_id)
@@ -463,7 +467,7 @@ static int ws16c48_probe(struct device *dev, unsigned int id)
463467
ws16c48gpio->chip.set_multiple = ws16c48_gpio_set_multiple;
464468

465469
girq = &ws16c48gpio->chip.irq;
466-
girq->chip = &ws16c48_irqchip;
470+
gpio_irq_chip_set_chip(girq, &ws16c48_irqchip);
467471
/* This will let us handle the parent IRQ in the driver */
468472
girq->parent_handler = NULL;
469473
girq->num_parents = 0;

0 commit comments

Comments
 (0)