Re: [PATCH v4 3/7] clk: tests: Add Kunit testing for of_clk_get_parent_name()

Frank Li <[email protected]>
Newsgroups org.kernel.vger.linux-clk,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <amOsrxO3TGsl9kfF@lizhi-Precision-Tower-5810>
On Fri, Jul 17, 2026 at 05:59:19PM +0200, Miquel Raynal (Schneider Electric) wrote:
> Make sure this helper is never broken, especially since we will soon
> make some changes in it.

Nit: Ensure this helper remains correct before making upcoming changes to it.

Reviewed-by: Frank Li <[email protected]>

>
> Signed-off-by: Miquel Raynal (Schneider Electric) <[email protected]>
> ---
>  drivers/clk/clk_test.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c
> index f47f81b7d72a..4084559e157d 100644
> --- a/drivers/clk/clk_test.c
> +++ b/drivers/clk/clk_test.c
> @@ -3637,9 +3637,23 @@ static void clk_parse_clkspec_with_incorrect_index_and_name(struct kunit *test)
>  	KUNIT_EXPECT_TRUE(test, IS_ERR(hw));
>  }
>
> +/*
> + * Verify that of_clk_get_parent_name() returns the correct clock name when
> + * looking up by index through the consumer's clocks property.
> + */
> +static void of_clk_get_parent_name_gets_parent_name(struct kunit *test)
> +{
> +	struct clk_parse_clkspec_ctx *ctx = test->priv;
> +	const char *expected_name = "clk_parse_clkspec_1";
> +
> +	KUNIT_EXPECT_STREQ(test, expected_name,
> +			   of_clk_get_parent_name(ctx->cons_np, 0));
> +}
> +
>  static struct kunit_case clk_parse_clkspec_test_cases[] = {
>  	KUNIT_CASE(clk_parse_clkspec_with_correct_index_and_name),
>  	KUNIT_CASE(clk_parse_clkspec_with_incorrect_index_and_name),
> +	KUNIT_CASE(of_clk_get_parent_name_gets_parent_name),
>  	{}
>  };
>
>
> --
> 2.54.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.