linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Wolfram Sang <wsa@the-dreams.de>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-i2c@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] i2c: stub: Add support for SMBus block commands
Date: Tue, 8 Jul 2014 21:54:53 +0200	[thread overview]
Message-ID: <20140708215453.0677d3ed@endymion.delvare> (raw)
In-Reply-To: <1404742983-27303-1-git-send-email-linux@roeck-us.net>

Hi Guenter,

On Mon,  7 Jul 2014 07:23:03 -0700, Guenter Roeck wrote:
> SMBus block commands are different to I2C block commands since
> the returned data is not normally accessible with byte or word
> commands on other command offsets. Add linked list of 'block'
> commands to support those commands.
> 
> Access mechanism is quite simple: Block commands must be written
> before they can be read. The first write selects the block length.
> Subsequent writes can be partial. Block read commands always return
> the number of bytes selected with the first write.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2: Make new functionality only available on request via functionality
>     module parameter
>     Add more details about SMBus block mode support to documentation
>     Use correct sizeof() variable in devm_kzalloc
>     Use stub_find_block() only in SMBus block command itself.
>     Store first word of block data in chip->words[].
>     When writing block data and the written data is longer than
>     the first write, bail out with debug message indicating the reason
>     for the error.

Looks good, thanks for the quick update.

Reviewed-by: Jean Delvare <jdelvare@suse.de>

Just one thing I have been thinking about while reviewing the updated
code... You decided to make the first SMBus block write select the
maximum block length, and you always use that for SMBus block reads.
However you accept partial writes. The fact that the order in which
writes are performed has an effect on which writes are accepted is
somewhat unexpected.

Wouldn't it make more sense to accept all SMBus block writes,
regardless of the size (as long as it is within the limits of the SMBus
standard, of course)? Then the only thing left to decide is whether
SMBus block reads use the maximum size or the size of the most recent
SMBus block write.

I suspect this would mimic the behavior of real chips better. What do
you think?

-- 
Jean Delvare
SUSE L3 Support

  reply	other threads:[~2014-07-08 19:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07 14:23 [PATCH v2] i2c: stub: Add support for SMBus block commands Guenter Roeck
2014-07-08 19:54 ` Jean Delvare [this message]
     [not found]   ` <20140708215453.0677d3ed-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2014-07-08 20:05     ` Guenter Roeck
2014-07-12  9:20       ` Jean Delvare
     [not found]         ` <20140712112019.618d8a03-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2014-07-12 14:26           ` Guenter Roeck
2014-07-12 15:05           ` Guenter Roeck
2014-07-13  7:21             ` Jean Delvare
2014-07-13 15:04               ` Guenter Roeck
2014-07-13 15:13                 ` Jean Delvare
     [not found]                   ` <20140713171343.0a4ba58d-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2014-07-13 15:46                     ` Guenter Roeck
     [not found]                       ` <53C2A9E1.2080807-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-07-13 18:29                         ` Sanford Rockowitz
2014-07-17 13:21 ` Wolfram Sang
2014-07-17 13:40   ` Jean Delvare
     [not found]     ` <20140717154020.650ad59c-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2014-07-17 16:56       ` [PATCH v3] " Guenter Roeck
2014-07-17 17:12         ` 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=20140708215453.0677d3ed@endymion.delvare \
    --to=jdelvare@suse.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rdunlap@infradead.org \
    --cc=wsa@the-dreams.de \
    /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).