Skip to content

Commit e2cb5cc

Browse files
jefferymillerdtor
authored andcommitted
Input: psmouse - fix fast_reconnect function for PS/2 mode
When the SMBus connection is attempted psmouse_smbus_init() sets the fast_reconnect pointer to psmouse_smbus_reconnecti(). If SMBus initialization fails, elantech_setup_ps2() and synaptics_init_ps2() will fallback to PS/2 mode, replacing the psmouse private data. This can cause issues on resume, since psmouse_smbus_reconnect() expects to find an instance of struct psmouse_smbus_dev in psmouse->private. The issue was uncovered when in 92e24e0 ("Input: psmouse - add delay when deactivating for SMBus mode") psmouse_smbus_reconnect() started attempting to use more of the data structure. The commit was since reverted, not because it was at fault, but because there was found a better way of doing what it was attempting to do. Fix the problem by resetting the fast_reconnect pointer in psmouse structure in elantech_setup_ps2() and synaptics_init_ps2() when the PS/2 mode is used. Reported-by: Thorsten Leemhuis <[email protected]> Tested-by: Thorsten Leemhuis <[email protected]> Signed-off-by: Jeffery Miller <[email protected]> Fixes: bf232e4 ("Input: psmouse-smbus - allow to control psmouse_deactivate") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent b357263 commit e2cb5cc

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

drivers/input/mouse/elantech.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,6 +2114,7 @@ static int elantech_setup_ps2(struct psmouse *psmouse,
21142114
psmouse->protocol_handler = elantech_process_byte;
21152115
psmouse->disconnect = elantech_disconnect;
21162116
psmouse->reconnect = elantech_reconnect;
2117+
psmouse->fast_reconnect = NULL;
21172118
psmouse->pktsize = info->hw_version > 1 ? 6 : 4;
21182119

21192120
return 0;

drivers/input/mouse/synaptics.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,7 @@ static int synaptics_init_ps2(struct psmouse *psmouse,
16231623
psmouse->set_rate = synaptics_set_rate;
16241624
psmouse->disconnect = synaptics_disconnect;
16251625
psmouse->reconnect = synaptics_reconnect;
1626+
psmouse->fast_reconnect = NULL;
16261627
psmouse->cleanup = synaptics_reset;
16271628
/* Synaptics can usually stay in sync without extra help */
16281629
psmouse->resync_time = 0;

0 commit comments

Comments
 (0)