]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rust: opp: Make the doctest example depend on CONFIG_OF
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 26 May 2025 05:35:03 +0000 (11:05 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 26 May 2025 11:07:23 +0000 (13:07 +0200)
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@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505260856.ZQWHW2xT-lkp@intel.com/
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/a80bfedcb4d94531dc27d3b48062db5042078e88.1748237646.git.viresh.kumar@linaro.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
rust/kernel/opp.rs

index 212555dacd45bc0aa69b9c05bc6642ade6a58c6a..c2bdc11f39995e838c33ae8def18278bdce858f1 100644 (file)
@@ -582,6 +582,7 @@ impl<T: ConfigOps + Default> Config<T> {
 /// 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)?;
 ///