From 15bc5c00d10fb643df7939d34438d50ffa732cb2 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Tue, 27 May 2025 11:03:26 +0530 Subject: [PATCH] rust: opp: Move `cfg(CONFIG_OF)` attribute to the top of doc test Move the `#[cfg(CONFIG_OF)]` attribute to the top of the documentation test block and hide it. This applies the condition to the entire test and improves readability. Placing configuration flags like `CONFIG_OF` at the top serves as a clear indicator of the conditions under which the example is valid, effectively acting like configuration metadata for the example itself. Suggested-by: Miguel Ojeda Signed-off-by: Viresh Kumar Link: https://patch.msgid.link/9d93c783cc4419f16dd8942a4359d74bc0149203.1748323971.git.viresh.kumar@linaro.org Signed-off-by: Rafael J. Wysocki --- rust/kernel/opp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/kernel/opp.rs b/rust/kernel/opp.rs index c2bdc11f3999..a566fc3e7dcb 100644 --- a/rust/kernel/opp.rs +++ b/rust/kernel/opp.rs @@ -575,6 +575,7 @@ impl Config { /// frequency. /// /// ``` +/// # #![cfg(CONFIG_OF)] /// use kernel::clk::Hertz; /// use kernel::cpumask::Cpumask; /// use kernel::device::Device; @@ -582,7 +583,6 @@ impl Config { /// use kernel::opp::Table; /// use kernel::types::ARef; /// -/// #[cfg(CONFIG_OF)] /// fn get_table(dev: &ARef, mask: &mut Cpumask, freq: Hertz) -> Result { /// let mut opp_table = Table::from_of_cpumask(dev, mask)?; /// -- 2.50.1