Message ID | 20230402200951.1032513-9-dario.binacchi@amarulasolutions.com |
---|---|
State | New |
Headers | show
Return-Path: <linux-amarula+bncBCQ4XFG47UFRBMOCU6QQMGQEBOX2GUY@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 772703F330 for <linux-amarula@patchwork.amarulasolutions.com>; Sun, 2 Apr 2023 22:10:25 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id t26-20020a50d71a000000b005003c5087casf37756105edi.1 for <linux-amarula@patchwork.amarulasolutions.com>; Sun, 02 Apr 2023 13:10:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680466225; cv=pass; d=google.com; s=arc-20160816; b=Rde3PbLPqFuErVq8cw8mivI+Dr2iikJGod8XHF8n1Ai9WJU+DZRIeLPnwBmKw3Eh/z c7Dre6guv9eVeGsTKgsnDVUSHs+mlEpImN4r4nBU3XgOZef7Z2NZpT57d11UNnTT+fcn 5Tkzibv9yaw8msJzcUmtEyWjvVJQmABSW1qbsVXalh+InQDQVfXUe+9nBBJHJsnGXlRa pq4wGgxLv4EAKPXi+hdmT9gC3z/h0+Bc+ERY0BrMn+CAMp0YKCvktkyf+Ra8tct9gaqS 2WyodOLTGl9qFxsLdzO9/eyehPASBH+N5i9d0Cpukt2DfJGtSRvI55TyAdx4ZMwDMEjF IKxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=fNnmqD/LdCjSHcCGEp+0wqpp1Whr3zvyBWeediEnCUY=; b=Ux7tD/zFjalFsQMhgD+lYKeMDqMSGxKyDl7hUDHUDgBo6PXlVtRnOOlGBxnwqa87uS 6YRBeCEoHAVRyXhSTiRUlLro+O5+5mcXnkKfzq2x0V99y11pCNJzfXN/db9bwwEAVx3V L8TR5aNQ8kvJrK6L8llcekPe7jLBnMxPAMpPST7GIr1zK4UwgPqODYplbTLJYYKN0de+ u0Jl9zI5pxfXWQIS/hOs1Wkvp3G7YWwtSVArMdA3KUaaTrNMXfK8CVMonWsI6Z9JeWwg IDeIvUFVsxOa2mAEsBQ12PWxiRycgFogNqLo7Xtbh4c55Z4Kerldsw4/k79h98vVzPlV f+Rw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="ZX/RqwIv"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680466225; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=fNnmqD/LdCjSHcCGEp+0wqpp1Whr3zvyBWeediEnCUY=; b=rnpzeiOVQVBSccwv0B5zpMQvbOYkG3YEnN60WUqYhf9mINjyoC94hdBcCLwNw1061u SaoPl03UPbUPOxdTUc82h//ip4en2ndJ09+Svkz+aiVnGGeHx2RuGKohKzw+LJ6O1iZW xxJ0mN/KL1/KBmke22jxXW2xdD9y5hixHhDdo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680466225; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fNnmqD/LdCjSHcCGEp+0wqpp1Whr3zvyBWeediEnCUY=; b=uZ8Z76mo4XFwXwbpCp5QcBm/d8p4Czqy0jokKzZYab5OHouUg/L9kUc+2TnKyqHide RtDLBZhMTb0pRP48UrYfyIfroTkrpzVzytH6nTwp5hEYGA/vYG5XtADCKjRfMhMAZj2P WRtdNEx8A2t+DeGD57R19iW9QqJfOzuHcJxXbYSHPUpMRtX3ovL0aOHuF0JlbMb6ptSr dPDLGCp9ONX7X3MMXO3S8qbRlyagvt7LzjCFhIwpMyLEbML+rnX4SgPEjpyVw2bt7WBO ovJHtCm+DdvwLMgz+OLM6dR/330i6dKSqnNhkDsO5G7mdmjKQv7iem0m3xpthkTvac5q UeJw== X-Gm-Message-State: AAQBX9cXcbI2pY4KbjeEX0ZKYZvlCNsJJys/aZYGeHvu0xGFXC+z0tJB 0NIEo85wqlxh7G7T8lkjJsT7hNik X-Google-Smtp-Source: AKy350ZgA7pGjqJL2FSDWfJjsxB52RpQUULp08z3+jpzpEMh/BSRM4X50hQLBSUsx/cN7ZwNHGEb4Q== X-Received: by 2002:a17:906:4887:b0:931:dd22:4486 with SMTP id v7-20020a170906488700b00931dd224486mr17933357ejq.8.1680466225149; Sun, 02 Apr 2023 13:10:25 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:c5c7:b0:93c:2338:ccdf with SMTP id ts7-20020a170907c5c700b0093c2338ccdfls4636260ejc.10.-pod-prod-gmail; Sun, 02 Apr 2023 13:10:24 -0700 (PDT) X-Received: by 2002:a17:907:a04:b0:947:bf71:a548 with SMTP id bb4-20020a1709070a0400b00947bf71a548mr8370411ejc.4.1680466223737; Sun, 02 Apr 2023 13:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680466223; cv=none; d=google.com; s=arc-20160816; b=tXaQKWybTWfqAkNk3CGoKvyWxbju4NOwlZjarekonkGEDlddD3G+zhfPXjTMfM5F5d H53sH57RLfiqbZID3LKZG3TlAY4FSWNdzSQzYR9qxKukm1PeN+t+T9CUmoDNcVSwPxqN KALT0CY6UNx7bORP9BozZ+/1Y5veftrgk2MKdH50zyV5gEVl88FSKH1rkTDjrLQbFFlx zoGcEopnjETZAihQKv/CQrKiaIHVngglgnhILSky/LSO0X8uFHL1W7qSQBSBboqU1eK5 Ck3PeENj/clxpX8w5ohPyWagvN+d9GobgCZfthSjcCBjo/UXFcGDAsJ1IEyz1hSmdr6+ nzaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=vKHTsVqE1aT1cdcOBW/aMh8k9NVa86bMl3ifc5Yx2Wk=; b=qHxH0CQy0+Wbmd/VKkA0v+1+64z928CooMh7mUsxyVVjUmZ2h58g7MIQu6xKUOaKLz il+swoOdlPiBdV1zG988SAVTItFdjWCcSt5IWFIcBuh96wWPWurIrKm3FiIy4FOo9cUT Gx1OJ6slzSHtG42hL4BtghIfl0mkVuoPI3ZbCYkzxdeTnFaWsBnekFEmvJQbtzb/wy+r 9Dd8Pdgj2Vx+DV7CpsIn1ZvyF14z5D9lUq3C8plCrhpo72b3tzEWQ0KYxhnai+OT62Ms 5VtueBZ9T5YW0+K/hgbhbkolAlQIZjOciEMKnxl0nzAXU/zU6gXDYIOdzBuTTUUZ74B4 C8Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="ZX/RqwIv"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id og42-20020a1709071dea00b008e9d29ca1e9sor3981401ejc.31.2023.04.02.13.10.23 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Sun, 02 Apr 2023 13:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:906:4a4e:b0:889:1eb1:7517 with SMTP id a14-20020a1709064a4e00b008891eb17517mr35894731ejv.30.1680466223564; Sun, 02 Apr 2023 13:10:23 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-95-248-31-153.retail.telecomitalia.it. [95.248.31.153]) by smtp.gmail.com with ESMTPSA id gl18-20020a170906e0d200b00924d38bbdc0sm3553127ejb.105.2023.04.02.13.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Apr 2023 13:10:23 -0700 (PDT) From: Dario Binacchi <dario.binacchi@amarulasolutions.com> To: linux-kernel@vger.kernel.org Cc: michael@amarulasolutions.com, linux-amarula@amarulasolutions.com, Dario Binacchi <dario.binacchi@amarulasolutions.com>, Dmitry Torokhov <dmitry.torokhov@gmail.com>, Jonathan Cameron <Jonathan.Cameron@huawei.com>, Oliver Graute <oliver.graute@kococonnector.com>, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, Wolfram Sang <wsa+renesas@sang-engineering.com>, linux-input@vger.kernel.org Subject: [PATCH 8/9] Input: edt-ft5x06 - unify the crc check Date: Sun, 2 Apr 2023 22:09:50 +0200 Message-Id: <20230402200951.1032513-9-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230402200951.1032513-1-dario.binacchi@amarulasolutions.com> References: <20230402200951.1032513-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="ZX/RqwIv"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
Series |
|
Related |
show
|
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]; }
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@amarulasolutions.com> --- drivers/input/touchscreen/edt-ft5x06.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)