Messages in this thread Patch in this message | | | Date | Mon, 18 Dec 2023 13:07:23 -0800 | From | Boqun Feng <> | Subject | Re: [PATCH v2 2/4] rust: time: add msecs to jiffies conversion |
| |
On Sat, Dec 16, 2023 at 03:31:40PM +0000, Alice Ryhl wrote: [...] > diff --git a/rust/kernel/time.rs b/rust/kernel/time.rs > new file mode 100644 > index 000000000000..23c4d1a74f68 > --- /dev/null > +++ b/rust/kernel/time.rs > @@ -0,0 +1,17 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +//! Timers. > + Please consider the following mod level description:
//! Time related primitives. //! //! This module contains the kernel APIs related to time and timers that //! have been ported or wrapped for usage by Rust code in the kernel.
Otherwise it looks fine to me.
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Regards, Boqun
> +/// The time unit of Linux kernel. One jiffy equals (1/HZ) second. > +pub type Jiffies = core::ffi::c_ulong; > + > +/// The millisecond time unit. > +pub type Msecs = core::ffi::c_uint; > + > +/// Converts milliseconds to jiffies. > +#[inline] > +pub fn msecs_to_jiffies(msecs: Msecs) -> Jiffies { > + // SAFETY: The `__msecs_to_jiffies` function is always safe to call no > + // matter what the argument is. > + unsafe { bindings::__msecs_to_jiffies(msecs) } > +} > > -- > 2.43.0.472.g3155946c3a-goog > >
| |