Re: [PATCH v4 3/7] clk: tests: Add Kunit testing for of_clk_get_parent_name()
From: Frank Li
Date: Fri Jul 24 2026 - 14:26:21 EST
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 <Frank.Li@xxxxxxx>
>
> Signed-off-by: Miquel Raynal (Schneider Electric) <miquel.raynal@xxxxxxxxxxx>
> ---
> 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
>