Re: [PATCH v9 5/8] rust: time: Add wrapper for fsleep() function
From: Alice Ryhl <aliceryhl@google.com>
Date: 2025-01-27 08:55:52
Also in:
lkml, rust-for-linux
From: Alice Ryhl <aliceryhl@google.com>
Date: 2025-01-27 08:55:52
Also in:
lkml, rust-for-linux
On Sat, Jan 25, 2025 at 11:20 AM FUJITA Tomonori [off-list ref] wrote:
Add a wrapper for fsleep(), flexible sleep functions in include/linux/delay.h which typically deals with hardware delays. The kernel supports several sleep functions to handle various lengths of delay. This adds fsleep(), automatically chooses the best sleep method based on a duration. sleep functions including fsleep() belongs to TIMERS, not TIMEKEEPING. They are maintained separately. rust/kernel/time.rs is an abstraction for TIMEKEEPING. To make Rust abstractions match the C side, add rust/kernel/time/delay.rs for this wrapper. fsleep() can only be used in a nonatomic context. This requirement is not checked by these abstractions, but it is intended that klint [1] or a similar tool will be used to check it in the future. Link: https://rust-for-linux.com/klint [1] Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>