Linux-i2c Archive on lore.kernel.org
 help / color / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-i2c@vger.kernel.org, Jean Delvare <jdelvare@suse.de>
Cc: linux-renesas-soc@vger.kernel.org,
	Wolfram Sang <wsa+renesas@sang-engineering.com>
Subject: [PATCH i2c-tools] Revert "tools: i2ctransfer: add check for returned length from driver"
Date: Tue,  9 Feb 2021 12:05:56 +0100
Message-ID: <20210209110556.18814-1-wsa+renesas@sang-engineering.com> (raw)

This reverts commit 34806fc4e7090b34e32fa1110d546ab5ce01a6a0. It was
developed against an experimental kernel. The regular kernel does not
update the new message length to userspace, so the check is always false
positive. We can't change the kernel behaviour because it would break
the ABI. So revert this commit.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Very embarrasing :( I am sorry for this. Jean, maybe this is worth a
4.2.1. release?

 tools/i2ctransfer.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/tools/i2ctransfer.c b/tools/i2ctransfer.c
index f2a4df8..b0e8d43 100644
--- a/tools/i2ctransfer.c
+++ b/tools/i2ctransfer.c
@@ -88,12 +88,7 @@ static void print_msgs(struct i2c_msg *msgs, __u32 nmsgs, unsigned flags)
 		int recv_len = msgs[i].flags & I2C_M_RECV_LEN;
 		int print_buf = (read && (flags & PRINT_READ_BUF)) ||
 				(!read && (flags & PRINT_WRITE_BUF));
-		__u16 len = msgs[i].len;
-
-		if (recv_len && print_buf && len != msgs[i].buf[0] + 1) {
-			fprintf(stderr, "Correcting wrong msg length after recv_len! Please fix the I2C driver and/or report.\n");
-			len = msgs[i].buf[0] + 1;
-		}
+		__u16 len = recv_len ? msgs[i].buf[0] + 1 : msgs[i].len;
 
 		if (flags & PRINT_HEADER) {
 			fprintf(output, "msg %u: addr 0x%02x, %s, len ",
-- 
2.28.0


             reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 11:05 Wolfram Sang [this message]
2021-02-26 16:43 ` Jean Delvare
2021-03-10 20:46   ` Wolfram Sang
2021-04-10  8:14     ` Peter Korsgaard
2021-04-13 12:54       ` Wolfram Sang
2021-04-21 20:01         ` Peter Korsgaard
2021-05-21 11:21         ` Jean Delvare
2021-05-25 20:36           ` Wolfram Sang
2021-06-02  9:03             ` Jean Delvare
2021-06-02 16:25               ` Wolfram Sang
2021-06-04 13:57                 ` Jean Delvare
2021-06-04 19:21                   ` Wolfram Sang
2021-06-08 12:22                     ` Jean Delvare
2021-06-08 12:26                       ` Wolfram Sang
2021-05-21 11:16       ` Jean Delvare
2021-03-07  5:42 ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210209110556.18814-1-wsa+renesas@sang-engineering.com \
    --to=wsa+renesas@sang-engineering.com \
    --cc=jdelvare@suse.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-i2c Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-i2c/0 linux-i2c/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-i2c linux-i2c/ https://lore.kernel.org/linux-i2c \
		linux-i2c@vger.kernel.org
	public-inbox-index linux-i2c

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-i2c


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git