Skip to content

Commit

Permalink
HID: mcp-2221: cancel delayed_work only when CONFIG_IIO is enabled
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
  • Loading branch information
Abdelrahman Morsy authored and Jiri Kosina committed Apr 12, 2024
1 parent 21f28a7 commit 3cba9cf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/hid/hid-mcp2221.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3cba9cf

Please sign in to comment.