Skip to content

Commit

Permalink
Merge branch 'for-6.7/cp2112' into for-linus
Browse files Browse the repository at this point in the history
- IRQ shutdown and workqueue initialization fixes for hid-cp2112
  driver (Danny Kaehn)
  • Loading branch information
Jiri Kosina committed Oct 31, 2023
2 parents 20cd569 + dc3115e commit f5883ef
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/hid/hid-cp2112.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit f5883ef

Please sign in to comment.