Re: [RFC PATCH v3 1/4] i2c: rust: implement kernel::io::Io trait for I2cClient
From: Muchamad Coirul Anwar
Date: Tue Jun 02 2026 - 04:19:41 EST
On Mon, 1 Jun 2026 10:05:00 +0100
Jonathan Cameron <jic23@xxxxxxxxxx> 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.
Thanks,
Coirul