Commit 83d0c706 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: fix psmouse_sendbyte logic

       - correctly return NAK when command times out on our side
       - always reset ACK flag, even when serio_write fails
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 3984cbc9
......@@ -260,12 +260,17 @@ static int psmouse_sendbyte(struct psmouse *psmouse, unsigned char byte)
{
int timeout = 200000; /* 200 msec */
psmouse->nak = 1;
set_bit(PSMOUSE_FLAG_ACK, &psmouse->flags);
if (serio_write(psmouse->serio, byte))
return -1;
while (test_bit(PSMOUSE_FLAG_ACK, &psmouse->flags) && timeout--) udelay(1);
clear_bit(PSMOUSE_FLAG_ACK, &psmouse->flags);
goto out;
while (test_bit(PSMOUSE_FLAG_ACK, &psmouse->flags) && timeout--)
udelay(1);
out:
clear_bit(PSMOUSE_FLAG_ACK, &psmouse->flags);
return -psmouse->nak;
}
......
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