Re: [PATCH] rust: opp: Make the doctest example depend on CONFIG_OF
From: Rafael J. Wysocki
Date: Mon May 26 2025 - 07:09:20 EST
On Mon, May 26, 2025 at 7:35 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> The doctest example uses a function only available for CONFIG_OF and so
> the build with doc tests fails when it isn't enabled.
>
> error[E0599]: no function or associated item named `from_of_cpumask`
> found for struct `rust_doctest_kernel_alloc_kbox_rs_4::kernel::opp::Table`
> in the current scope
>
> Fix this by making the doctest depend on CONFIG_OF.
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202505260856.ZQWHW2xT-lkp@xxxxxxxxx/
> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
> Rafael,
>
> Please apply this directly, if no one objects to it. Thanks.
Done, thanks!
>
> rust/kernel/opp.rs | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/rust/kernel/opp.rs b/rust/kernel/opp.rs
> index 212555dacd45..c2bdc11f3999 100644
> --- a/rust/kernel/opp.rs
> +++ b/rust/kernel/opp.rs
> @@ -582,6 +582,7 @@ extern "C" fn config_regulators(
> /// use kernel::opp::Table;
> /// use kernel::types::ARef;
> ///
> +/// #[cfg(CONFIG_OF)]
> /// fn get_table(dev: &ARef<Device>, mask: &mut Cpumask, freq: Hertz) -> Result<Table> {
> /// let mut opp_table = Table::from_of_cpumask(dev, mask)?;
> ///
> --
> 2.31.1.272.g89b43f80a514
>