]> git.ipfire.org Git - thirdparty/linux.git/commit
rust: Add read_poll_timeout_atomic function
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Mon, 3 Nov 2025 11:29:58 +0000 (20:29 +0900)
committerDanilo Krummrich <dakr@kernel.org>
Tue, 4 Nov 2025 13:06:47 +0000 (14:06 +0100)
commit46f045db5a94cd50b24dc1449bdd444e4473b28b
tree1ac0f529f28908ebdc3920077e94f07849bb645f
parentad68b55a9ed0e5ce16508cb10081a73ea8f4bbef
rust: Add read_poll_timeout_atomic function

Add read_poll_timeout_atomic function which polls periodically until a
condition is met, an error occurs, or the attempt limit is reached.

The C's read_poll_timeout_atomic() is used for the similar purpose.
In atomic context the timekeeping infrastructure is unavailable, so
reliable time-based timeouts cannot be implemented. So instead, the
helper accepts a maximum number of attempts and busy-waits (udelay +
cpu_relax) between tries.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Link: https://patch.msgid.link/20251103112958.2961517-3-fujita.tomonori@gmail.com
[ Adjust imports to use "kernel vertical" style. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/io/poll.rs