[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <56672794-727b-4ed2-aa73-9e976e266346@gmail.com>
Date: Tue, 28 Oct 2025 20:00:38 +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:
> In fact, quite some C drivers are already doing exactly this by hand. For
> instance, see [3]. Four lines after [3], raa215300_rtc_unregister_device() is
> registered with devm_add_action_or_reset(), which calls i2c_unregister_device().
Now that you’ve mentioned the parent device, I finally understand what
you mean.
Originally, I started my Rust-for-Linux journey with the goal of
rewriting one of
our platform drivers that has I2C children — and yes, it has a root
platform_device.
For now, I’ve put that rewrite on hold and focused on the I2C part
instead, which
is why I was thinking from the perspective of rust_driver_i2c.rs: it’s a
purely
artificial sample driver that creates an I2C client for a non-existent
physical
device using an I2C adapter. That’s why the puzzle didn’t fit together
for me earlier.
> Having that said, I'm a bit curious now: What is your use-case for
> i2c:Registration?
As for my view of i2c::Registration, I see it as a safe wrapper around
i2c_new_client_device that holds a pointer to the newly created I2C
client and releases it automatically when dropped.
Thanks for the explanation, I'll drop a new version when ready
Best Regards
Igor
Powered by blists - more mailing lists