Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "Input: psmouse - add delay when deactivating for SMBus mode"

This reverts commit 92e24e0e57f72e06c2df87116557331fd2d4dda2.

While the patch itself is correct, it uncovered an issue with fallback
to PS/2 mode, where we were leaving psmouse->fast_reconnect handler set
to psmouse_smbus_reconnect(), which caused crashes.

While discussing various approaches to fix the issue it was noted that
this patch ass undesired delay in the "fast" resume path of PS/2 device,
and it would be better to actually use "reset_delay" option defined in
struct rmi_device_platform_data and have RMI code handle it for SMBus
transport as well. So this patch is being reverted to deal with crashes
and a better solution will be merged shortly.

Reported-by: Thorsten Leemhuis <linux@leemhuis.info>
Closes: https://lore.kernel.org/all/ca0109fa-c64b-43c1-a651-75b294d750a1@leemhuis.info/
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+7 -12
+7 -12
drivers/input/mouse/psmouse-smbus.c
··· 5 5 6 6 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 7 7 8 - #include <linux/delay.h> 9 8 #include <linux/kernel.h> 10 9 #include <linux/module.h> 11 10 #include <linux/libps2.h> ··· 118 119 return PSMOUSE_FULL_PACKET; 119 120 } 120 121 121 - static void psmouse_activate_smbus_mode(struct psmouse_smbus_dev *smbdev) 122 - { 123 - if (smbdev->need_deactivate) { 124 - psmouse_deactivate(smbdev->psmouse); 125 - /* Give the device time to switch into SMBus mode */ 126 - msleep(30); 127 - } 128 - } 129 - 130 122 static int psmouse_smbus_reconnect(struct psmouse *psmouse) 131 123 { 132 - psmouse_activate_smbus_mode(psmouse->private); 124 + struct psmouse_smbus_dev *smbdev = psmouse->private; 125 + 126 + if (smbdev->need_deactivate) 127 + psmouse_deactivate(psmouse); 128 + 133 129 return 0; 134 130 } 135 131 ··· 257 263 } 258 264 } 259 265 260 - psmouse_activate_smbus_mode(smbdev); 266 + if (need_deactivate) 267 + psmouse_deactivate(psmouse); 261 268 262 269 psmouse->private = smbdev; 263 270 psmouse->protocol_handler = psmouse_smbus_process_byte;