pinctrl: keembay: make keembay_gpio_irqchip const
Subsystems (3)
PATCH 1/1 pinctrl: keembay: make keembay_gpio_irqchip const
gpiolib warns about mutable irq_chips at probe time:
"not an immutable chip, please consider fixing it!"
Make keembay_gpio_irqchip const, flag it as IRQCHIP_IMMUTABLE, add the GPIOCHIP_IRQ_RESOURCE_HELPERS and register it with gpio_irq_chip_set_chip().
The chip only implements .irq_enable() and .irq_disable(), so call gpiochip_enable_irq() and gpiochip_disable_irq() from those callbacks, following commit 35d008679a5a ("pinctrl: plgpio: Convert to immutable irq_chip") [1] and commit 2993d2dd8ff4 ("gpio: timberdale: Make irq_chip immutable") [2]. gpiochip_enable_irq() is called once a free interrupt source and slot have been found, so a line is only marked enabled when it is actually routed. gpiochip_disable_irq() is called after the line has been cleared from the interrupt configuration register.
---
Compile-tested only (arm64, W=1, sparse).
drivers/pinctrl/pinctrl-keembay.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-keembay.c +7 -2
@@ -1380,6 +1380,8 @@ static void keembay_gpio_irq_enable(struct irq_data *data)if (src <0 || slot <0 )return ; +gpiochip_enable_irq (gc, pin); +if (trig &KEEMBAY_GPIO_SENSE_LOW )keembay_gpio_invert (kpc, pin);
@@ -1412,6 +1414,7 @@ static void keembay_gpio_irq_disable(struct irq_data *data)for_each_set_clump8 (pos, clump, ®,BITS_PER_TYPE (typeof (reg))) {if ((clump & ~KEEMBAY_GPIO_IRQ_ENABLE ) == pin) {keembay_gpio_clear_irq (data, pos, src, pin); +gpiochip_disable_irq (gc, pin);return ; } }
@@ -1451,12 +1454,14 @@ static int keembay_gpio_add_pin_ranges(struct gpio_chip *chip)return ret; } -static struct irq_chip keembay_gpio_irqchip = { +static const struct irq_chip keembay_gpio_irqchip = { .name ="keembay-gpio" , .irq_enable = keembay_gpio_irq_enable, .irq_disable = keembay_gpio_irq_disable, .irq_set_type = keembay_gpio_irq_set_type, .irq_ack = keembay_gpio_irq_ack, + .flags =IRQCHIP_IMMUTABLE , +GPIOCHIP_IRQ_RESOURCE_HELPERS , }; static int keembay_gpiochip_probe(struct keembay_pinctrl *kpc,
@@ -1468,7 +1473,7 @@ static int keembay_gpiochip_probe(struct keembay_pinctrl *kpc,/* Setup GPIO IRQ chip */ girq = &kpc->chip.irq; - girq->chip = &keembay_gpio_irqchip; +gpio_irq_chip_set_chip (girq, &keembay_gpio_irqchip); girq->parent_handler = keembay_gpio_irq_handler; girq->num_parents =KEEMBAY_GPIO_NUM_IRQ ; girq->parents = devm_kcalloc(kpc->dev, girq->num_parents,
base-commit: f33a24cc012d34f25bb9942681bd478a1757b806
Signature · 1 line
2.53.0
Linus Walleij
maintainerQuoted 16 lines · Areeb Ul Haq Mirza
gpiolib warns about mutable
irq_chipsat probe time:
"not an immutable chip, please consider fixing it!"Make
keembay_gpio_irqchipconst, flag it asIRQCHIP_IMMUTABLE, add theGPIOCHIP_IRQ_RESOURCE_HELPERSand register it withgpio_irq_chip_set_chip().The chip only implements .irq_enable() and .irq_disable(), so call
gpiochip_enable_irq()andgpiochip_disable_irq()from those callbacks, following commit35d008679a5a("pinctrl: plgpio: Convert to immutableirq_chip") [1] and commit2993d2dd8ff4("gpio: timberdale: Makeirq_chipimmutable") [2].gpiochip_enable_irq()is called once a free interrupt source and slot have been found, so a line is only marked enabled when it is actually routed.gpiochip_disable_irq()is called after the line has been cleared from the interrupt configuration register.
Quoted 3 lines
Driver is marked as orphan so I just applied the patch.
Cc to Andy if he wants to pick up maintenance for this one, but I doubt it (not x86, right?)
Yours,
Linus Walleij
Quoted 18 lines · Linus Walleij
Quoted 16 lines · Areeb Ul Haq Mirza
gpiolib warns about mutable
irq_chipsat probe time:
"not an immutable chip, please consider fixing it!"Make
keembay_gpio_irqchipconst, flag it asIRQCHIP_IMMUTABLE, add theGPIOCHIP_IRQ_RESOURCE_HELPERSand register it withgpio_irq_chip_set_chip().The chip only implements .irq_enable() and .irq_disable(), so call
gpiochip_enable_irq()andgpiochip_disable_irq()from those callbacks, following commit35d008679a5a("pinctrl: plgpio: Convert to immutableirq_chip") [1] and commit2993d2dd8ff4("gpio: timberdale: Makeirq_chipimmutable") [2].gpiochip_enable_irq()is called once a free interrupt source and slot have been found, so a line is only marked enabled when it is actually routed.gpiochip_disable_irq()is called after the line has been cleared from the interrupt configuration register.
Quoted 8 lines
Quoted 3 lines
Driver is marked as orphan so I just applied the patch.
Cc to Andy if he wants to pick up maintenance for this one, but I doubt it (not x86, right?)
No, it's ARM. And IIRC (I may be mistaken) it was designed somewhere close to mobileye, for some automotive related use cases. So, if ask, try to ask mobileye people if they are willing to take it.
Signature · 2 lines
With Best Regards, Andy Shevchenko