[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aBDZwoZTGgsWNYLJ@pollux>
Date: Tue, 29 Apr 2025 15:53:06 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Ayush Singh <ayush@...gleboard.org>
Cc: Jason Kridner <jkridner@...gleboard.org>,
Deepak Khatri <lorforlinux@...gleboard.org>,
Robert Nelson <robertcnelson@...gleboard.org>,
Dhruva Gole <d-gole@...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>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] rust: kernel: device: Add
devm_of_platform_populate/depopulate
On Tue, Apr 29, 2025 at 05:09:26PM +0530, Ayush Singh wrote:
> +impl Device<Bound> {
> + /// Populate platform_devices from device tree data
> + pub fn devm_of_platform_populate(&self) -> crate::error::Result<()> {
> + // SAFETY: self is valid bound Device reference
Here and below, I'd write something along the lines of:
// SAFETY: By its type invariant `self.as_raw()` is a valid pointer to a
// `struct device`.
> + to_result(unsafe { bindings::devm_of_platform_populate(self.as_raw()) })
> + }
> +
> + /// Remove devices populated from device tree
> + pub fn devm_of_platform_depopulate(&self) {
> + // SAFETY: self is valid bound Device reference
> + unsafe { bindings::devm_of_platform_depopulate(self.as_raw()) }
> + }
> +}
Powered by blists - more mailing lists