aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2023-11-01 00:09:51 +0100
committerJiri Kosina <jkosina@suse.cz>2023-11-01 00:09:51 +0100
commitf5883ef15644bdaf5f0850b9c0469e00d40bfb4f (patch)
tree5cd45e0ea9d53000cccd172d6502c6248df0eada /drivers/hid
parent20cd569d7ee8fce24e8753f0f43af6c420557b1f (diff)
parentdc3115e6c5d9863ec1a9ff1acf004ede93c34361 (diff)
downloadlinux-f5883ef15644bdaf5f0850b9c0469e00d40bfb4f.tar.gz
Merge branch 'for-6.7/cp2112' into for-linus
- IRQ shutdown and workqueue initialization fixes for hid-cp2112 driver (Danny Kaehn)
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-cp2112.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 54c33a24f8442..20a0d1315d90f 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -1151,8 +1151,6 @@ static unsigned int cp2112_gpio_irq_startup(struct irq_data *d)
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct cp2112_device *dev = gpiochip_get_data(gc);
- INIT_DELAYED_WORK(&dev->gpio_poll_worker, cp2112_gpio_poll_callback);
-
if (!dev->gpio_poll) {
dev->gpio_poll = true;
schedule_delayed_work(&dev->gpio_poll_worker, 0);
@@ -1168,7 +1166,11 @@ 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)
@@ -1307,6 +1309,8 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
girq->handler = handle_simple_irq;
girq->threaded = true;
+ INIT_DELAYED_WORK(&dev->gpio_poll_worker, cp2112_gpio_poll_callback);
+
ret = gpiochip_add_data(&dev->gc, dev);
if (ret < 0) {
hid_err(hdev, "error registering gpio chip\n");