All of lore.kernel.org
 help / color / mirror / Atom feed
From: Beata Michalska <beata.michalska@arm.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: ojeda@kernel.org, dakr@kernel.org, gregkh@linuxfoundation.org,
	rafael@kernel.org, boqun@kernel.org, gary@garyguo.net,
	bjorn3_gh@protonmail.com, lossin@kernel.org,
	a.hindborg@kernel.org, tmgross@umich.edu,
	daniel.almeida@collabora.com, boris.brezillon@collabora.com,
	work@onurozkan.dev, samitolvanen@google.com,
	rust-for-linux@vger.kernel.org, driver-core@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v2 1/3] rust: add runtime PM support
Date: Tue, 4 Aug 2026 14:27:55 +0200	[thread overview]
Message-ID: <anHay9VZ7Mx7DrKb@arm.com> (raw)
In-Reply-To: <anGdb0C_j-OUsDVJ@google.com>

On Tue, Aug 04, 2026 at 08:06:07AM +0000, Alice Ryhl wrote:
> On Tue, Jul 21, 2026 at 05:34:02PM +0200, Beata Michalska wrote:
> > diff --git a/rust/helpers/pm_runtime.c b/rust/helpers/pm_runtime.c
> > new file mode 100644
> > index 000000000000..d0d71fcb0097
> > --- /dev/null
> > +++ b/rust/helpers/pm_runtime.c
> > @@ -0,0 +1,44 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +
> > +#include <linux/pm_runtime.h>
> > +
> > +__rust_helper void rust_helper_pm_runtime_get_noresume(struct device *dev)
> > +{
> > +	pm_runtime_get_noresume(dev);
> > +}
> > +
> > +__rust_helper void rust_helper_pm_runtime_put_noidle(struct device *dev)
> > +{
> > +	pm_runtime_put_noidle(dev);
> > +}
> 
> Should this file be wrapped in `#ifdef !CONFIG_PM` or similar?
It kinda is (should be) on the C side of things.
Though I can wrap it in another layer of ifdef.
> 
> > +/// Runtime Power Management modes that determine how a particular PM
> > +/// transition is to be carried out.
> > +/// Corresponds to C Runtime PM flag argument bits:
> > +/// - `RPM_ASYNC`
> > +/// - `RPM_NOWAIT`
> > +/// - `RPM_GET_PUT`
> > +/// - `RPM_AUTO`
> > +#[derive(Clone, Copy, PartialEq, Eq, Debug)]
> > +struct Mode(u32);
> 
> Nit: we have a macro for bit flags.
> 
> See for example:
> https://lore.kernel.org/rust-for-linux/20260719-b4-rust_binder_impl_flags-v3-0-f8d0b3ea1b87@google.com/
Will migrate it to that macro then.
> 
> > +#[cfg(CONFIG_PM)]
> > +impl Request {
> > +    ...
> > +}
> > +
> > +#[cfg(not(CONFIG_PM))]
> > +impl Request {
> > +    ...
> > +}
> 
> Doesn't your rust/helpers file already handle these for you? The methods
> exist as stubs in the C header on not(CONFIG_PM), I think?
Some, yes, but not all.

---
BR
Beata
> 
> Alice

  reply	other threads:[~2026-08-04 12:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 15:34 [PATCH v2 0/3] Rust: add runtime PM support Beata Michalska
2026-07-21 15:34 ` [PATCH v2 1/3] rust: " Beata Michalska
2026-07-27 14:56   ` Onur Özkan
2026-07-29  9:07     ` Beata Michalska
2026-07-29 13:58       ` Onur Özkan
2026-08-03  9:30         ` Beata Michalska
2026-08-04  8:06   ` Alice Ryhl
2026-08-04 12:27     ` Beata Michalska [this message]
2026-08-04  8:13   ` Alice Ryhl
2026-08-04 12:27     ` Beata Michalska
2026-08-06  6:41       ` Alice Ryhl
2026-07-21 15:34 ` [PATCH v2 2/3] rust: platform: wire runtime PM callbacks Beata Michalska
2026-08-04  8:02   ` Alice Ryhl
2026-08-04 12:26     ` Beata Michalska
2026-08-04  9:16   ` Alice Ryhl
2026-08-04 12:28     ` Beata Michalska
2026-08-06  6:45       ` Alice Ryhl
2026-07-21 15:34 ` [PATCH v2 3/3] drm/tyr: enable runtime PM Beata Michalska
2026-07-27 15:00   ` Onur Özkan
2026-07-29  9:13     ` Beata Michalska

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=anHay9VZ7Mx7DrKb@arm.com \
    --to=beata.michalska@arm.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=boris.brezillon@collabora.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.