diff mbox series

HID: mcp-2221: cancel delayed_work only when CONFIG_IIO is enabled

Message ID 20240402121406.1703500-1-abdelrahmanhesham94@gmail.com
State New
Headers show
Series HID: mcp-2221: cancel delayed_work only when CONFIG_IIO is enabled | expand

Commit Message

Abdelrahman Morsy April 2, 2024, 12:14 p.m. UTC
If the device is unplugged and CONFIG_IIO is not supported, this will
result in a warning message at kernel/workqueue.

Only cancel delayed work in mcp2221_remove(), when CONFIG_IIO is enabled.

Signed-off-by: Abdelrahman Morsy <abdelrahmanhesham94@gmail.com>
---
 drivers/hid/hid-mcp2221.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jiri Kosina April 12, 2024, 3:49 p.m. UTC | #1
On Tue, 2 Apr 2024, Abdelrahman Morsy wrote:

> If the device is unplugged and CONFIG_IIO is not supported, this will
> result in a warning message at kernel/workqueue.
> 
> Only cancel delayed work in mcp2221_remove(), when CONFIG_IIO is enabled.

Makes sense, the work is scheduled also only with CONFIG_IIO enabled. 
Thanks, applied.
diff mbox series

Patch

diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c
index f9cceaeffd08..da5ea5a23b08 100644
--- a/drivers/hid/hid-mcp2221.c
+++ b/drivers/hid/hid-mcp2221.c
@@ -944,9 +944,11 @@  static void mcp2221_hid_unregister(void *ptr)
 /* This is needed to be sure hid_hw_stop() isn't called twice by the subsystem */
 static void mcp2221_remove(struct hid_device *hdev)
 {
+#if IS_REACHABLE(CONFIG_IIO)
 	struct mcp2221 *mcp = hid_get_drvdata(hdev);
 
 	cancel_delayed_work_sync(&mcp->init_work);
+#endif
 }
 
 #if IS_REACHABLE(CONFIG_IIO)