HID: cp2112: make the irqchip immutable
PATCH 1/1 HID: cp2112: make the irqchip immutable
From: Bartosz Golaszewski <[email protected]>
This make the GPIO irqchip exposed by the CP2112 driver use an immutable irq_chip struct thus addressing the following warning on probe:
(cp2112_gpio): not an immutable chip, please consider fixing it!
--- drivers/hid/hid-cp2112.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/hid/hid-cp2112.c +15 -11
@@ -163,7 +163,6 @@ struct cp2112_device {atomic_t read_avail;atomic_t xfer_avail;struct gpio_chip gc; -struct irq_chip irq;u8 *in_out_buffer;struct mutex lock;
@@ -1082,6 +1081,7 @@ static void cp2112_gpio_irq_mask(struct irq_data *d)struct cp2112_device *dev =gpiochip_get_data (gc);__clear_bit (d->hwirq, &dev->irq_mask); +gpiochip_disable_irq (gc,irqd_to_hwirq (d)); }static void cp2112_gpio_irq_unmask (struct irq_data *d)
@@ -1089,6 +1089,7 @@ static void cp2112_gpio_irq_unmask(struct irq_data *d)struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct cp2112_device *dev =gpiochip_get_data (gc); +gpiochip_enable_irq (gc,irqd_to_hwirq (d));__set_bit (d->hwirq, &dev->irq_mask); }
@@ -1228,6 +1229,18 @@ static int __maybe_unused cp2112_allocate_irq(struct cp2112_device *dev,return ret; } +static const struct irq_chip cp2112_irq_chip = { + .name ="cp2112-gpio" , + .irq_startup = cp2112_gpio_irq_startup, + .irq_shutdown = cp2112_gpio_irq_shutdown, + .irq_ack = cp2112_gpio_irq_ack, + .irq_mask = cp2112_gpio_irq_mask, + .irq_unmask = cp2112_gpio_irq_unmask, + .irq_set_type = cp2112_gpio_irq_type, + .flags =IRQCHIP_MASK_ON_SUSPEND |IRQCHIP_IMMUTABLE , +GPIOCHIP_IRQ_RESOURCE_HELPERS , +}; +static int cp2112_probe (struct hid_device *hdev,const struct hid_device_id *id) {struct cp2112_device *dev;
@@ -1337,17 +1350,8 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) dev->gc.can_sleep =1 ; dev->gc.parent = &hdev->dev; - dev->irq.name ="cp2112-gpio" ; - dev->irq.irq_startup = cp2112_gpio_irq_startup; - dev->irq.irq_shutdown = cp2112_gpio_irq_shutdown; - dev->irq.irq_ack = cp2112_gpio_irq_ack; - dev->irq.irq_mask = cp2112_gpio_irq_mask; - dev->irq.irq_unmask = cp2112_gpio_irq_unmask; - dev->irq.irq_set_type = cp2112_gpio_irq_type; - dev->irq.flags =IRQCHIP_MASK_ON_SUSPEND ; - girq = &dev->gc.irq; - girq->chip = &dev->irq; +gpio_irq_chip_set_chip (girq, &cp2112_irq_chip);/* The event comes from the outside so no parent handler */ girq->parent_handler =NULL ; girq->num_parents =0 ;
Signature · 1 line
2.39.2
Quoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
This make the GPIO irqchip exposed by the CP2112 driver use an immutable
irq_chipstruct thus addressing the following warning on probe:(
cp2112_gpio): not an immutable chip, please consider fixing it!
Can you test HID for-next for this hardware?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Quoted 9 lines
Quoted 4 lines
This make the GPIO irqchip exposed by the CP2112 driver use an immutable
irq_chipstruct thus addressing the following warning on probe:(
cp2112_gpio): not an immutable chip, please consider fixing it!Can you test HID for-next for this hardware?
Ah you beat me to it. I didn't see this one.
Bart
Quoted 8 lines · Bartosz Golaszewski
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
This make the GPIO irqchip exposed by the CP2112 driver use an immutable
irq_chipstruct thus addressing the following warning on probe:
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
(
cp2112_gpio): not an immutable chip, please consider fixing it!Can you test HID for-next for this hardware?
Ah you beat me to it. I didn't see this one.
Now looking at it, I don't understand why I added a call to IRQ shutdown callback... (Looks like it slipped from experimental patch.) If you can test this, would be nice.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Bartosz Golaszewski
Tested-byQuoted 14 lines · Andy Shevchenko
Quoted 12 lines · Bartosz Golaszewski
Quoted 10 lines · Andy Shevchenko
Quoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
This make the GPIO irqchip exposed by the CP2112 driver use an immutable
irq_chipstruct thus addressing the following warning on probe:(
cp2112_gpio): not an immutable chip, please consider fixing it!
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Can you test HID for-next for this hardware?
Ah you beat me to it. I didn't see this one.
Now looking at it, I don't understand why I added a call to IRQ shutdown callback... (Looks like it slipped from experimental patch.) If you can test this, would be nice.
Yeah it works alright.
It's already in next but FWIW:
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
This make the GPIO irqchip exposed by the CP2112 driver use an immutable
irq_chipstruct thus addressing the following warning on probe:(
cp2112_gpio): not an immutable chip, please consider fixing it!Signed-off-by Bartosz Golaszewski <[email protected]>
Thanks for fixing this. FWIW:
Marc Z, have you checked how we stand with immutable GPIO irqchips? We should be able to smoke it out to default behaviour soon I think.
Yours,
Linus Walleij
Quoted 10 lines · Linus Walleij
Quoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
This make the GPIO irqchip exposed by the CP2112 driver use an immutable
irq_chipstruct thus addressing the following warning on probe:(
cp2112_gpio): not an immutable chip, please consider fixing it!
Quoted 8 lines
Quoted 1 line
Signed-off-by Bartosz Golaszewski <[email protected]>Thanks for fixing this. FWIW:
Reviewed-by Linus Walleij <[email protected]>Marc Z, have you checked how we stand with immutable GPIO irqchips? We should be able to smoke it out to default behaviour soon I think.
I haven't recently checked, but I'm still in favour of actively make the new behaviour the only one supported. The sooner we break things, the better...
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.