Re: [PATCH v3 16/16] samples: rust: add Rust platform sample driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23.10.2024 02:04, Rob Herring wrote:
On Tue, Oct 22, 2024 at 11:31:53PM +0200, Danilo Krummrich wrote:
Add a sample Rust platform driver illustrating the usage of the platform
bus abstractions.

This driver probes through either a match of device / driver name or a
match within the OF ID table.

I know if rust compiles it works, but how does one actually use/test
this? (I know ways, but I might be in the minority. :) )

The DT unittests already define test platform devices. I'd be happy to
add a device node there. Then you don't have to muck with the DT on some
device and it even works on x86 or UML.

Assuming being on x86, having CONFIG_OF and CONFIG_OF_UNITTEST enabled, seeing the ### dt-test ### running nicely at kernel startup and seeing the compiled in test device tree under /proc/device-tree:

Would using a compatible from the test device tree (e.g. "test-device") in the Rust Platform driver sample [1] let the probe() of that driver sample run?

Or is this a wrong/not sufficient understanding?

I tried that, without success ;)

Best regards

Dirk

--- a/samples/rust/rust_driver_platform.rs
+++ b/samples/rust/rust_driver_platform.rs
@@ -15,7 +15,7 @@ struct SampleDriver {
     SAMPLE_MODULE_OF_TABLE,
     <SampleDriver as platform::Driver>::IdInfo,
     [(
-        of::DeviceId::new(c_str!("redhat,rust-sample-platform-driver")),
+        of::DeviceId::new(c_str!("test-device")),
         Info(42)
     )]
 );




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux