]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rust: platform: Set `OF_ID_TABLE` default to `None` in `Driver` trait
authorIgor Korotin <igor.korotin.linux@gmail.com>
Fri, 20 Jun 2025 15:41:24 +0000 (16:41 +0100)
committerDanilo Krummrich <dakr@kernel.org>
Thu, 26 Jun 2025 21:26:15 +0000 (23:26 +0200)
Provide a default value of `None` for `Driver::OF_ID_TABLE` to simplify
driver implementations.

Drivers that do not require OpenFirmware matching no longer need to
import the `of` module or define the constant explicitly.

This reduces unnecessary boilerplate and avoids pulling in unused
dependencies.

Signed-off-by: Igor Korotin <igor.korotin.linux@gmail.com>
Link: https://lore.kernel.org/r/20250620154124.297158-1-igor.korotin.linux@gmail.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/platform.rs

index 5923d29a05111c489f30d4479132e4c4fa88e341..2436f55b579b5e36578eec573edc692374c3c21b 100644 (file)
@@ -162,7 +162,7 @@ pub trait Driver: Send {
     type IdInfo: 'static;
 
     /// The table of OF device ids supported by the driver.
-    const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>>;
+    const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = None;
 
     /// Platform driver probe.
     ///