Commit 34051083 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: when disconnecting PS/2 mouse give protocol's disconnect

       handler chance to run before starting ignoring mouse data.
       Otherwise interrupt handler will discard all ACKs and the
       very first command in cleanup sequence will fail (Synaptics
       was failing to return to relative mode on module unload).
parent 366b7517
......@@ -552,7 +552,7 @@ static void psmouse_disconnect(struct serio *serio)
{
struct psmouse *psmouse = serio->private;
psmouse->state = PSMOUSE_IGNORE;
psmouse->state = PSMOUSE_CMD_MODE;
if (psmouse->ptport) {
if (psmouse->ptport->deactivate)
......@@ -565,6 +565,8 @@ static void psmouse_disconnect(struct serio *serio)
if (psmouse->disconnect)
psmouse->disconnect(psmouse);
psmouse->state = PSMOUSE_IGNORE;
input_unregister_device(&psmouse->dev);
serio_close(serio);
kfree(psmouse);
......@@ -592,7 +594,7 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev)
psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
psmouse->state = PSMOUSE_NEW_DEVICE;
psmouse->state = PSMOUSE_CMD_MODE;
psmouse->serio = serio;
psmouse->dev.private = psmouse;
......@@ -650,7 +652,7 @@ static int psmouse_reconnect(struct serio *serio)
return -1;
}
psmouse->state = PSMOUSE_NEW_DEVICE;
psmouse->state = PSMOUSE_CMD_MODE;
psmouse->type = psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = 0;
if (psmouse->reconnect) {
if (psmouse->reconnect(psmouse))
......
......@@ -18,7 +18,7 @@
#define PSMOUSE_RET_NAK 0xfe
/* psmouse states */
#define PSMOUSE_NEW_DEVICE 0
#define PSMOUSE_CMD_MODE 0
#define PSMOUSE_ACTIVATED 1
#define PSMOUSE_IGNORE 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment