Make sure this helper is never broken, especially since we will soon
make some changes in it.

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 fddb2bb9618f..5f3ffda033c3 100644
--- a/drivers/clk/clk_test.c
+++ b/drivers/clk/clk_test.c
@@ -3643,9 +3643,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


Reply via email to