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

From: Vojtech Pavlik
Date: Thu Jul 29 2004 - 09:50:08 EST


You can pull this changeset from:
bk://kernel.bkbits.net/vojtech/input

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

ChangeSet@xxxxxxxxxxx, 2004-06-02 15:46:14+02:00, vojtech@xxxxxxx
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@xxxxxxx>


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--) {


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/