From: Jonathan Cameron <jic23@kernel.org>
To: Muchamad Coirul Anwar <muchamadcoirulanwar@gmail.com>
Cc: linux-iio@vger.kernel.org, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org, Miguel Ojeda <ojeda@kernel.org>,
Igor Korotin <igor.korotin.linux@gmail.com>,
Brandon Saint-John <branstj@gmail.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-i2c@vger.kernel.org
Subject: Re: [RFC PATCH v3 1/4] i2c: rust: implement kernel::io::Io trait for I2cClient
Date: Tue, 2 Jun 2026 12:59:19 +0100 [thread overview]
Message-ID: <20260602125919.4b289ce2@jic23-huawei> (raw)
In-Reply-To: <CAO26r3QLJ1ZR1Qfjr6wQo+e3H6v=Z=bxkeE8+nseajYgWLbi4g@mail.gmail.com>
On Tue, 2 Jun 2026 15:11:12 +0700
Muchamad Coirul Anwar <muchamadcoirulanwar@gmail.com> wrote:
> On Mon, 1 Jun 2026 10:05:00 +0100
> Jonathan Cameron <jic23@kernel.org> wrote:
>
> > +CC linux-i2c and Wolfram - make sure to keep them on future versions
> > of this patch.
>
> Noted.
>
> > If this was renamed to make it the rust smbus binding then I wouldn't
> > be as bothered by this. For something claiming to be I2C this is a
> > misleading interface and I am very much against it.
>
> Agreed. I'll rename it to make it clearly SMBus-scoped in v4.
>
> > Understood that there is more to do, but given the regmap already
> > encapsulates the smbus support you have here, I'd be much more in
> > favour of the focus going on getting that done.
> >
> > I would almost suggest not merging a non regmap interface for what you
> > cover here, except we do get annoying corner cases where the device
> > uses a mixture of smbus like commands and non smbus so there probably
> > will need to be support at the i2c / smbus level.
>
> Makes sense. Will defer to Wolfram and the i2c folks on whether this
> should wait for regmap or land as a clearly-scoped SMBus patch.
>
>
> > Is this separating a safety argument from a bug check? If so why
> > not just use the tighter one?
>
> > + fn maxsize(&self) -> usize {
> > + 256
> > + }
>
> The try_read8 here is a general SMBus wrapper, not AS5600-specific.
> The u8 command (register address) applies to any SMBus device, so
> 8-bit is the protocol max. If we tighten below that, it breaks devices
> with registers at 0x80 and above. The 7-bit limit applies to the
> device address, not this command byte.
Ah.. Sorry, I was being stupid and had forgotten the meaning
of the address byte (which device + that magic r/w bit which
is oddly in that byte). I even read wrong section of the smbus
protocol description as it has both read byte and read byte data
only the second of which takes a command byte.
I think I got thrown by the generic naming of try_read8 that
doesn't capture that distinction but given it comes from the trait
I guess we can't do much about that.
Jonathan
>
> Thanks,
> Coirul
prev parent reply other threads:[~2026-06-02 11:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260524132824.54918-1-muchamadcoirulanwar@gmail.com>
[not found] ` <20260524132824.54918-2-muchamadcoirulanwar@gmail.com>
[not found] ` <20260528162557.2b0b28d9@jic23-huawei>
[not found] ` <CAO26r3QZyVco2aZRqPSyWr3d-SBAVEknkaeNDM4g5DFCr3-2aw@mail.gmail.com>
2026-06-01 9:05 ` [RFC PATCH v3 1/4] i2c: rust: implement kernel::io::Io trait for I2cClient Jonathan Cameron
2026-06-02 8:11 ` Muchamad Coirul Anwar
2026-06-02 11:59 ` Jonathan Cameron [this message]
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=20260602125919.4b289ce2@jic23-huawei \
--to=jic23@kernel.org \
--cc=branstj@gmail.com \
--cc=igor.korotin.linux@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=muchamadcoirulanwar@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@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