From d4f7115e8255cb9f0a6f0d5ee5ecd66986023891 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 19 Jul 2023 15:49:12 +0100 Subject: [PATCH] input: edt-ft5x06: Fix patch reading only the number of points reported Fix bad conflict resolution from upstream updates. Need to read from tsdata->tdata_offset bytes, not from tsdata->offset. Also fix logging of i2c read errors to cover both transactions. Fixes: 7216fcfe2e5f ("input: edt-ft5x06: Only read data for number of points reported") Signed-off-by: Dave Stevenson --- drivers/input/touchscreen/edt-ft5x06.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index e29d034fbf8432..d6e3478504f870 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -317,12 +317,6 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id) memset(rdbuf, 0, sizeof(rdbuf)); error = regmap_bulk_read(tsdata->regmap, tsdata->tdata_cmd, rdbuf, tsdata->tdata_len); - if (error) { - dev_err_ratelimited(dev, "Unable to fetch data, error: %d\n", - error); - goto out; - } - if (tsdata->version == EDT_M06) { num_points = tsdata->max_support_points; } else { @@ -330,11 +324,16 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id) * points. */ num_points = min(rdbuf[2] & 0xf, tsdata->max_support_points); - if (num_points) + if (!error && num_points) error = regmap_bulk_read(tsdata->regmap, - tsdata->offset, - &rdbuf[tsdata->tdata_offset], - tsdata->point_len * num_points); + tsdata->tdata_offset, + &rdbuf[tsdata->tdata_offset], + tsdata->point_len * num_points); + } + if (error) { + dev_err_ratelimited(dev, "Unable to fetch data, error: %d\n", + error); + goto out; } for (i = 0; i < num_points; i++) {