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

Configure Feed

Select the types of activity you want to include in your feed.

Input: libps2 - remove special handling of ACK for command byte

When getting unexpected data while waiting for an acknowledgement it does
not matter what command phase is currently executed, and ps2_handle_ack()
should indicate that no further processing is needed for the received data
byte. Remove PS2_FLAG_ACK_CMD and associated handling.

Note that while it is possible to make ps2_handle_ack (and
ps2_handle_repsonse) return void, it will be done when the code will be
converted to common PS/2 interrupt handler later.

Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Link: https://lore.kernel.org/r/20230511185252.386941-3-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+2 -8
+2 -7
drivers/input/serio/libps2.c
··· 253 253 for (i = 0; i < receive; i++) 254 254 ps2dev->cmdbuf[(receive - 1) - i] = param[i]; 255 255 256 - /* Signal that we are sending the command byte */ 257 - ps2dev->flags |= PS2_FLAG_ACK_CMD; 258 - 259 256 /* 260 257 * Some devices (Synaptics) peform the reset before 261 258 * ACKing the reset command, and so it can take a long ··· 264 267 if (rc) 265 268 goto out_reset_flags; 266 269 267 - /* Now we are sending command parameters, if any */ 268 - ps2dev->flags &= ~PS2_FLAG_ACK_CMD; 269 - 270 + /* Send command parameters, if any. */ 270 271 for (i = 0; i < send; i++) { 271 272 rc = ps2_do_sendbyte(ps2dev, param[i], 200, 2); 272 273 if (rc) ··· 431 436 */ 432 437 dev_dbg(&ps2dev->serio->dev, "unexpected %#02x\n", data); 433 438 ps2dev->flags &= ~PS2_FLAG_WAITID; 434 - return ps2dev->flags & PS2_FLAG_ACK_CMD; 439 + return true; 435 440 } 436 441 437 442 if (!ps2dev->nak) {
-1
include/linux/libps2.h
··· 28 28 #define PS2_FLAG_CMD1 BIT(2) /* Waiting for the first byte of command response */ 29 29 #define PS2_FLAG_WAITID BIT(3) /* Command executing is GET ID */ 30 30 #define PS2_FLAG_NAK BIT(4) /* Last transmission was NAKed */ 31 - #define PS2_FLAG_ACK_CMD BIT(5) /* Waiting to ACK the command (first) byte */ 32 31 33 32 struct ps2dev { 34 33 struct serio *serio;