Input: edt-ft54x6: Clean up timer and workqueue on remove
authorDave Stevenson <dave.stevenson@raspberrypi.com>
Wed, 8 Sep 2021 13:46:17 +0000 (14:46 +0100)
committerDom Cobley <popcornmix@gmail.com>
Mon, 19 Feb 2024 11:33:12 +0000 (11:33 +0000)
If no interrupt is defined then a timer and workqueue are used
to poll the controller.
On remove these were not being cleaned up correctly.

Fixes: ca61fdaba79f "Input: edt-ft5x06: Poll the device if no interrupt is
configured."

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drivers/input/touchscreen/edt-ft5x06.c

index 5cbaa42..9541609 100644 (file)
@@ -1420,6 +1420,10 @@ static void edt_ft5x06_ts_remove(struct i2c_client *client)
 {
        struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
+       if (!client->irq) {
+               del_timer(&tsdata->timer);
+               cancel_work_sync(&tsdata->work_i2c_poll);
+       }
        edt_ft5x06_ts_teardown_debugfs(tsdata);
        regmap_exit(tsdata->regmap);
 }