All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Danilo Krummrich <dakr@kernel.org>
Cc: "Remo Senekowitsch" <remo@buenzli.dev>,
	"Saravana Kannan" <saravanak@google.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Mark Brown" <broonie@kernel.org>,
	"Dirk Behme" <dirk.behme@de.bosch.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v1 3/3] samples: rust: platform: Add property child and reference args examples
Date: Wed, 25 Jun 2025 09:39:30 -0500	[thread overview]
Message-ID: <20250625143930.GA1006384-robh@kernel.org> (raw)
In-Reply-To: <aFXipz-B1vEYkww9@cassiopeiae>

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@buenzli.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@buenzli.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",


  reply	other threads:[~2025-06-25 14:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16 15:45 [PATCH v1 0/3] Add Rust bindings for device property child nodes and reference args Remo Senekowitsch
2025-06-16 15:45 ` [PATCH v1 1/3] rust: device: Add child accessor and iterator Remo Senekowitsch
2025-06-16 15:45 ` [PATCH v1 2/3] rust: device: Add property_get_reference_args Remo Senekowitsch
2025-06-16 15:45 ` [PATCH v1 3/3] samples: rust: platform: Add property child and reference args examples Remo Senekowitsch
2025-06-17 13:01   ` Rob Herring
2025-06-17 13:11     ` Danilo Krummrich
2025-06-18 11:37       ` Remo Senekowitsch
2025-06-18 13:31         ` Rob Herring
2025-06-18 14:16           ` Danilo Krummrich
2025-06-20 22:37     ` Danilo Krummrich
2025-06-25 14:39       ` Rob Herring [this message]
2025-06-25 15:09         ` Danilo Krummrich
2025-06-25 15:12           ` Rob Herring
2025-06-25 16:08 ` [PATCH v1 0/3] Add Rust bindings for device property child nodes and reference args Danilo Krummrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250625143930.GA1006384-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=broonie@kernel.org \
    --cc=dakr@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dirk.behme@de.bosch.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rafael@kernel.org \
    --cc=remo@buenzli.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=saravanak@google.com \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.