diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-02-21 06:50:13 +0100 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-04-04 01:24:31 +0200 |
commit | e9f66cdb7d5b9c05a76dde4ca5f217ba4af7f333 (patch) | |
tree | 03b4c132963b87e66d567584c72a32a4dba5b79b /drivers/input/touchscreen | |
parent | Input: eeti_ts - use BIT(n) (diff) | |
download | linux-e9f66cdb7d5b9c05a76dde4ca5f217ba4af7f333.tar.xz linux-e9f66cdb7d5b9c05a76dde4ca5f217ba4af7f333.zip |
Input: eeti_ts - use get_unaligned_be16() to retrieve data
Instead of manually converting big endian data on wire into host
endianness, let's use helpers to do that for us. It might save us
a few cycles if host endianness matches what's on wire.
Reviewed-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/eeti_ts.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c index 26b52496748a..0e4b19236d68 100644 --- a/drivers/input/touchscreen/eeti_ts.c +++ b/drivers/input/touchscreen/eeti_ts.c @@ -34,6 +34,7 @@ #include <linux/gpio.h> #include <linux/input/eeti_ts.h> #include <linux/slab.h> +#include <asm/unaligned.h> static bool flip_x; module_param(flip_x, bool, 0644); @@ -89,8 +90,9 @@ static void eeti_ts_read(struct work_struct *work) pressed = buf[0] & REPORT_BIT_PRESSED; res = REPORT_RES_BITS(buf[0] & (REPORT_BIT_AD0 | REPORT_BIT_AD1)); - x = buf[2] | (buf[1] << 8); - y = buf[4] | (buf[3] << 8); + + x = get_unaligned_be16(&buf[1]); + y = get_unaligned_be16(&buf[3]); /* fix the range to 11 bits */ x >>= res - EETI_TS_BITDEPTH; |