[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <860306dd-b3b1-4eeb-b8b1-d09f2f7e028d@gmail.com>
Date: Sun, 2 Nov 2025 17:45:02 +0000
From: Igor Korotin <igor.korotin.linux@...il.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
 Wolfram Sang <wsa+renesas@...g-engineering.com>,
 Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>,
 Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
 Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Viresh Kumar <viresh.kumar@...aro.org>,
 Asahi Lina <lina+kernel@...hilina.net>,
 Wedson Almeida Filho <wedsonaf@...il.com>, Alex Hung <alex.hung@....com>,
 Tamir Duberstein <tamird@...il.com>,
 Xiangfei Ding <dingxiangfei2009@...il.com>, linux-kernel@...r.kernel.org,
 rust-for-linux@...r.kernel.org, linux-i2c@...r.kernel.org
Subject: Re: [PATCH v6 2/3] rust: i2c: Add basic I2C driver abstractions
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
Powered by blists - more mailing lists