[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <553bfc07-179e-4ca9-99ac-74b90badb6b0@de.bosch.com>
Date: Fri, 25 Oct 2024 12:32:27 +0200
From: Dirk Behme <dirk.behme@...bosch.com>
To: Rob Herring <robh@...nel.org>, Danilo Krummrich <dakr@...nel.org>
CC: <gregkh@...uxfoundation.org>, <rafael@...nel.org>, <bhelgaas@...gle.com>,
<ojeda@...nel.org>, <alex.gaynor@...il.com>, <boqun.feng@...il.com>,
<gary@...yguo.net>, <bjorn3_gh@...tonmail.com>, <benno.lossin@...ton.me>,
<tmgross@...ch.edu>, <a.hindborg@...sung.com>, <aliceryhl@...gle.com>,
<airlied@...il.com>, <fujita.tomonori@...il.com>, <lina@...hilina.net>,
<pstanner@...hat.com>, <ajanulgu@...hat.com>, <lyude@...hat.com>,
<daniel.almeida@...labora.com>, <saravanak@...gle.com>,
<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-pci@...r.kernel.org>, <devicetree@...r.kernel.org>
Subject: Re: [PATCH v3 16/16] samples: rust: add Rust platform sample driver
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)
)]
);
Powered by blists - more mailing lists