Skip to content

Commit 38e8cf7

Browse files
passgatdtor
authored andcommitted
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>
1 parent f8a2257 commit 38e8cf7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/input/touchscreen/edt-ft5x06.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static int edt_ft5x06_register_write(struct edt_ft5x06_ts_data *tsdata,
319319
static int edt_ft5x06_register_read(struct edt_ft5x06_ts_data *tsdata,
320320
u8 addr)
321321
{
322-
u8 wrbuf[2], rdbuf[2];
322+
u8 wrbuf[2], rdbuf[2], crc;
323323
int error;
324324

325325
switch (tsdata->version) {
@@ -333,11 +333,11 @@ static int edt_ft5x06_register_read(struct edt_ft5x06_ts_data *tsdata,
333333
if (error)
334334
return error;
335335

336-
if ((wrbuf[0] ^ wrbuf[1] ^ rdbuf[0]) != rdbuf[1]) {
336+
crc = wrbuf[0] ^ wrbuf[1] ^ rdbuf[0];
337+
if (crc != rdbuf[1]) {
337338
dev_err(&tsdata->client->dev,
338339
"crc error: 0x%02x expected, got 0x%02x\n",
339-
wrbuf[0] ^ wrbuf[1] ^ rdbuf[0],
340-
rdbuf[1]);
340+
crc, rdbuf[1]);
341341
return -EIO;
342342
}
343343
break;

0 commit comments

Comments
 (0)