[PATCH 11/47] Make atkbd.c's atkbd_command() function immune to keys being pressed while running

Vojtech Pavlik
2004-07-29T14:45:48Z

ChangeSet@1.1722.84.3, 2004-06-02 15:46:14+02:00, vojtech@suse.cz
input: Make atkbd.c's atkbd_command() function immune to keys being pressed
and scancodes coming from the keyboard while it's executing.

Signed-off-by: Vojtech Pavlik <vojtech@suse.cz>

atkbd.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)

===================================================================

diff -Nru a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
--- a/drivers/input/keyboard/atkbd.c Thu Jul 29 14:41:36 2004
+++ b/drivers/input/keyboard/atkbd.c Thu Jul 29 14:41:36 2004
@@ -252,6 +252,11 @@
switch (code) {
case ATKBD_RET_ACK:
atkbd->nak = 0;
+ if (atkbd->cmdcnt) {
+ set_bit(ATKBD_FLAG_CMD, &atkbd->flags);
+ set_bit(ATKBD_FLAG_CMD1, &atkbd->flags);
+ set_bit(ATKBD_FLAG_ID, &atkbd->flags);
+ }
clear_bit(ATKBD_FLAG_ACK, &atkbd->flags);
goto out;
case ATKBD_RET_NAK:
@@ -414,6 +419,7 @@
#endif

set_bit(ATKBD_FLAG_ACK, &atkbd->flags);
+ clear_bit(ATKBD_FLAG_CMD, &atkbd->flags);
if (serio_write(atkbd->serio, byte))
return -1;
while (test_bit(ATKBD_FLAG_ACK, &atkbd->flags) && timeout--) udelay(1);
@@ -443,23 +449,13 @@
for (i = 0; i < receive; i++)
atkbd->cmdbuf[(receive - 1) - i] = param[i];

- if (receive) {
- set_bit(ATKBD_FLAG_CMD, &atkbd->flags);
- set_bit(ATKBD_FLAG_CMD1, &atkbd->flags);
- set_bit(ATKBD_FLAG_ID, &atkbd->flags);
- }
-
if (command & 0xff)
- if (atkbd_sendbyte(atkbd, command & 0xff)) {
- clear_bit(ATKBD_FLAG_CMD, &atkbd->flags);
+ if (atkbd_sendbyte(atkbd, command & 0xff))
return -1;
- }

for (i = 0; i < send; i++)
- if (atkbd_sendbyte(atkbd, param[i])) {
- clear_bit(ATKBD_FLAG_CMD, &atkbd->flags);
+ if (atkbd_sendbyte(atkbd, param[i]))
return -1;
- }

while (test_bit(ATKBD_FLAG_CMD, &atkbd->flags) && timeout--) {