linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Stodden <daniel.stodden@gmail.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH i2c-tools] i2ctransfer: add support for I2C_M_RECV_LEN
Date: Mon, 3 Aug 2020 00:30:46 -0700	[thread overview]
Message-ID: <C82A0A94-A06B-4D42-B71B-F14D48D5E029@gmail.com> (raw)
In-Reply-To: <20200802213828.GB13339@kunai>



> On Aug 2, 2020, at 2:38 PM, Wolfram Sang <wsa+renesas@sang-engineering.com> wrote:
> 
> Hi Daniel,
> 
>>> +		__u16 len = recv_len ? msgs[i].buf[0] + 1 : msgs[i].len;
>> 
>> This is post-ioctl()? (Sorry, still not familiar enough with i2c-tools.)
> 
> Yes, read buffers are only printed after the ioctl. And 'print_msgs' is
> probably the most complex function within this tool :/
> 
>> It isn’t wrong, but shouldn’t be necessary.
>> Unless the adapter driver you’re using went astray. Not ruling that out.
> 
> I have just checked existing I2C_M_RECV_LEN handling. Quite some drivers
> do it wrong. And there is no consistency in what they return. Lots of
> things to fix there...

Would be curious about what variants are there.

Note that msgs[i].len isn’t updated, you only get <extra_bytes> of data back,
so the difference would be severe: msgs[i].len is what guides copy_to_user().

https://github.com/torvalds/linux/blob/master/drivers/i2c/i2c-dev.c#L301

Daniel


  reply	other threads:[~2020-08-03  7:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 19:28 [PATCH i2c-tools] i2ctransfer: add support for I2C_M_RECV_LEN Wolfram Sang
2020-08-02 20:28 ` Daniel Stodden
2020-08-02 21:38   ` Wolfram Sang
2020-08-03  7:30     ` Daniel Stodden [this message]
2020-08-03  8:38       ` Wolfram Sang
2020-08-03 20:25         ` Daniel Stodden
2020-08-03 20:45           ` Wolfram Sang
2020-08-03 19:14 ` 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=C82A0A94-A06B-4D42-B71B-F14D48D5E029@gmail.com \
    --to=daniel.stodden@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).