[PATCH v8 3/9] samples: rust: platform: conditionally call Self::properties_parse()

Igor Korotin posted 9 patches 3 months, 2 weeks ago
[PATCH v8 3/9] samples: rust: platform: conditionally call Self::properties_parse()
Posted by Igor Korotin 3 months, 2 weeks ago
From: Danilo Krummrich <dakr@kernel.org>

Only call Self::properties_parse() when the device is of node

Once we add ACPI support, we don't want the ACPI device to fail probing
in Self::properties_parse().

Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Igor Korotin <igor.korotin.linux@gmail.com>
---
 samples/rust/rust_driver_platform.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/samples/rust/rust_driver_platform.rs b/samples/rust/rust_driver_platform.rs
index 000bb915af60..8579290eecb3 100644
--- a/samples/rust/rust_driver_platform.rs
+++ b/samples/rust/rust_driver_platform.rs
@@ -40,7 +40,9 @@ fn probe(
             dev_info!(dev, "Probed with info: '{}'.\n", info.0);
         }
 
-        Self::properties_parse(dev)?;
+        if dev.fwnode().is_some_and(|node| node.is_of_node()) {
+            Self::properties_parse(dev)?;
+        }
 
         let drvdata = KBox::new(Self { pdev: pdev.into() }, GFP_KERNEL)?;
 
-- 
2.43.0