summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDario Binacchi <dario.binacchi@amarulasolutions.com>2023-04-02 21:27:34 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2023-04-02 21:37:56 -0700
commit38e8cf7b97612a7e615e498987bd0758a65633c6 (patch)
treec69decc0afb32953318bfa3fb318d586cc025fbe /drivers
parentf8a2257056d9e60e4339072e8e89a5a708a99d40 (diff)
Input: edt-ft5x06 - don't recalculate the CRC
There is no need to recalculate the CRC when the data has not changed. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230402200951.1032513-5-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/touchscreen/edt-ft5x06.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index c96fe6520578..d4f39724b259 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -319,7 +319,7 @@ static int edt_ft5x06_register_write(struct edt_ft5x06_ts_data *tsdata,
static int edt_ft5x06_register_read(struct edt_ft5x06_ts_data *tsdata,
u8 addr)
{
- u8 wrbuf[2], rdbuf[2];
+ u8 wrbuf[2], rdbuf[2], crc;
int error;
switch (tsdata->version) {
@@ -333,11 +333,11 @@ static int edt_ft5x06_register_read(struct edt_ft5x06_ts_data *tsdata,
if (error)
return error;
- if ((wrbuf[0] ^ wrbuf[1] ^ rdbuf[0]) != rdbuf[1]) {
+ crc = wrbuf[0] ^ wrbuf[1] ^ rdbuf[0];
+ if (crc != rdbuf[1]) {
dev_err(&tsdata->client->dev,
"crc error: 0x%02x expected, got 0x%02x\n",
- wrbuf[0] ^ wrbuf[1] ^ rdbuf[0],
- rdbuf[1]);
+ crc, rdbuf[1]);
return -EIO;
}
break;