Skip to content

Commit 15bc5c0

Browse files
vireshkrafaeljw
authored andcommitted
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 <miguel.ojeda.sandonis@gmail.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Link: https://patch.msgid.link/9d93c783cc4419f16dd8942a4359d74bc0149203.1748323971.git.viresh.kumar@linaro.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 21d8a68 commit 15bc5c0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rust/kernel/opp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,14 @@ impl<T: ConfigOps + Default> Config<T> {
575575
/// frequency.
576576
///
577577
/// ```
578+
/// # #![cfg(CONFIG_OF)]
578579
/// use kernel::clk::Hertz;
579580
/// use kernel::cpumask::Cpumask;
580581
/// use kernel::device::Device;
581582
/// use kernel::error::Result;
582583
/// use kernel::opp::Table;
583584
/// use kernel::types::ARef;
584585
///
585-
/// #[cfg(CONFIG_OF)]
586586
/// fn get_table(dev: &ARef<Device>, mask: &mut Cpumask, freq: Hertz) -> Result<Table> {
587587
/// let mut opp_table = Table::from_of_cpumask(dev, mask)?;
588588
///

0 commit comments

Comments
 (0)