From: Chuan Liu via B4 Relay <devnull+chuan.liu.amlogic.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,
Chuan Liu <chuan.liu@amlogic.com>
Subject: [PATCH 1/2] clk: mux: improve the execution efficiency of determine_rate()
Date: Tue, 21 Oct 2025 18:12:30 +0800 [thread overview]
Message-ID: <20251021-improve_efficiency_of_clk_divider-v1-1-e2bf7f625af6@amlogic.com> (raw)
In-Reply-To: <20251021-improve_efficiency_of_clk_divider-v1-0-e2bf7f625af6@amlogic.com>
From: Chuan Liu <chuan.liu@amlogic.com>
According to the current logic of mux_is_better_rate(), even if a
parent clock matching req->rate is found again in the current loop,
it will not be selected.
Exit the loop once the best-matching parent clock is found to avoid
unnecessary function calls and reduce execution time.
Signed-off-by: Chuan Liu <chuan.liu@amlogic.com>
---
drivers/clk/clk.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 85d2f2481acf..925e4768e3ad 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -758,6 +758,9 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw,
best_parent = parent;
best = parent_rate;
}
+
+ if (best == req->rate)
+ break;
}
if (!best_parent)
--
2.42.0
next prev parent reply other threads:[~2025-10-21 10:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 10:12 [PATCH 0/2] clk: improve the execution efficiency of determine_rate() Chuan Liu via B4 Relay
2025-10-21 10:12 ` Chuan Liu via B4 Relay [this message]
2025-10-21 10:12 ` [PATCH 2/2] clk: divider: " Chuan Liu via B4 Relay
2025-10-26 1:25 ` Stephen Boyd
2025-10-27 8:47 ` Chuan Liu
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=20251021-improve_efficiency_of_clk_divider-v1-1-e2bf7f625af6@amlogic.com \
--to=devnull+chuan.liu.amlogic.com@kernel.org \
--cc=chuan.liu@amlogic.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