diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-08-23 22:50:33 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-09-05 22:56:46 -0700 |
commit | 83b6549ee18885c1ac74ae91a7e406e7ed33b5c8 (patch) | |
tree | 20757a34e83c77867807836bac7622d509083040 /drivers/input | |
parent | 5c2002677e8f428d63369ea65ee008967147527e (diff) | |
download | linux-stable-83b6549ee18885c1ac74ae91a7e406e7ed33b5c8.tar.gz linux-stable-83b6549ee18885c1ac74ae91a7e406e7ed33b5c8.tar.bz2 linux-stable-83b6549ee18885c1ac74ae91a7e406e7ed33b5c8.zip |
Input: zforce_ts - switch to using get_unaligned_le16
Instead of doing conversion from little-endian data to CPU endianness
by hand use existing helpers.
Tested-by: Andreas Kemnade <andreas@kemnade.info> # Tolino Shine2HD
Link: https://lore.kernel.org/r/20240824055047.1706392-10-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/zforce_ts.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 0dea389594bd..32f3d74bd339 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -22,6 +22,7 @@ #include <linux/property.h> #include <linux/regulator/consumer.h> #include <linux/slab.h> +#include <asm/unaligned.h> #define WAIT_TIMEOUT msecs_to_jiffies(1000) @@ -327,10 +328,8 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) } for (i = 0; i < count; i++) { - point.coord_x = - payload[9 * i + 2] << 8 | payload[9 * i + 1]; - point.coord_y = - payload[9 * i + 4] << 8 | payload[9 * i + 3]; + point.coord_x = get_unaligned_le16(&payload[9 * i + 1]); + point.coord_y = get_unaligned_le16(&payload[9 * i + 3]); if (point.coord_x > ts->prop.max_x || point.coord_y > ts->prop.max_y) { @@ -521,14 +520,15 @@ static irqreturn_t zforce_irq_thread(int irq, void *dev_id) * Version Payload Results * [2:major] [2:minor] [2:build] [2:rev] */ - ts->version_major = (payload[RESPONSE_DATA + 1] << 8) | - payload[RESPONSE_DATA]; - ts->version_minor = (payload[RESPONSE_DATA + 3] << 8) | - payload[RESPONSE_DATA + 2]; - ts->version_build = (payload[RESPONSE_DATA + 5] << 8) | - payload[RESPONSE_DATA + 4]; - ts->version_rev = (payload[RESPONSE_DATA + 7] << 8) | - payload[RESPONSE_DATA + 6]; + ts->version_major = + get_unaligned_le16(&payload[RESPONSE_DATA]); + ts->version_minor = + get_unaligned_le16(&payload[RESPONSE_DATA + 2]); + ts->version_build = + get_unaligned_le16(&payload[RESPONSE_DATA + 4]); + ts->version_rev = + get_unaligned_le16(&payload[RESPONSE_DATA + 6]); + dev_dbg(&ts->client->dev, "Firmware Version %04x:%04x %04x:%04x\n", ts->version_major, ts->version_minor, |