The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Brian Masney <bmasney@redhat.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
	 Stephen Boyd <sboyd@kernel.org>,  Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Brendan Higgins <brendan.higgins@linux.dev>,
	 David Gow <david@davidgow.net>,  Rae Moar <raemoar63@gmail.com>,
	 Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	 Pascal EBERHARD <pascal.eberhard@se.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-clk@vger.kernel.org,  devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,  linux-kselftest@vger.kernel.org,
	kunit-dev@googlegroups.com
Subject: Re: [PATCH v4 7/7] clk: tests: Add Kunit testing for nexus nodes
Date: Fri, 07 Aug 2026 14:50:12 +0200	[thread overview]
Message-ID: <87jyq2ccxn.fsf@bootlin.com> (raw)
In-Reply-To: <al_zh1cOInMXEU8x@redhat.com> (Brian Masney's message of "Tue, 21 Jul 2026 18:32:39 -0400")

On 21/07/2026 at 18:32:39 -04, Brian Masney <bmasney@redhat.com> wrote:

> On Fri, Jul 17, 2026 at 05:59:23PM +0200, Miquel Raynal (Schneider Electric) wrote:
>> Add a nexus node with a child requesting a mapped clock in the fake DT
>> overlay to verify that the parsing is also correctly working.
>> 
>> Create an of_find_node_by_name() like kunit helper to garbage collect the
>> node automatically in case of failed assertion.
>> 
>> Suggested-by: Stephen Boyd <sboyd@kernel.org>
>> Signed-off-by: Miquel Raynal (Schneider Electric) <miquel.raynal@bootlin.com>
>> ---
>>  drivers/clk/clk_kunit_helpers.c          | 31 +++++++++++++++++++++++++++++++
>>  drivers/clk/clk_test.c                   | 15 +++++++++++++++
>>  drivers/clk/kunit_clk_parse_clkspec.dtso | 10 ++++++++++
>>  include/kunit/clk.h                      |  2 ++
>>  4 files changed, 58 insertions(+)
>> 
>> diff --git a/drivers/clk/clk_kunit_helpers.c b/drivers/clk/clk_kunit_helpers.c
>> index 68a28e70bb61..daaf1cf1546c 100644
>> --- a/drivers/clk/clk_kunit_helpers.c
>> +++ b/drivers/clk/clk_kunit_helpers.c
>> @@ -233,5 +233,36 @@ int of_clk_add_hw_provider_kunit(struct kunit *test, struct device_node *np,
>>  }
>>  EXPORT_SYMBOL_GPL(of_clk_add_hw_provider_kunit);
>>  
>> +KUNIT_DEFINE_ACTION_WRAPPER(of_node_put_wrapper, of_node_put, struct device_node *);
>> +
>> +/**
>> + * of_find_node_by_name_kunit() - Test managed of_find_node_by_name()
>> + * @test: The test context
>> + * @from: Parent device node to start searching from, or NULL to search from root
>> + * @name: The name string to match against
>> + *
>> + * Just like of_find_node_by_name(), except the device_noded is managed by
>> + * the test case and is automatically put after the test case concludes.
>> + *
>> + * Return: the device_node on success, NULL if not found, or a negative errno value on failure.
>> + */
>> +struct device_node *of_find_node_by_name_kunit(struct kunit *test, struct device_node *from,
>> +					       const char *name)
>> +{
>> +	struct device_node *np;
>> +	int ret;
>> +
>> +	np = of_find_node_by_name(from, name);
>> +	if (!np)
>> +		return NULL;
>> +
>> +	ret = kunit_add_action_or_reset(test, of_node_put_wrapper, np);
>> +	if (ret)
>> +		return ERR_PTR(ret);
>> +
>> +	return np;
>> +}
>> +EXPORT_SYMBOL_GPL(of_find_node_by_name_kunit);
>
> Should this be prefixed with clk_ since this is in
> clk_kunit_helpers.c?

That's right, I missed it. I'll rename the helper.

Thanks!
Miquèl

  reply	other threads:[~2026-08-07 12:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 15:59 [PATCH v4 0/7] clk: Add support for clock nexus Miquel Raynal (Schneider Electric)
2026-07-17 15:59 ` [PATCH v4 1/7] dt-bindings: clock: Introduce nexus nodes Miquel Raynal (Schneider Electric)
2026-07-22 19:34   ` Rob Herring (Arm)
2026-07-24 18:14   ` Frank Li
2026-07-17 15:59 ` [PATCH v4 2/7] clk: tests: Add clk_parse_clkspec() Kunit testing Miquel Raynal (Schneider Electric)
2026-07-21 22:27   ` Brian Masney
2026-07-24 18:16   ` Frank Li
2026-07-17 15:59 ` [PATCH v4 3/7] clk: tests: Add Kunit testing for of_clk_get_parent_name() Miquel Raynal (Schneider Electric)
2026-07-21 22:28   ` Brian Masney
2026-07-24 18:19   ` Frank Li
2026-08-07 12:23     ` Miquel Raynal
2026-07-17 15:59 ` [PATCH v4 4/7] clk: Improve a couple of comments Miquel Raynal (Schneider Electric)
2026-07-17 15:59 ` [PATCH v4 5/7] clk: Use the generic OF phandle parsing in only one place Miquel Raynal (Schneider Electric)
2026-07-24 18:35   ` Frank Li
2026-08-07 13:08     ` Miquel Raynal
2026-07-17 15:59 ` [PATCH v4 6/7] clk: Add support for clock nexus dt bindings Miquel Raynal (Schneider Electric)
2026-07-24 18:30   ` Frank Li
2026-07-17 15:59 ` [PATCH v4 7/7] clk: tests: Add Kunit testing for nexus nodes Miquel Raynal (Schneider Electric)
2026-07-21 22:32   ` Brian Masney
2026-08-07 12:50     ` Miquel Raynal [this message]
2026-07-24 18:31   ` Frank Li
2026-07-24 18:26 ` [PATCH v4 0/7] clk: Add support for clock nexus Frank Li

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=87jyq2ccxn.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=bmasney@redhat.com \
    --cc=brendan.higgins@linux.dev \
    --cc=conor+dt@kernel.org \
    --cc=david@davidgow.net \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=pascal.eberhard@se.com \
    --cc=raemoar63@gmail.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wsa+renesas@sang-engineering.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox