Rust for Linux List
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@kernel.org>
To: Ayush Singh <ayush@beagleboard.org>
Cc: "Jason Kridner" <jkridner@beagleboard.org>,
	"Deepak Khatri" <lorforlinux@beagleboard.org>,
	"Robert Nelson" <robertcnelson@beagleboard.org>,
	"Dhruva Gole" <d-gole@ti.com>, "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] rust: kernel: device: Add devm_of_platform_populate/depopulate
Date: Tue, 29 Apr 2025 15:53:06 +0200	[thread overview]
Message-ID: <aBDZwoZTGgsWNYLJ@pollux> (raw)
In-Reply-To: <20250429-rust-of-populate-v2-1-0ad329d121c5@beagleboard.org>

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()) }
> +    }
> +}

  parent reply	other threads:[~2025-04-29 13:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 11:39 [PATCH v2] rust: kernel: device: Add devm_of_platform_populate/depopulate Ayush Singh
2025-04-29 12:10 ` Miguel Ojeda
2025-04-29 13:53 ` Danilo Krummrich [this message]
2025-04-29 14:31 ` Danilo Krummrich
2025-04-29 14:37   ` Greg Kroah-Hartman
2025-04-29 14:44     ` Danilo Krummrich
2025-04-29 14:57       ` Greg Kroah-Hartman
2025-04-29 16:07         ` Ayush Singh
2025-04-29 16:39           ` Greg Kroah-Hartman
2025-04-29 16:56             ` Ayush Singh
2025-04-29 20:55           ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aBDZwoZTGgsWNYLJ@pollux \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=ayush@beagleboard.org \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=d-gole@ti.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jkridner@beagleboard.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorforlinux@beagleboard.org \
    --cc=ojeda@kernel.org \
    --cc=rafael@kernel.org \
    --cc=robertcnelson@beagleboard.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox