[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5fLgjNXcWgCLp=GkOiycPtcR9dpSn-wZ0HK6YnQC9z+dWyTw@mail.gmail.com>
Date: Tue, 2 Dec 2025 11:14:47 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Edwin Peer <epeer@...dia.com>
Cc: Alexandre Courbot <acourbot@...dia.com>, Danilo Krummrich <dakr@...nel.org>,
Daniel Almeida <daniel.almeida@...labora.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 <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, "Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>, Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, Mark Rutland <mark.rutland@....com>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH v2 2/7] rust: io: always inline functions using
build_assert with arguments
On Mon, Dec 1, 2025 at 9:07 PM Edwin Peer <epeer@...dia.com> wrote:
>
>
> On 11/27/25 18:11, Alexandre Courbot wrote:
> > diff --git a/rust/kernel/io/resource.rs b/rust/kernel/io/resource.rs
> > index bea3ee0ed87b..d9851923562c 100644
> > --- a/rust/kernel/io/resource.rs
> > +++ b/rust/kernel/io/resource.rs
> > @@ -223,6 +223,8 @@ impl Flags {
> > /// Resource represents a memory region that must be ioremaped using `ioremap_np`.
> > pub const IORESOURCE_MEM_NONPOSTED: Flags = Flags::new(bindings::IORESOURCE_MEM_NONPOSTED);
> >
> > + // Always inline to optimize out error path of `build_assert`.
> > + #[inline(always)]
> > const fn new(value: u32) -> Self {
>
> Does the build_assert problem actually manifest for const functions?
Yes, the const marker only allows you to call it from const context.
It does not change behavior when it is called from non-const context.
Alice
Powered by blists - more mailing lists