[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72nLpziMATRyod2qg8_MjtpO6OxOggAyanJ=Kd_FLwhy6w@mail.gmail.com>
Date: Mon, 26 May 2025 23:02:39 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Viresh Kumar <vireshk@...nel.org>, Nishanth Menon <nm@...com>,
Stephen Boyd <sboyd@...nel.org>, 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>, linux-pm@...r.kernel.org,
Vincent Guittot <vincent.guittot@...aro.org>, kernel test robot <lkp@...el.com>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: opp: Make the doctest example depend on CONFIG_OF
On Mon, May 26, 2025 at 7:35 AM Viresh Kumar <viresh.kumar@...aro.org> wrote:
>
> +/// #[cfg(CONFIG_OF)]
> /// fn get_table(dev: &ARef<Device>, mask: &mut Cpumask, freq: Hertz) -> Result<Table> {
Quick note related to this patch for the future/discussion: I think it
is a good idea to keep `cfg`s as local as possible, like it is done
here, although for documentation I wonder if it may be best to put it
at the top and hide it, e.g.
/// ```
/// # #![cfg(CONFIG_OPP)]
/// use kernel::clk::Hertz;
(We took that approach in another example recently)
It is nice that the `CONFIG_`s appear at the top, so that one knows at
a glance when the example applies, as if it was configuration for the
example.
On the other hand, it may be useful for the reader to see immediately
that they will need the `cfg`s. But it may be distracting from the
actual examples, and there could be a need to add it too many times
(e.g. in every related example).
Cheers,
Miguel
Powered by blists - more mailing lists