diff options
author | Seth Forshee <seth.forshee@canonical.com> | 2011-11-07 22:53:30 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-11-08 01:22:10 -0500 |
commit | b46615fe9215214ac00e26d35fc54dbe1c510803 (patch) | |
tree | df6115091e069aa05125b822554ef05e8b839aa5 /drivers/input/mouse/alps.c | |
parent | fa629ef5222193214da9a2b3c94369f79353bec9 (diff) |
Input: ALPS - remove assumptions about packet size
In preparation for version 4 protocol support, which has 8-byte
data packets, remove all hard-coded assumptions about packet size
and use psmouse->pktsize instead.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/alps.c')
-rw-r--r-- | drivers/input/mouse/alps.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 77b776d99377..44a0a712aaa2 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -308,7 +308,7 @@ static void alps_flush_packet(unsigned long data) | |||
308 | 308 | ||
309 | serio_pause_rx(psmouse->ps2dev.serio); | 309 | serio_pause_rx(psmouse->ps2dev.serio); |
310 | 310 | ||
311 | if (psmouse->pktcnt == 6) { | 311 | if (psmouse->pktcnt == psmouse->pktsize) { |
312 | 312 | ||
313 | /* | 313 | /* |
314 | * We did not any more data in reasonable amount of time. | 314 | * We did not any more data in reasonable amount of time. |
@@ -359,8 +359,8 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
359 | return PSMOUSE_BAD_DATA; | 359 | return PSMOUSE_BAD_DATA; |
360 | } | 360 | } |
361 | 361 | ||
362 | /* Bytes 2 - 6 should have 0 in the highest bit */ | 362 | /* Bytes 2 - pktsize should have 0 in the highest bit */ |
363 | if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= 6 && | 363 | if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && |
364 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { | 364 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { |
365 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", | 365 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", |
366 | psmouse->pktcnt - 1, | 366 | psmouse->pktcnt - 1, |
@@ -368,7 +368,7 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
368 | return PSMOUSE_BAD_DATA; | 368 | return PSMOUSE_BAD_DATA; |
369 | } | 369 | } |
370 | 370 | ||
371 | if (psmouse->pktcnt == 6) { | 371 | if (psmouse->pktcnt == psmouse->pktsize) { |
372 | alps_process_packet(psmouse); | 372 | alps_process_packet(psmouse); |
373 | return PSMOUSE_FULL_PACKET; | 373 | return PSMOUSE_FULL_PACKET; |
374 | } | 374 | } |
@@ -529,7 +529,7 @@ static int alps_tap_mode(struct psmouse *psmouse, int enable) | |||
529 | static int alps_poll(struct psmouse *psmouse) | 529 | static int alps_poll(struct psmouse *psmouse) |
530 | { | 530 | { |
531 | struct alps_data *priv = psmouse->private; | 531 | struct alps_data *priv = psmouse->private; |
532 | unsigned char buf[6]; | 532 | unsigned char buf[sizeof(psmouse->packet)]; |
533 | bool poll_failed; | 533 | bool poll_failed; |
534 | 534 | ||
535 | if (priv->i->flags & ALPS_PASS) | 535 | if (priv->i->flags & ALPS_PASS) |