mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Xiwen via B4 Relay  <devnull+forbidden405.outlook.com@kernel.org>
To: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yang Xiwen <forbidden405@outlook.com>
Subject: [PATCH v2 2/2] clk: tests: Add missing test case for mux determine_rate
Date: Tue, 25 Apr 2023 15:46:40 +0800	[thread overview]
Message-ID: <20230421-clk-v2-2-74c6cc2214d1@outlook.com> (raw)
In-Reply-To: <20230421-clk-v2-0-74c6cc2214d1@outlook.com>

From: Yang Xiwen <forbidden405@outlook.com>

Add a missing test case for determine_rate implemented by mux. It tests
the behavior of determine_rate when requesting a rate that none of the
parents could give.

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
---
 drivers/clk/clk_test.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c
index f9a5c2964c65d..9b1c90de90454 100644
--- a/drivers/clk/clk_test.c
+++ b/drivers/clk/clk_test.c
@@ -2215,6 +2215,15 @@ static void clk_leaf_mux_set_rate_parent_determine_rate(struct kunit *test)
 	KUNIT_EXPECT_EQ(test, req.best_parent_rate, DUMMY_CLOCK_RATE_2);
 	KUNIT_EXPECT_PTR_EQ(test, req.best_parent_hw, &ctx->mux_ctx.hw);
 
+	// Test a non-existant rate which none of the parents could give
+	clk_hw_init_rate_request(hw, &req, DUMMY_CLOCK_INIT_RATE);
+
+	ret = __clk_determine_rate(hw, &req);
+	KUNIT_ASSERT_EQ(test, ret, 0);
+
+	KUNIT_EXPECT_EQ(test, req.rate, DUMMY_CLOCK_RATE_1);
+	KUNIT_EXPECT_EQ(test, req.best_parent_rate, DUMMY_CLOCK_RATE_1);
+	KUNIT_EXPECT_PTR_EQ(test, req.best_parent_hw, &ctx->mux_ctx.hw);
 	clk_put(clk);
 }
 

-- 
2.39.2


  parent reply	other threads:[~2023-04-25  7:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25  7:46 [PATCH v2 0/2] clk: fix corner case of clk_mux_determine_rate_flags() Yang Xiwen via B4 Relay
2023-04-25  7:46 ` [PATCH v2 1/2] clk: use ULONG_MAX as the initial value for the iteration in clk_mux_determine_rate_flags() Yang Xiwen via B4 Relay
2023-04-25  7:46 ` Yang Xiwen via B4 Relay [this message]
2023-04-25 19:40   ` [PATCH v2 2/2] clk: tests: Add missing test case for mux determine_rate Stephen Boyd

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=20230421-clk-v2-2-74c6cc2214d1@outlook.com \
    --to=devnull+forbidden405.outlook.com@kernel.org \
    --cc=forbidden405@outlook.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /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

all inboxes | Powered by JetHome®