[PATCH v2 1/1] rust: simplify `Adapter::id_info`
From: Onur Özkan
Date: Sat Jan 17 2026 - 04:56:50 EST
id_info() checks ACPI first and falls back to OF.
This replaces the unnecessarily verbose approach with a
simple or_else() chain and drops temporary variables.
No functional change intended.
Signed-off-by: Onur Özkan <work@xxxxxxxxxxxxx>
---
rust/kernel/driver.rs | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/rust/kernel/driver.rs b/rust/kernel/driver.rs
index 649d06468f41..6cef792d54e4 100644
--- a/rust/kernel/driver.rs
+++ b/rust/kernel/driver.rs
@@ -307,16 +307,6 @@ fn of_id_info(dev: &device::Device) -> Option<&'static Self::IdInfo> {
/// If this returns `None`, it means that there is no match in any of the ID tables directly
/// associated with a [`device::Device`].
fn id_info(dev: &device::Device) -> Option<&'static Self::IdInfo> {
- let id = Self::acpi_id_info(dev);
- if id.is_some() {
- return id;
- }
-
- let id = Self::of_id_info(dev);
- if id.is_some() {
- return id;
- }
-
- None
+ Self::acpi_id_info(dev).or_else(|| Self::of_id_info(dev))
}
}
--
2.51.2