Re: [RFC PATCH 1/3] rust: i2c: add SMBus byte transfer helpers

From: Igor Korotin

Date: Sat Jul 11 2026 - 06:34:30 EST


Hi Bruce,

Thanks for the patch. Same feedback I gave Muchamad on a similar patch:
I2cClient should implement the `Io` trait rather than adding standalone
SMBus methods like these -- this was already agreed on previously [1][2].

There's also an in-flight series doing exactly this rework right now:
Muchamad's "[RFC PATCH v4 1/3] i2c: rust: implement SMBus read
abstraction via kernel::io::Io for I2cClient". Worth looking at before
reworking this yourself, both to avoid landing two competing
implementations of the same thing, and because I've just raised a
problem with that approach that affects this patch too: overriding
try_read8()/try_read16() isn't enough on its own -- the generic
try_read/try_write/try_update entry points still silently swallow real
SMBus failures (NACK, arbitration loss, timeout) unless every one of
them gets the same treatment. Your smbus_update_bits() is exactly the
kind of read-modify-write that's affected (my reply on that thread,
Message-ID <178376430529.16552.7043868463863908196@xxxxxxxxx>, has the
detailed breakdown).

I'd suggest holding this patch until that discussion settles -- Cc'ing
Danilo here too, since it's ultimately a question of whether
Io/IoCapable is the right abstraction for I2C at all -- rather than
reworking it in parallel.

Cheers
Igor

[1] https://lore.kernel.org/rust-for-linux/20260131-i2c-adapter-v1-4-5a436e34cd1a@xxxxxxxxx/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git/commit/?h=driver-core-testing&id=121d87b28e1d9061d3aaa156c43a627d3cb5e620