[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025052143-ergonomic-ongoing-36e5@gregkh>
Date: Wed, 21 May 2025 13:59:32 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Remo Senekowitsch <remo@...nzli.dev>
Cc: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Dirk Behme <dirk.behme@...bosch.com>, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v5 2/9] rust: device: Enable accessing the FwNode of a
Device
On Tue, May 20, 2025 at 10:00:17PM +0200, Remo Senekowitsch wrote:
> Subsequent patches will add methods for reading properties to FwNode.
> The first step to accessing these methods will be to access the "root"
> FwNode of a Device.
>
> Add the method `fwnode` to `Device`.
>
> Signed-off-by: Remo Senekowitsch <remo@...nzli.dev>
> ---
> rust/kernel/device.rs | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs
> index d8619d4485fb4..b4b7056eb80f8 100644
> --- a/rust/kernel/device.rs
> +++ b/rust/kernel/device.rs
> @@ -186,6 +186,21 @@ unsafe fn printk(&self, klevel: &[u8], msg: fmt::Arguments<'_>) {
> };
> }
>
> + /// Obtain the [`FwNode`](property::FwNode) corresponding to the device.
> + pub fn fwnode(&self) -> Option<&property::FwNode> {
> + // SAFETY: `self` is valid.
> + let fwnode_handle = unsafe { bindings::__dev_fwnode(self.as_raw()) };
Why isn't this calling __dev_fwnode_const()? And there's no way to just
use dev_fwnode() directly? Ugh, it's a macro...
thanks,
greg k-h
Powered by blists - more mailing lists