Commit d5e0d918 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: libps2 - fix switch statement formatting

Individual labels of switch statements should have the same indentation
level as the switch statement itself.
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 4c711ef6
...@@ -126,46 +126,46 @@ EXPORT_SYMBOL(ps2_is_keyboard_id); ...@@ -126,46 +126,46 @@ EXPORT_SYMBOL(ps2_is_keyboard_id);
static int ps2_adjust_timeout(struct ps2dev *ps2dev, int command, int timeout) static int ps2_adjust_timeout(struct ps2dev *ps2dev, int command, int timeout)
{ {
switch (command) { switch (command) {
case PS2_CMD_RESET_BAT: case PS2_CMD_RESET_BAT:
/* /*
* Device has sent the first response byte after * Device has sent the first response byte after
* reset command, reset is thus done, so we can * reset command, reset is thus done, so we can
* shorten the timeout. * shorten the timeout.
* The next byte will come soon (keyboard) or not * The next byte will come soon (keyboard) or not
* at all (mouse). * at all (mouse).
*/ */
if (timeout > msecs_to_jiffies(100)) if (timeout > msecs_to_jiffies(100))
timeout = msecs_to_jiffies(100); timeout = msecs_to_jiffies(100);
break; break;
case PS2_CMD_GETID: case PS2_CMD_GETID:
/* /*
* Microsoft Natural Elite keyboard responds to * Microsoft Natural Elite keyboard responds to
* the GET ID command as it were a mouse, with * the GET ID command as it were a mouse, with
* a single byte. Fail the command so atkbd will * a single byte. Fail the command so atkbd will
* use alternative probe to detect it. * use alternative probe to detect it.
*/ */
if (ps2dev->cmdbuf[1] == 0xaa) { if (ps2dev->cmdbuf[1] == 0xaa) {
serio_pause_rx(ps2dev->serio); serio_pause_rx(ps2dev->serio);
ps2dev->flags = 0; ps2dev->flags = 0;
serio_continue_rx(ps2dev->serio); serio_continue_rx(ps2dev->serio);
timeout = 0; timeout = 0;
} }
/*
* If device behind the port is not a keyboard there
* won't be 2nd byte of ID response.
*/
if (!ps2_is_keyboard_id(ps2dev->cmdbuf[1])) {
serio_pause_rx(ps2dev->serio);
ps2dev->flags = ps2dev->cmdcnt = 0;
serio_continue_rx(ps2dev->serio);
timeout = 0;
}
break;
default: /*
break; * If device behind the port is not a keyboard there
* won't be 2nd byte of ID response.
*/
if (!ps2_is_keyboard_id(ps2dev->cmdbuf[1])) {
serio_pause_rx(ps2dev->serio);
ps2dev->flags = ps2dev->cmdcnt = 0;
serio_continue_rx(ps2dev->serio);
timeout = 0;
}
break;
default:
break;
} }
return timeout; return timeout;
...@@ -289,39 +289,38 @@ EXPORT_SYMBOL(ps2_init); ...@@ -289,39 +289,38 @@ EXPORT_SYMBOL(ps2_init);
int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data) int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data)
{ {
switch (data) { switch (data) {
case PS2_RET_ACK: case PS2_RET_ACK:
ps2dev->nak = 0; ps2dev->nak = 0;
break;
case PS2_RET_NAK:
ps2dev->flags |= PS2_FLAG_NAK;
ps2dev->nak = PS2_RET_NAK;
break;
case PS2_RET_ERR:
if (ps2dev->flags & PS2_FLAG_NAK) {
ps2dev->flags &= ~PS2_FLAG_NAK;
ps2dev->nak = PS2_RET_ERR;
break; break;
}
case PS2_RET_NAK: /*
ps2dev->flags |= PS2_FLAG_NAK; * Workaround for mice which don't ACK the Get ID command.
ps2dev->nak = PS2_RET_NAK; * These are valid mouse IDs that we recognize.
*/
case 0x00:
case 0x03:
case 0x04:
if (ps2dev->flags & PS2_FLAG_WAITID) {
ps2dev->nak = 0;
break; break;
}
case PS2_RET_ERR: /* Fall through */
if (ps2dev->flags & PS2_FLAG_NAK) { default:
ps2dev->flags &= ~PS2_FLAG_NAK; return 0;
ps2dev->nak = PS2_RET_ERR;
break;
}
/*
* Workaround for mice which don't ACK the Get ID command.
* These are valid mouse IDs that we recognize.
*/
case 0x00:
case 0x03:
case 0x04:
if (ps2dev->flags & PS2_FLAG_WAITID) {
ps2dev->nak = 0;
break;
}
/* Fall through */
default:
return 0;
} }
if (!ps2dev->nak) { if (!ps2dev->nak) {
ps2dev->flags &= ~PS2_FLAG_NAK; ps2dev->flags &= ~PS2_FLAG_NAK;
if (ps2dev->cmdcnt) if (ps2dev->cmdcnt)
......
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