Mark the tests that only support v1 negotiation to make it clear exactly which behavior is under test.
Link: https://lore.kernel.org/linux-clk/[email protected]/ Link: https://lpc.events/event/19/contributions/2152/ Signed-off-by: Brian Masney <[email protected]> --- drivers/clk/clk-divider_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/clk/clk-divider_test.c b/drivers/clk/clk-divider_test.c index a16c04d5d8a86952b42750d326f88754fbc91eb7..646307f1d78a08130a8a552b57874e21b07f7b4a 100644 --- a/drivers/clk/clk-divider_test.c +++ b/drivers/clk/clk-divider_test.c @@ -54,6 +54,15 @@ static const struct clk_ops clk_dummy_div_ops = { .set_rate = clk_dummy_div_set_rate, }; +/* + * clk-divider.c has support for v2 rate negotiation, and setting the parent + * based on the LCM, however we need to be able to test just setting the parent + * rate based on the LCM, and not set the v2 rate negotiation flag. This is to + * demonstrate existing behavior in the clk core when a parent rate that's + * suitable for all children is selected, a sibling will still have it's rate + * negatively affected. Some boards may be unknowingly dependent on this + * behavior, and we want to ensure this behavior stays the same. + */ static int clk_dummy_div_lcm_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) { @@ -197,6 +206,7 @@ static void clk_test_rate_change_divider_1(struct kunit *test) KUNIT_EXPECT_EQ(test, ctx->child1.div, 1); KUNIT_ASSERT_EQ(test, clk_get_rate(ctx->child2_clk), 24 * HZ_PER_MHZ); KUNIT_EXPECT_EQ(test, ctx->child2.div, 1); + /* This test is expected to work with both v1 and v2 rate negotiation. */ ret = clk_set_rate(ctx->child1_clk, 6 * HZ_PER_MHZ); KUNIT_ASSERT_EQ(test, ret, 0); @@ -229,6 +239,8 @@ static void clk_test_rate_change_divider_2_v1(struct kunit *test) KUNIT_EXPECT_EQ(test, ctx->child1.div, 1); KUNIT_ASSERT_EQ(test, clk_get_rate(ctx->child2_clk), 24 * HZ_PER_MHZ); KUNIT_EXPECT_EQ(test, ctx->child2.div, 1); + KUNIT_ASSERT_TRUE(test, !__clk_has_v2_negotiation(ctx->child1_clk)); + KUNIT_ASSERT_TRUE(test, !__clk_has_v2_negotiation(ctx->child2_clk)); ret = clk_set_rate(ctx->child1_clk, 32 * HZ_PER_MHZ); KUNIT_ASSERT_EQ(test, ret, 0); @@ -265,6 +277,8 @@ static void clk_test_rate_change_divider_3_v1(struct kunit *test) KUNIT_EXPECT_EQ(test, ctx->child1.div, 1); KUNIT_ASSERT_EQ(test, clk_get_rate(ctx->child2_clk), 24 * HZ_PER_MHZ); KUNIT_EXPECT_EQ(test, ctx->child2.div, 1); + KUNIT_ASSERT_TRUE(test, !__clk_has_v2_negotiation(ctx->child1_clk)); + KUNIT_ASSERT_TRUE(test, !__clk_has_v2_negotiation(ctx->child2_clk)); ret = clk_set_rate(ctx->child1_clk, 32 * HZ_PER_MHZ); KUNIT_ASSERT_EQ(test, ret, 0); -- 2.53.0

