* [PATCH] hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip
@ 2023-09-19 21:24 Danny Kaehn
2023-09-20 13:33 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Danny Kaehn @ 2023-09-19 21:24 UTC (permalink / raw)
To: jikos, benjamin.tissoires, andriy.shevchenko
Cc: linux-input, ethan.twardy, Danny Kaehn
Previously cp2112_gpio_irq_shutdown always cancelled the
gpio_poll_worker, even if other IRQs were still active, and did not set
the gpio_poll flag to false. This resulted in any call to _shutdown()
resulting in interrupts no longer functioning on the chip until a
_remove occurred (a.e. the cp2112 is unplugged or system rebooted).
Only cancel polling if all IRQs are disabled/masked, and correctly set
the gpio_poll flag, allowing polling to restart when an interrupt is
next enabled.
Signed-off-by: Danny Kaehn <danny.kaehn@plexus.com>
---
drivers/hid/hid-cp2112.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 36f76c6dfa20..d589214834b9 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -1166,7 +1166,12 @@ static void cp2112_gpio_irq_shutdown(struct irq_data *d)
struct cp2112_device *dev = gpiochip_get_data(gc);
cp2112_gpio_irq_mask(d);
- cancel_delayed_work_sync(&dev->gpio_poll_worker);
+
+ if (!dev->irq_mask)
+ {
+ dev->gpio_poll = false;
+ cancel_delayed_work_sync(&dev->gpio_poll_worker);
+ }
}
static int cp2112_gpio_irq_type(struct irq_data *d, unsigned int type)
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip
2023-09-19 21:24 [PATCH] hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip Danny Kaehn
@ 2023-09-20 13:33 ` Andy Shevchenko
2023-09-20 19:12 ` Danny Kaehn
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2023-09-20 13:33 UTC (permalink / raw)
To: Danny Kaehn; +Cc: jikos, benjamin.tissoires, linux-input, ethan.twardy
On Tue, Sep 19, 2023 at 04:24:26PM -0500, Danny Kaehn wrote:
> Previously cp2112_gpio_irq_shutdown always cancelled the
cp2112_gpio_irq_shutdown()
> gpio_poll_worker, even if other IRQs were still active, and did not set
> the gpio_poll flag to false. This resulted in any call to _shutdown()
> resulting in interrupts no longer functioning on the chip until a
> _remove occurred (a.e. the cp2112 is unplugged or system rebooted).
_remove()
> Only cancel polling if all IRQs are disabled/masked, and correctly set
> the gpio_poll flag, allowing polling to restart when an interrupt is
> next enabled.
...
> + if (!dev->irq_mask)
> + {
The style tells to use these on a single line.
> + dev->gpio_poll = false;
> + cancel_delayed_work_sync(&dev->gpio_poll_worker);
> + }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip
2023-09-20 13:33 ` Andy Shevchenko
@ 2023-09-20 19:12 ` Danny Kaehn
0 siblings, 0 replies; 3+ messages in thread
From: Danny Kaehn @ 2023-09-20 19:12 UTC (permalink / raw)
To: andriy.shevchenko@linux.intel.com
Cc: jikos@kernel.org, benjamin.tissoires@redhat.com,
linux-input@vger.kernel.org, Ethan Twardy
On Wed, 2023-09-20 at 16:33 +0300, Andy Shevchenko wrote:
> On Tue, Sep 19, 2023 at 04:24:26PM -0500, Danny Kaehn wrote:
> > Previously cp2112_gpio_irq_shutdown always cancelled the
>
> cp2112_gpio_irq_shutdown()
> > _remove occurred (a.e. the cp2112 is unplugged or system rebooted).
>
> _remove()
>
> > + if (!dev->irq_mask)
> > + {
>
> The style tells to use these on a single line.
ACK -- will fix all in v2. Thanks for the comments.
Danny Kaehn
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-20 19:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19 21:24 [PATCH] hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip Danny Kaehn
2023-09-20 13:33 ` Andy Shevchenko
2023-09-20 19:12 ` Danny Kaehn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).