mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Måns Rullgård" <mans@mansr.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] i2c: xlr: fix extra read/write at end of rx transfer
Date: Tue, 15 Dec 2015 12:48:06 +0000	[thread overview]
Message-ID: <yw1x4mfjho8p.fsf@unicorn.mansr.com> (raw)
In-Reply-To: <20151215122119.GB1521@katana> (Wolfram Sang's message of "Tue, 15 Dec 2015 13:21:19 +0100")

Wolfram Sang <wsa@the-dreams.de> writes:

> On Mon, Nov 02, 2015 at 02:03:37AM +0000, Mans Rullgard wrote:
>> The BYTECNT register holds the transfer size minus one.  Setting it
>> to the correct value requires a dummy read/write only for zero-length
>> transfers as it is impossible to request one from the hardware.  If a
>> zero-length transfer is requested, changing the length to 1 and setting
>> "buf" to a dummy location allows making the main loops less convoluted.
>> 
>> In other words, this patch makes the driver transfer the number of bytes
>> requested unless this is zero, which is not supported by the hardware,
>> in which case one byte is transferred instead.
>
> Uh, this is wrong, zero byte should really not transfer anything. We
> need to fix that and bail out, so probably something like
>
> 	if (!len)
> 		return -EOPNOTSUPP;

So the existing driver is wrong to allow it.  Makes sense to drop that.

> Also, the xlr_func() should mask out I2C_FUNC_SMBUS_QUICK.

OK.

> Other than that, the patch looks good to me.
>
> Out of curiosity, your first driver had the registers 32bit apart. Now
> you can deal with 8bit. Is this configurable on this SoC?

It's all 32 bits.  The XLR driver uses a u32 * to access the registers.

-- 
Måns Rullgård

  reply	other threads:[~2015-12-15 12:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02  2:03 [PATCH 1/3] i2c: xlr: add support for Sigma Designs controller variant Mans Rullgard
2015-11-02  2:03 ` [PATCH 2/3] i2c: xlr: fix extra read/write at end of rx transfer Mans Rullgard
2015-12-15 12:21   ` Wolfram Sang
2015-12-15 12:48     ` Måns Rullgård [this message]
2015-11-02  2:03 ` [PATCH 3/3] i2c: xlr: add interrupt support for Sigma Designs chips Mans Rullgard
2015-12-15 12:23   ` Wolfram Sang
2015-11-21 12:02 ` [PATCH 1/3] i2c: xlr: add support for Sigma Designs controller variant Måns Rullgård
2015-12-15 12: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=yw1x4mfjho8p.fsf@unicorn.mansr.com \
    --to=mans@mansr.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®