Commit d65b954b authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: libps2 - fix timeout handling in ps2_command, switch to using

       wait_event_timeout instead of wait_event_interruptible_timeout
       now that first form is available.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent df56a4a6
...@@ -60,9 +60,9 @@ int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout) ...@@ -60,9 +60,9 @@ int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout)
serio_continue_rx(ps2dev->serio); serio_continue_rx(ps2dev->serio);
if (serio_write(ps2dev->serio, byte) == 0) if (serio_write(ps2dev->serio, byte) == 0)
wait_event_interruptible_timeout(ps2dev->wait, wait_event_timeout(ps2dev->wait,
!(ps2dev->flags & PS2_FLAG_ACK), !(ps2dev->flags & PS2_FLAG_ACK),
msecs_to_jiffies(timeout)); msecs_to_jiffies(timeout));
serio_pause_rx(ps2dev->serio); serio_pause_rx(ps2dev->serio);
ps2dev->flags &= ~PS2_FLAG_ACK; ps2dev->flags &= ~PS2_FLAG_ACK;
...@@ -115,8 +115,8 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) ...@@ -115,8 +115,8 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
*/ */
timeout = msecs_to_jiffies(command == PS2_CMD_RESET_BAT ? 4000 : 500); timeout = msecs_to_jiffies(command == PS2_CMD_RESET_BAT ? 4000 : 500);
wait_event_interruptible_timeout(ps2dev->wait, timeout = wait_event_timeout(ps2dev->wait,
!(ps2dev->flags & PS2_FLAG_CMD1), timeout); !(ps2dev->flags & PS2_FLAG_CMD1), timeout);
if (ps2dev->cmdcnt && timeout > 0) { if (ps2dev->cmdcnt && timeout > 0) {
...@@ -147,8 +147,8 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) ...@@ -147,8 +147,8 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
serio_continue_rx(ps2dev->serio); serio_continue_rx(ps2dev->serio);
} }
wait_event_interruptible_timeout(ps2dev->wait, wait_event_timeout(ps2dev->wait,
!(ps2dev->flags & PS2_FLAG_CMD), timeout); !(ps2dev->flags & PS2_FLAG_CMD), timeout);
} }
if (param) if (param)
...@@ -259,7 +259,7 @@ int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data) ...@@ -259,7 +259,7 @@ int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data)
ps2dev->flags |= PS2_FLAG_CMD | PS2_FLAG_CMD1; ps2dev->flags |= PS2_FLAG_CMD | PS2_FLAG_CMD1;
ps2dev->flags &= ~PS2_FLAG_ACK; ps2dev->flags &= ~PS2_FLAG_ACK;
wake_up_interruptible(&ps2dev->wait); wake_up(&ps2dev->wait);
if (data != PS2_RET_ACK) if (data != PS2_RET_ACK)
ps2_handle_response(ps2dev, data); ps2_handle_response(ps2dev, data);
...@@ -281,12 +281,12 @@ int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data) ...@@ -281,12 +281,12 @@ int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data)
if (ps2dev->flags & PS2_FLAG_CMD1) { if (ps2dev->flags & PS2_FLAG_CMD1) {
ps2dev->flags &= ~PS2_FLAG_CMD1; ps2dev->flags &= ~PS2_FLAG_CMD1;
if (ps2dev->cmdcnt) if (ps2dev->cmdcnt)
wake_up_interruptible(&ps2dev->wait); wake_up(&ps2dev->wait);
} }
if (!ps2dev->cmdcnt) { if (!ps2dev->cmdcnt) {
ps2dev->flags &= ~PS2_FLAG_CMD; ps2dev->flags &= ~PS2_FLAG_CMD;
wake_up_interruptible(&ps2dev->wait); wake_up(&ps2dev->wait);
} }
return 1; return 1;
...@@ -298,7 +298,7 @@ void ps2_cmd_aborted(struct ps2dev *ps2dev) ...@@ -298,7 +298,7 @@ void ps2_cmd_aborted(struct ps2dev *ps2dev)
ps2dev->nak = 1; ps2dev->nak = 1;
if (ps2dev->flags & (PS2_FLAG_ACK | PS2_FLAG_CMD)) if (ps2dev->flags & (PS2_FLAG_ACK | PS2_FLAG_CMD))
wake_up_interruptible(&ps2dev->wait); wake_up(&ps2dev->wait);
ps2dev->flags = 0; ps2dev->flags = 0;
} }
......
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