[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_Jsq+GTzJH3t+muBZtVjr=xD6if6u6vgdWsnQ4togHg+-zHg@mail.gmail.com>
Date: Wed, 25 Jun 2025 10:12:38 -0500
From: Rob Herring <robh@...nel.org>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Remo Senekowitsch <remo@...nzli.dev>, Saravana Kannan <saravanak@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Mark Brown <broonie@...nel.org>, Dirk Behme <dirk.behme@...bosch.com>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v1 3/3] samples: rust: platform: Add property child and
reference args examples
On Wed, Jun 25, 2025 at 10:09 AM Danilo Krummrich <dakr@...nel.org> wrote:
>
> On 6/25/25 4:39 PM, Rob Herring wrote:
> > On Sat, Jun 21, 2025 at 12:37:27AM +0200, Danilo Krummrich wrote:
> >> On Tue, Jun 17, 2025 at 08:01:08AM -0500, Rob Herring wrote:
> >>> On Mon, Jun 16, 2025 at 10:45 AM Remo Senekowitsch <remo@...nzli.dev> wrote:
> >>>>
> >>>> Add some example usage of the device property methods for reading
> >>>> DT/ACPI/swnode child nodes and reference args.
> >>>>
> >>>> Signed-off-by: Remo Senekowitsch <remo@...nzli.dev>
> >>>> ---
> >>>> drivers/of/unittest-data/tests-platform.dtsi | 7 +++++++
> >>>> samples/rust/rust_driver_platform.rs | 13 ++++++++++++-
> >>>> 2 files changed, 19 insertions(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/drivers/of/unittest-data/tests-platform.dtsi b/drivers/of/unittest-data/tests-platform.dtsi
> >>>> index 50a51f38afb6..509eb614ab2b 100644
> >>>> --- a/drivers/of/unittest-data/tests-platform.dtsi
> >>>> +++ b/drivers/of/unittest-data/tests-platform.dtsi
> >>>> @@ -40,6 +40,13 @@ test-device@2 {
> >>>>
> >>>> test,u32-prop = <0xdeadbeef>;
> >>>> test,i16-array = /bits/ 16 <1 2 (-3) (-4)>;
> >>>> +
> >>>> + ref_child_0: child@0 {
> >>>
> >>> child-0 or you need to add 'reg' property if you keep the unit-address.
> >>
> >> Adding child nodes here creates the following dt-test failues.
> >>
> >> [ 1.031239] ### dt-test ### FAIL of_unittest_platform_populate():1862 Could not create device for node 'child'
> >> [ 1.031647] ### dt-test ### FAIL of_unittest_platform_populate():1862 Could not create device for node 'child'
> >>
> >> @Rob: What do you suggest?
> >
> > This should fix it:
> >
> > index eeb370e0f507..e3503ec20f6c 100644
> > --- a/drivers/of/unittest.c
> > +++ b/drivers/of/unittest.c
> > @@ -1856,6 +1856,8 @@ static void __init of_unittest_platform_populate(void)
> > of_platform_populate(np, match, NULL, &test_bus->dev);
> > for_each_child_of_node(np, child) {
> > for_each_child_of_node(child, grandchild) {
> > + if (!of_property_present(grandchild, "compatible"))
> > + continue;
> > pdev = of_find_device_by_node(grandchild);
> > unittest(pdev,
> > "Could not create device for node '%pOFn'\n",
> >
>
> Do you want this to be a separate patch? Otherwise, I'd fine just adding it to
> this one.
Adding it here is fine.
Rob
Powered by blists - more mailing lists