Re: [RFC PATCH v7 2/4] i2c: rust: implement SMBus access via IoBackend

From: Markus Probst

Date: Sun Nov 22 2026 - 08:34:27 EST


On Mon, 2026-11-09 at 22:57 +0700, Muchamad Coirul Anwar wrote:
> Implement fallible SMBus byte and word access for bound I2C clients
> using the generic I/O backend infrastructure.
>
> I2C transactions may fail due to NACK, arbitration loss, or timeout, so
> use FallibleIoCapable rather than the infallible IoCapable interface.
> Propagate errors returned by the I2C core to callers.
>
> Provide smbus_io() for byte-addressed register access and standalone
> word helpers for layouts not represented by the Region-based view.
> Also provide smbus_read_word_swapped() for devices that transmit the
> high byte of a multi-byte value first.
>
> Restrict these operations to I2cClient<Bound> so bus I/O is only available
> while the client remains bound.
>
> Keep the raw SMBus FFI calls and errno conversion in safe bound-client
> methods. Include a generic no_run example for the word-read helper.
>
> Suggested-by: Shuai Liu <847807867@xxxxxx>
> Link: https://lore.kernel.org/all/tencent_173B7731E90B9624F9F82613DC3031B70907@xxxxxx/
> Signed-off-by: Muchamad Coirul Anwar <muchamadcoirulanwar@xxxxxxxxx>
Hi,

please add me to CC.

Could you make `I2cClient<device::Bound>` Sync in this patch?

`I2cClient<device::Normal>` already implements Sync. Functions exposed
only for `I2cClient<device::Bound>` should be thread safe.

I will need this patch (including the change mentioned above) for a
future driver.

Thanks
- Markus Probst

Attachment: signature.asc
Description: This is a digitally signed message part