[PATCH 04/26] Input: maplemouse - stop polling and clear callback on close
Dmitry Torokhov <[email protected]> Fri, 03 Jul 2026 22:57:27 -0700
| Newsgroups | org.kernel.vger.linux-sh,org.infradead.lists.linux-mtd,org.kernel.vger.linux-input,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
In dc_mouse_close(), pass NULL instead of dc_mouse_callback to maple_getcond_callback() to both stop polling and clear the callback pointer when the input device is closed. This makes the manual clearing of mdev->callback in remove_maple_mouse() redundant, as input_unregister_device() automatically closes the device if it was open. Remove the redundant assignment. Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/input/mouse/maplemouse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/input/mouse/maplemouse.c b/drivers/input/mouse/maplemouse.c index 0c8f7d1b02aa..97d520e7d66d 100644 --- a/drivers/input/mouse/maplemouse.c +++ b/drivers/input/mouse/maplemouse.c @@ -60,8 +60,7 @@ static void dc_mouse_close(struct input_dev *dev) { struct dc_mouse *mse = input_get_drvdata(dev); - maple_getcond_callback(mse->mdev, dc_mouse_callback, 0, - MAPLE_FUNC_MOUSE); + maple_getcond_callback(mse->mdev, NULL, 0, MAPLE_FUNC_MOUSE); } /* allow the mouse to be used */ @@ -122,7 +121,6 @@ static int remove_maple_mouse(struct device *dev) struct maple_device *mdev = to_maple_dev(dev); struct dc_mouse *mse = maple_get_drvdata(mdev); - mdev->callback = NULL; input_unregister_device(mse->dev); maple_set_drvdata(mdev, NULL); kfree(mse); -- 2.55.0.rc0.799.gd6f94ed593-goog