[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230402200951.1032513-9-dario.binacchi@amarulasolutions.com>
Date: Sun, 2 Apr 2023 22:09:50 +0200
From: Dario Binacchi <dario.binacchi@...rulasolutions.com>
To: linux-kernel@...r.kernel.org
Cc: michael@...rulasolutions.com, linux-amarula@...rulasolutions.com,
Dario Binacchi <dario.binacchi@...rulasolutions.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Oliver Graute <oliver.graute@...oconnector.com>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
linux-input@...r.kernel.org
Subject: [PATCH 8/9] Input: edt-ft5x06 - unify the crc check
With this patch, the CRC is always verified by the same function, even in
the case of accessing registers where the number of bytes is minimal.
Signed-off-by: Dario Binacchi <dario.binacchi@...rulasolutions.com>
---
drivers/input/touchscreen/edt-ft5x06.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 8aae4c1e6b73..fdb32e3591be 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -240,13 +240,10 @@ static int edt_M06_i2c_read(void *context, const void *reg_buf, size_t reg_size,
if (!edt_ft5x06_ts_check_crc(tsdata, val_buf, val_size))
return -EIO;
} else if (reg_read) {
- u8 crc = wbuf[0] ^ wbuf[1] ^ rbuf[0];
-
- if (crc != rbuf[1]) {
- dev_err(dev, "crc error: 0x%02x expected, got 0x%02x\n",
- crc, rbuf[1]);
+ wbuf[2] = rbuf[0];
+ wbuf[3] = rbuf[1];
+ if (!edt_ft5x06_ts_check_crc(tsdata, wbuf, 4))
return -EIO;
- }
*((u8 *)val_buf) = rbuf[0];
}
--
2.32.0
Powered by blists - more mailing lists