public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Sven Van Asbroeck <svendev@arcx.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Questions rgd. patch "eeprom: at24: support eeproms that do not auto-rollover reads"
Date: Fri, 8 Dec 2017 20:33:14 +0100	[thread overview]
Message-ID: <c00c4e31-fee0-5666-d0a2-a3d53fd146c0@googlemail.com> (raw)

Sorry, I saw this patch only now and there my questions / remarks come
quite late. The intention of the change is clear, just the following:

In at24_adjust_read_count() there is the line
remainder = BIT(bits) - offset;

AFAICS we can have the case offset > BIT(bits). Imagine a 8 bit chip
with size 512 (2 addresses) and we try to read a few bytes from
offset 300. Then the line in question doesn't do what it's supposed
to do.

And a more general aspect: If the size is 512 but only 256 byte are
accessible then I doubt it's nice to create a nvmem provider with
size 512. Wouldn't it be better to adjust byte_len to reflect the
accessible size? Then we also wouldn't need the check in
at24_adjust_read_count.

Rgds, Heiner

             reply	other threads:[~2017-12-08 19:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08 19:33 Heiner Kallweit [this message]
2017-12-08 20:09 ` Questions rgd. patch "eeprom: at24: support eeproms that do not auto-rollover reads" Sven Van Asbroeck
2017-12-08 22:19   ` Heiner Kallweit
2017-12-08 22:25     ` Sven Van Asbroeck

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=c00c4e31-fee0-5666-d0a2-a3d53fd146c0@googlemail.com \
    --to=hkallweit1@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=linux-i2c@vger.kernel.org \
    --cc=svendev@arcx.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