summaryrefslogtreecommitdiff
path: root/rust/kernel/io
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2025-10-23 15:11:24 +0900
committerDanilo Krummrich <dakr@kernel.org>2025-10-26 17:56:14 +0100
commitaad1577ab950d1ad46e0dd0915bfbaf9fa9160e4 (patch)
treed5385d97f0b4938f61ac0a5f6516db6501fa0f9f /rust/kernel/io
parent26c1a20bf7ce76e9afe4030f25bec20e3c63dcf8 (diff)
rust: simplify read_poll_timeout's example code
- Drop unnecessary Result's '<()>' - Use '?' instead of match Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/io')
-rw-r--r--rust/kernel/io/poll.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/rust/kernel/io/poll.rs b/rust/kernel/io/poll.rs
index 613eb25047ef..8f8886543f34 100644
--- a/rust/kernel/io/poll.rs
+++ b/rust/kernel/io/poll.rs
@@ -42,8 +42,8 @@ use crate::{
///
/// const HW_READY: u16 = 0x01;
///
-/// fn wait_for_hardware<const SIZE: usize>(io: &Io<SIZE>) -> Result<()> {
-/// match read_poll_timeout(
+/// fn wait_for_hardware<const SIZE: usize>(io: &Io<SIZE>) -> Result {
+/// read_poll_timeout(
/// // The `op` closure reads the value of a specific status register.
/// || io.try_read16(0x1000),
/// // The `cond` closure takes a reference to the value returned by `op`
@@ -51,14 +51,8 @@ use crate::{
/// |val: &u16| *val == HW_READY,
/// Delta::from_millis(50),
/// Delta::from_secs(3),
-/// ) {
-/// Ok(_) => {
-/// // The hardware is ready. The returned value of the `op` closure
-/// // isn't used.
-/// Ok(())
-/// }
-/// Err(e) => Err(e),
-/// }
+/// )?;
+/// Ok(())
/// }
/// ```
#[track_caller]