[PATCH v5 4/4] rust: clk: use 'kernel vertical style' for imports
Daniel Almeida <[email protected]>
| Newsgroups | org.kernel.vger.linux-pwm,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-riscv,org.kernel.vger.linux-clk,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
Convert all imports to use the new import style. This will make it easier to land new changes in the future. No change of functionality implied. Link: https://docs.kernel.org/rust/coding-guidelines.html#imports Signed-off-by: Daniel Almeida <[email protected]> --- rust/kernel/clk.rs | 66 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/rust/kernel/clk.rs b/rust/kernel/clk.rs index b9a44f83843a..e677156ffd21 100644 --- a/rust/kernel/clk.rs +++ b/rust/kernel/clk.rs @@ -80,13 +80,23 @@ fn from(freq: Hertz) -> Self { mod common_clk { use super::Hertz; use crate::{ - device::{Bound, Device}, - error::{from_err_ptr, to_result, Result}, + device::{ + Bound, + Device, // + }, + error::{ + from_err_ptr, + to_result, // + }, prelude::*, - sync::Arc, + sync::Arc, // }; - use core::{marker::PhantomData, mem::ManuallyDrop, ptr}; + use core::{ + marker::PhantomData, + mem::ManuallyDrop, + ptr, // + }; mod private { pub trait Sealed {} @@ -193,9 +203,15 @@ impl<State: ClkState> From<Error<State>> for kernel::error::Error { /// original [`Clk`], e.g.: /// /// ``` - /// use kernel::clk::{Clk, Enabled, Unprepared}; - /// use kernel::device::{Bound, Device}; - /// use kernel::error::Result; + /// use kernel::clk::{ + /// Clk, + /// Enabled, + /// Unprepared, // + /// }; + /// use kernel::device::{ + /// Bound, + /// Device, // + /// }; /// /// fn get_enabled(dev: &Device<Bound>) -> Result<Clk<Enabled>> { /// let clk = Clk::<Unprepared>::get(dev, Some(c"apb_clk"))? @@ -245,9 +261,17 @@ fn from(err: Error<State>) -> Self { /// The following example demonstrates how to obtain and configure a clock for a device. /// /// ``` - /// use kernel::clk::{Clk, Enabled, Hertz, Unprepared, Prepared}; - /// use kernel::device::{Bound, Device}; - /// use kernel::error::Result; + /// use kernel::clk::{ + /// Clk, + /// Enabled, + /// Hertz, + /// Prepared, + /// Unprepared, // + /// }; + /// use kernel::device::{ + /// Bound, + /// Device, // + /// }; /// /// fn configure_clk(dev: &Device<Bound>) -> Result { /// // The fastest way is to use a version of `Clk::get` for the desired @@ -292,8 +316,11 @@ fn from(err: Error<State>) -> Self { /// and move between the variants: /// /// ``` - /// use kernel::clk::{Clk, Enabled, Prepared}; - /// use kernel::error::Result; + /// use kernel::clk::{ + /// Clk, + /// Enabled, + /// Prepared, // + /// }; /// /// enum DeviceClk { /// Suspended(Clk<Prepared>), @@ -323,8 +350,11 @@ fn from(err: Error<State>) -> Self { /// enable a clone of it: /// /// ``` - /// use kernel::clk::{Clk, Enabled, Prepared}; - /// use kernel::error::Result; + /// use kernel::clk::{ + /// Clk, + /// Enabled, + /// Prepared, // + /// }; /// /// fn use_clk(prepared_clk: &Clk<Prepared>) -> Result { /// let enabled_clk: Clk<Enabled> = prepared_clk.clone().enable()?; @@ -556,8 +586,12 @@ pub fn enable(self) -> Result<Clk<Enabled>, Error<Prepared>> { /// clock or threading it through an intermediate state, e.g.: /// /// ``` - /// use kernel::clk::{Clk, Enabled, Hertz, Prepared}; - /// use kernel::error::Result; + /// use kernel::clk::{ + /// Clk, + /// Enabled, + /// Hertz, + /// Prepared, // + /// }; /// /// fn read_rate(clk: &Clk<Prepared>) -> Result<Hertz> { /// clk.with_enabled(|clk: &Clk<Enabled>| clk.rate()) -- 2.54.0