Re: [PATCH v6 2/3] rust: i2c: Add basic I2C driver abstractions

From: Igor Korotin
Date: Sun Nov 02 2025 - 12:45:13 EST


Hello Danilo

On 10/27/2025 10:00 PM, Danilo Krummrich wrote:
It's called from other drivers (e.g. DRM drivers [1] or network drivers [2])
that are bound to some bus device themselves, e.g. a platform device or a PCI
device.

This is the device that we can give to i2c:Registration::new() and use for the
internal call to devres.

After the recent change where i2c::Registration::new() returns impl PinInit<Devres<Self>, Error> instead of Result<Self>, I’m unsure how to adapt the Rust I2C sample driver. The sample doesn’t have a parent device available — previously it just used the returned I2cClient.

The current patch series includes a Rust I2C sample driver that creates a new i2c_client using i2c::Registration::new() and then attaches an I2C driver to it. Since this is no longer possible, I’m evaluating how the sample should be structured.

The only option I see is to split it into two parts:
1. A minimal I2C driver sample demonstrating only driver code.
2. A separate I2C client registration sample based on an existing PCI or platform sample driver, using its device as the parent for Devres::new() inside `i2c::Registration::new()`.

Does this approach make sense, or is there a better way to handle it?

Thanks,
Igor