[PATCH 19/26] Input: maple_keyb - remove redundant mutex and remove method
Dmitry Torokhov <[email protected]> Fri, 03 Jul 2026 22:57:42 -0700
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.input,gmane.linux.drivers.mtd,gmane.linux.ports.sh.devel |
|---|---|
| Message-ID | <[email protected]> |
Now that the Maple bus core handles callback synchronization via callback_mutex, the keyboard-driver-specific maple_keyb_mutex is redundant. Remove the mutex and its usage. Since the mutex was the only reason we kept the remove method (to synchronize during detach), we can now remove remove_maple_kbd entirely. The devm-managed resource cleanup is sufficient. Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/input/keyboard/maple_keyb.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c index ab9257db7e03..aa9a4a80e26f 100644 --- a/drivers/input/keyboard/maple_keyb.c +++ b/drivers/input/keyboard/maple_keyb.c @@ -14,9 +14,6 @@ #include <linux/timer.h> #include <linux/maple.h> -/* Very simple mutex to ensure proper cleanup */ -static DEFINE_MUTEX(maple_keyb_mutex); - #define NR_SCANCODES 256 MODULE_AUTHOR("Adrian McMenamin <[email protected]"); @@ -128,15 +125,9 @@ static void dc_kbd_callback(struct mapleq *mq) struct dc_kbd *kbd = maple_get_drvdata(mapledev); unsigned long *buf = (unsigned long *)(mq->recvbuf->buf); - /* - * We should always get the lock because the only - * time it may be locked is if the driver is in the cleanup phase. - */ - scoped_guard(mutex_try, &maple_keyb_mutex) { - if (buf[1] == mapledev->function) { - memcpy(kbd->new, buf + 2, 8); - dc_scan_kbd(kbd); - } + if (buf[1] == mapledev->function) { + memcpy(kbd->new, buf + 2, 8); + dc_scan_kbd(kbd); } } @@ -211,22 +202,12 @@ static int probe_maple_kbd(struct maple_device *mdev) return error; } -static void remove_maple_kbd(struct maple_device *mdev) -{ - struct dc_kbd *kbd = maple_get_drvdata(mdev); - guard(mutex)(&maple_keyb_mutex); - input_unregister_device(kbd->dev); - kfree(kbd); - - -} static struct maple_driver dc_kbd_driver = { .function = MAPLE_FUNC_KEYBOARD, .probe = probe_maple_kbd, - .remove = remove_maple_kbd, .drv = { .name = "Dreamcast_keyboard", }, -- 2.55.0.rc0.799.gd6f94ed593-goog