* [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends
@ 2026-01-08 21:16 Brian Masney
2026-01-08 21:16 ` [PATCH 01/27] clk: sophgo: cv18xx-ip: convert from divider_round_rate() to divider_determine_rate() Brian Masney
` (30 more replies)
0 siblings, 31 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Chen Wang, Inochi Amaoto,
sophgo, Chen-Yu Tsai, Maxime Ripard, Jernej Skrabec,
Samuel Holland, linux-arm-kernel, linux-sunxi, Alexandre Belloni,
linux-rtc, Andreas Färber, Manivannan Sadhasivam,
linux-actions, Keguang Zhang, linux-mips, Taichi Sugaya,
Takao Orito, Jacky Huang, Shan-Chun Hung, Vladimir Zapolskiy,
Piotr Wojtaszczyk, Bjorn Andersson, linux-arm-msm, Orson Zhai,
Baolin Wang, Chunyan Zhang, Maxime Coquelin, Alexandre Torgue,
linux-stm32, Michal Simek, Rob Clark, Dmitry Baryshkov,
David Airlie, Simona Vetter, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, dri-devel, freedreno, Vinod Koul,
Neil Armstrong, linux-phy
Here's a series that gets rid of the deprecated APIs
divider_round_rate(), divider_round_rate_parent(), and
divider_ro_round_rate_parent() since these functions are just wrappers
for the determine_rate variant.
Note that when I converted some of these drivers from round_rate to
determine_rate, this was mistakenly converted to the following in some
cases:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value. So this series fixes those bugs and removes
the deprecated APIs all in one go.
Three of the patches ended up being a more complicated migration, and I
put them as the first three patches in this series (clk: sophgo:
cv18xx-ip), (clk: sunxi-ng), and (rtc: ac100). The remaining patches I
feel are all straight forward.
Merge strategy
==============
Only three of the patches are outside of drivers/clk (drm/msm, phy, and
rtc). For simplicity, I think it would be easiest if Stephen takes this
whole series through the clk tree. Subsystem maintainers please leave an
Acked-by for Stephen. Thanks!
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
Brian Masney (27):
clk: sophgo: cv18xx-ip: convert from divider_round_rate() to divider_determine_rate()
clk: sunxi-ng: convert from divider_round_rate_parent() to divider_determine_rate()
rtc: ac100: convert from divider_round_rate() to divider_determine_rate()
clk: actions: owl-composite: convert from owl_divider_helper_round_rate() to divider_determine_rate()
clk: actions: owl-divider: convert from divider_round_rate() to divider_determine_rate()
clk: bm1880: convert from divider_ro_round_rate() to divider_ro_determine_rate()
clk: bm1880: convert from divider_round_rate() to divider_determine_rate()
clk: hisilicon: clkdivider-hi6220: convert from divider_round_rate() to divider_determine_rate()
clk: loongson1: convert from divider_round_rate() to divider_determine_rate()
clk: milbeaut: convert from divider_ro_round_rate() to divider_ro_determine_rate()
clk: milbeaut: convert from divider_round_rate() to divider_determine_rate()
clk: nuvoton: ma35d1-divider: convert from divider_round_rate() to divider_determine_rate()
clk: nxp: lpc32xx: convert from divider_round_rate() to divider_determine_rate()
clk: qcom: alpha-pll: convert from divider_round_rate() to divider_determine_rate()
clk: qcom: regmap-divider: convert from divider_ro_round_rate() to divider_ro_determine_rate()
clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate()
clk: sophgo: sg2042-clkgen: convert from divider_round_rate() to divider_determine_rate()
clk: sprd: div: convert from divider_round_rate() to divider_determine_rate()
clk: stm32: stm32-core: convert from divider_ro_round_rate() to divider_ro_determine_rate()
clk: stm32: stm32-core: convert from divider_round_rate_parent() to divider_determine_rate()
clk: versaclock3: convert from divider_round_rate() to divider_determine_rate()
clk: x86: cgu: convert from divider_round_rate() to divider_determine_rate()
clk: zynqmp: divider: convert from divider_round_rate() to divider_determine_rate()
drm/msm/dsi_phy_14nm: convert from divider_round_rate() to divider_determine_rate()
phy: ti: phy-j721e-wiz: convert from divider_round_rate() to divider_determine_rate()
clk: divider: remove divider_ro_round_rate_parent()
clk: divider: remove divider_round_rate() and divider_round_rate_parent()
drivers/clk/actions/owl-composite.c | 11 +--
drivers/clk/actions/owl-divider.c | 17 +---
drivers/clk/actions/owl-divider.h | 5 -
drivers/clk/clk-bm1880.c | 13 +--
drivers/clk/clk-divider.c | 44 ---------
drivers/clk/clk-loongson1.c | 5 +-
drivers/clk/clk-milbeaut.c | 15 +--
drivers/clk/clk-versaclock3.c | 7 +-
drivers/clk/hisilicon/clkdivider-hi6220.c | 6 +-
drivers/clk/nuvoton/clk-ma35d1-divider.c | 7 +-
drivers/clk/nxp/clk-lpc32xx.c | 6 +-
drivers/clk/qcom/clk-alpha-pll.c | 21 ++--
drivers/clk/qcom/clk-regmap-divider.c | 16 +--
drivers/clk/sophgo/clk-cv18xx-ip.c | 154 ++++++++++++++++-------------
drivers/clk/sophgo/clk-sg2042-clkgen.c | 15 +--
drivers/clk/sprd/div.c | 6 +-
drivers/clk/stm32/clk-stm32-core.c | 42 +++-----
drivers/clk/sunxi-ng/ccu_div.c | 25 +++--
drivers/clk/sunxi-ng/ccu_mp.c | 26 ++---
drivers/clk/sunxi-ng/ccu_mult.c | 16 +--
drivers/clk/sunxi-ng/ccu_mux.c | 49 +++++----
drivers/clk/sunxi-ng/ccu_mux.h | 8 +-
drivers/clk/sunxi-ng/ccu_nkm.c | 25 ++---
drivers/clk/x86/clk-cgu.c | 6 +-
drivers/clk/zynqmp/divider.c | 5 +-
drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c | 7 +-
drivers/phy/ti/phy-j721e-wiz.c | 5 +-
drivers/rtc/rtc-ac100.c | 75 +++++++-------
include/linux/clk-provider.h | 28 ------
29 files changed, 257 insertions(+), 408 deletions(-)
---
base-commit: f8f97927abf7c12382dddc93a144fc9df7919b77
change-id: 20260107-clk-divider-round-rate-1cfd117b0670
Best regards,
--
Brian Masney <bmasney@redhat.com>
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 01/27] clk: sophgo: cv18xx-ip: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 02/27] clk: sunxi-ng: convert from divider_round_rate_parent() " Brian Masney
` (29 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Chen Wang, Inochi Amaoto,
sophgo
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed. Also go ahead and convert all of the driver from round rate
type to determine rate that accepts a 'struct clk_rate_request' to
simplify the overall driver code.
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Chen Wang <unicorn_wang@outlook.com>
To: Inochi Amaoto <inochiama@gmail.com>
Cc: sophgo@lists.linux.dev
---
drivers/clk/sophgo/clk-cv18xx-ip.c | 154 ++++++++++++++++++++-----------------
1 file changed, 85 insertions(+), 69 deletions(-)
diff --git a/drivers/clk/sophgo/clk-cv18xx-ip.c b/drivers/clk/sophgo/clk-cv18xx-ip.c
index c2b58faf0938b7d537dc3a81aef59c549b9c9c79..e936e315400393662a24e0d0189f7f74e01fa586 100644
--- a/drivers/clk/sophgo/clk-cv18xx-ip.c
+++ b/drivers/clk/sophgo/clk-cv18xx-ip.c
@@ -152,28 +152,27 @@ static u32 div_helper_get_clockdiv(struct cv1800_clk_common *common,
return clockdiv;
}
-static u32 div_helper_round_rate(struct cv1800_clk_regfield *div,
- struct clk_hw *hw, struct clk_hw *parent,
- unsigned long rate, unsigned long *prate)
+static int div_helper_determine_rate(struct cv1800_clk_regfield *div,
+ struct clk_hw *hw,
+ struct clk_rate_request *req)
{
if (div->width == 0) {
if (div->initval <= 0)
- return DIV_ROUND_UP_ULL(*prate, 1);
+ req->rate = DIV_ROUND_UP_ULL(req->best_parent_rate, 1);
else
- return DIV_ROUND_UP_ULL(*prate, div->initval);
+ req->rate = DIV_ROUND_UP_ULL(req->best_parent_rate, div->initval);
+
+ return 0;
}
- return divider_round_rate_parent(hw, parent, rate, prate, NULL,
- div->width, div->flags);
+ return divider_determine_rate(hw, req, NULL, div->width, div->flags);
}
-static long div_round_rate(struct clk_hw *parent, unsigned long *parent_rate,
- unsigned long rate, int id, void *data)
+static int do_div_determine_rate(struct clk_rate_request *req, int id, void *data)
{
struct cv1800_clk_div *div = data;
- return div_helper_round_rate(&div->div, &div->common.hw, parent,
- rate, parent_rate);
+ return div_helper_determine_rate(&div->div, &div->common.hw, req);
}
static bool div_is_better_rate(struct cv1800_clk_common *common,
@@ -188,53 +187,60 @@ static bool div_is_better_rate(struct cv1800_clk_common *common,
static int mux_helper_determine_rate(struct cv1800_clk_common *common,
struct clk_rate_request *req,
- long (*round)(struct clk_hw *,
- unsigned long *,
- unsigned long,
- int,
- void *),
+ int (*round)(struct clk_rate_request *,
+ int,
+ void *),
void *data)
{
unsigned long best_parent_rate = 0, best_rate = 0;
struct clk_hw *best_parent, *hw = &common->hw;
unsigned int i;
+ int ret;
if (clk_hw_get_flags(hw) & CLK_SET_RATE_NO_REPARENT) {
- unsigned long adj_parent_rate;
+ struct clk_rate_request tmp_req = *req;
best_parent = clk_hw_get_parent(hw);
- best_parent_rate = clk_hw_get_rate(best_parent);
+ tmp_req.best_parent_hw = best_parent;
+ tmp_req.best_parent_rate = clk_hw_get_rate(best_parent);
- best_rate = round(best_parent, &adj_parent_rate,
- req->rate, -1, data);
+ ret = round(&tmp_req, -1, data);
+ if (ret)
+ return ret;
+
+ best_parent_rate = tmp_req.best_parent_rate;
+ best_rate = tmp_req.rate;
goto find;
}
for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
- unsigned long tmp_rate, parent_rate;
+ struct clk_rate_request tmp_req = *req;
struct clk_hw *parent;
parent = clk_hw_get_parent_by_index(hw, i);
if (!parent)
continue;
- parent_rate = clk_hw_get_rate(parent);
+ tmp_req.best_parent_hw = parent;
+ tmp_req.best_parent_rate = clk_hw_get_rate(parent);
- tmp_rate = round(parent, &parent_rate, req->rate, i, data);
+ ret = round(&tmp_req, i, data);
+ if (ret)
+ continue;
- if (tmp_rate == req->rate) {
+ if (tmp_req.rate == req->rate) {
best_parent = parent;
- best_parent_rate = parent_rate;
- best_rate = tmp_rate;
+ best_parent_rate = tmp_req.best_parent_rate;
+ best_rate = tmp_req.rate;
goto find;
}
if (div_is_better_rate(common, req->rate,
- tmp_rate, best_rate)) {
+ tmp_req.rate, best_rate)) {
best_parent = parent;
- best_parent_rate = parent_rate;
- best_rate = tmp_rate;
+ best_parent_rate = tmp_req.best_parent_rate;
+ best_rate = tmp_req.rate;
}
}
@@ -254,7 +260,7 @@ static int div_determine_rate(struct clk_hw *hw,
struct cv1800_clk_div *div = hw_to_cv1800_clk_div(hw);
return mux_helper_determine_rate(&div->common, req,
- div_round_rate, div);
+ do_div_determine_rate, div);
}
static unsigned long div_recalc_rate(struct clk_hw *hw,
@@ -301,24 +307,28 @@ hw_to_cv1800_clk_bypass_div(struct clk_hw *hw)
return container_of(div, struct cv1800_clk_bypass_div, div);
}
-static long bypass_div_round_rate(struct clk_hw *parent,
- unsigned long *parent_rate,
- unsigned long rate, int id, void *data)
+static int do_bypass_div_determine_rate(struct clk_rate_request *req, int id,
+ void *data)
{
struct cv1800_clk_bypass_div *div = data;
if (id == -1) {
- if (cv1800_clk_checkbit(&div->div.common, &div->bypass))
- return *parent_rate;
- else
- return div_round_rate(parent, parent_rate, rate,
- -1, &div->div);
+ if (cv1800_clk_checkbit(&div->div.common, &div->bypass)) {
+ req->rate = req->best_parent_rate;
+
+ return 0;
+ }
+
+ return do_div_determine_rate(req, -1, &div->div);
}
- if (id == 0)
- return *parent_rate;
+ if (id == 0) {
+ req->rate = req->best_parent_rate;
+
+ return 0;
+ }
- return div_round_rate(parent, parent_rate, rate, id - 1, &div->div);
+ return do_div_determine_rate(req, id - 1, &div->div);
}
static int bypass_div_determine_rate(struct clk_hw *hw,
@@ -327,7 +337,7 @@ static int bypass_div_determine_rate(struct clk_hw *hw,
struct cv1800_clk_bypass_div *div = hw_to_cv1800_clk_bypass_div(hw);
return mux_helper_determine_rate(&div->div.common, req,
- bypass_div_round_rate, div);
+ do_bypass_div_determine_rate, div);
}
static unsigned long bypass_div_recalc_rate(struct clk_hw *hw,
@@ -414,13 +424,11 @@ static int mux_is_enabled(struct clk_hw *hw)
return cv1800_clk_checkbit(&mux->common, &mux->gate);
}
-static long mux_round_rate(struct clk_hw *parent, unsigned long *parent_rate,
- unsigned long rate, int id, void *data)
+static int do_mux_determine_rate(struct clk_rate_request *req, int id, void *data)
{
struct cv1800_clk_mux *mux = data;
- return div_helper_round_rate(&mux->div, &mux->common.hw, parent,
- rate, parent_rate);
+ return div_helper_determine_rate(&mux->div, &mux->common.hw, req);
}
static int mux_determine_rate(struct clk_hw *hw,
@@ -429,7 +437,7 @@ static int mux_determine_rate(struct clk_hw *hw,
struct cv1800_clk_mux *mux = hw_to_cv1800_clk_mux(hw);
return mux_helper_determine_rate(&mux->common, req,
- mux_round_rate, mux);
+ do_mux_determine_rate, mux);
}
static unsigned long mux_recalc_rate(struct clk_hw *hw,
@@ -512,24 +520,28 @@ hw_to_cv1800_clk_bypass_mux(struct clk_hw *hw)
return container_of(mux, struct cv1800_clk_bypass_mux, mux);
}
-static long bypass_mux_round_rate(struct clk_hw *parent,
- unsigned long *parent_rate,
- unsigned long rate, int id, void *data)
+static int do_bypass_mux_determine_rate(struct clk_rate_request *req, int id,
+ void *data)
{
struct cv1800_clk_bypass_mux *mux = data;
if (id == -1) {
- if (cv1800_clk_checkbit(&mux->mux.common, &mux->bypass))
- return *parent_rate;
- else
- return mux_round_rate(parent, parent_rate, rate,
- -1, &mux->mux);
+ if (cv1800_clk_checkbit(&mux->mux.common, &mux->bypass)) {
+ req->rate = req->best_parent_rate;
+
+ return 0;
+ }
+
+ return do_mux_determine_rate(req, -1, &mux->mux);
}
- if (id == 0)
- return *parent_rate;
+ if (id == 0) {
+ req->rate = req->best_parent_rate;
+
+ return 0;
+ }
- return mux_round_rate(parent, parent_rate, rate, id - 1, &mux->mux);
+ return do_mux_determine_rate(req, id - 1, &mux->mux);
}
static int bypass_mux_determine_rate(struct clk_hw *hw,
@@ -538,7 +550,7 @@ static int bypass_mux_determine_rate(struct clk_hw *hw,
struct cv1800_clk_bypass_mux *mux = hw_to_cv1800_clk_bypass_mux(hw);
return mux_helper_determine_rate(&mux->mux.common, req,
- bypass_mux_round_rate, mux);
+ do_bypass_mux_determine_rate, mux);
}
static unsigned long bypass_mux_recalc_rate(struct clk_hw *hw,
@@ -639,27 +651,31 @@ static int mmux_is_enabled(struct clk_hw *hw)
return cv1800_clk_checkbit(&mmux->common, &mmux->gate);
}
-static long mmux_round_rate(struct clk_hw *parent, unsigned long *parent_rate,
- unsigned long rate, int id, void *data)
+static int do_mmux_determine_rate(struct clk_rate_request *req, int id, void *data)
{
struct cv1800_clk_mmux *mmux = data;
s8 div_id;
if (id == -1) {
- if (cv1800_clk_checkbit(&mmux->common, &mmux->bypass))
- return *parent_rate;
+ if (cv1800_clk_checkbit(&mmux->common, &mmux->bypass)) {
+ req->rate = req->best_parent_rate;
+
+ return 0;
+ }
id = mmux_get_parent_id(mmux);
}
div_id = mmux->parent2sel[id];
- if (div_id < 0)
- return *parent_rate;
+ if (div_id < 0) {
+ req->rate = req->best_parent_rate;
+
+ return 0;
+ }
- return div_helper_round_rate(&mmux->div[div_id],
- &mmux->common.hw, parent,
- rate, parent_rate);
+ return div_helper_determine_rate(&mmux->div[div_id], &mmux->common.hw,
+ req);
}
static int mmux_determine_rate(struct clk_hw *hw,
@@ -668,7 +684,7 @@ static int mmux_determine_rate(struct clk_hw *hw,
struct cv1800_clk_mmux *mmux = hw_to_cv1800_clk_mmux(hw);
return mux_helper_determine_rate(&mmux->common, req,
- mmux_round_rate, mmux);
+ do_mmux_determine_rate, mmux);
}
static unsigned long mmux_recalc_rate(struct clk_hw *hw,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 02/27] clk: sunxi-ng: convert from divider_round_rate_parent() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
2026-01-08 21:16 ` [PATCH 01/27] clk: sophgo: cv18xx-ip: convert from divider_round_rate() to divider_determine_rate() Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-11 5:48 ` Chen-Yu Tsai
2026-01-08 21:16 ` [PATCH 03/27] rtc: ac100: convert from divider_round_rate() " Brian Masney
` (28 subsequent siblings)
30 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Chen-Yu Tsai,
Maxime Ripard, Jernej Skrabec, Samuel Holland, linux-arm-kernel,
linux-sunxi
The divider_round_rate_parent() function is now deprecated, so let's
migrate to divider_determine_rate() instead so that this deprecated API
can be removed. Also go ahead and convert all of the driver from round
rate type to determine rate that accepts a 'struct clk_rate_request' to
simplify the overall driver code.
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Chen-Yu Tsai <wens@kernel.org>
To: Maxime Ripard <mripard@kernel.org>
To: Jernej Skrabec <jernej.skrabec@gmail.com>
To: Samuel Holland <samuel@sholland.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-sunxi@lists.linux.dev
---
drivers/clk/sunxi-ng/ccu_div.c | 25 ++++++++++-----------
drivers/clk/sunxi-ng/ccu_mp.c | 26 +++++++++++-----------
drivers/clk/sunxi-ng/ccu_mult.c | 16 +++++++-------
drivers/clk/sunxi-ng/ccu_mux.c | 49 +++++++++++++++++++++++++----------------
drivers/clk/sunxi-ng/ccu_mux.h | 8 +++----
drivers/clk/sunxi-ng/ccu_nkm.c | 25 +++++++++++----------
6 files changed, 79 insertions(+), 70 deletions(-)
diff --git a/drivers/clk/sunxi-ng/ccu_div.c b/drivers/clk/sunxi-ng/ccu_div.c
index 916d6da6d8a3b29240e086eaebbbc620346eef91..62d680ccb524b39d54f0e908c79736f0619f1b4b 100644
--- a/drivers/clk/sunxi-ng/ccu_div.c
+++ b/drivers/clk/sunxi-ng/ccu_div.c
@@ -10,26 +10,25 @@
#include "ccu_gate.h"
#include "ccu_div.h"
-static unsigned long ccu_div_round_rate(struct ccu_mux_internal *mux,
- struct clk_hw *parent,
- unsigned long *parent_rate,
- unsigned long rate,
- void *data)
+static int ccu_div_determine_rate_helper(struct ccu_mux_internal *mux,
+ struct clk_rate_request *req,
+ void *data)
{
struct ccu_div *cd = data;
+ int ret;
if (cd->common.features & CCU_FEATURE_FIXED_POSTDIV)
- rate *= cd->fixed_post_div;
+ req->rate *= cd->fixed_post_div;
- rate = divider_round_rate_parent(&cd->common.hw, parent,
- rate, parent_rate,
- cd->div.table, cd->div.width,
- cd->div.flags);
+ ret = divider_determine_rate(&cd->common.hw, req, cd->div.table,
+ cd->div.width, cd->div.flags);
+ if (ret)
+ return ret;
if (cd->common.features & CCU_FEATURE_FIXED_POSTDIV)
- rate /= cd->fixed_post_div;
+ req->rate /= cd->fixed_post_div;
- return rate;
+ return 0;
}
static void ccu_div_disable(struct clk_hw *hw)
@@ -82,7 +81,7 @@ static int ccu_div_determine_rate(struct clk_hw *hw,
struct ccu_div *cd = hw_to_ccu_div(hw);
return ccu_mux_helper_determine_rate(&cd->common, &cd->mux,
- req, ccu_div_round_rate, cd);
+ req, ccu_div_determine_rate_helper, cd);
}
static int ccu_div_set_rate(struct clk_hw *hw, unsigned long rate,
diff --git a/drivers/clk/sunxi-ng/ccu_mp.c b/drivers/clk/sunxi-ng/ccu_mp.c
index 4221b1888b38da22c16c90796abe6ffab9dc6291..7cdb0eedc69b53aacc8bfb54e309f2013821377b 100644
--- a/drivers/clk/sunxi-ng/ccu_mp.c
+++ b/drivers/clk/sunxi-ng/ccu_mp.c
@@ -103,11 +103,9 @@ static unsigned long ccu_mp_find_best_with_parent_adj(struct clk_hw *hw,
return best_rate;
}
-static unsigned long ccu_mp_round_rate(struct ccu_mux_internal *mux,
- struct clk_hw *hw,
- unsigned long *parent_rate,
- unsigned long rate,
- void *data)
+static int ccu_mp_determine_rate_helper(struct ccu_mux_internal *mux,
+ struct clk_rate_request *req,
+ void *data)
{
struct ccu_mp *cmp = data;
unsigned int max_m, max_p;
@@ -115,7 +113,7 @@ static unsigned long ccu_mp_round_rate(struct ccu_mux_internal *mux,
bool shift = true;
if (cmp->common.features & CCU_FEATURE_FIXED_POSTDIV)
- rate *= cmp->fixed_post_div;
+ req->rate *= cmp->fixed_post_div;
if (cmp->common.features & CCU_FEATURE_DUAL_DIV)
shift = false;
@@ -127,17 +125,19 @@ static unsigned long ccu_mp_round_rate(struct ccu_mux_internal *mux,
max_p = cmp->p.max ?: 1 << cmp->p.width;
if (!clk_hw_can_set_rate_parent(&cmp->common.hw)) {
- rate = ccu_mp_find_best(*parent_rate, rate, max_m, max_p, shift,
- &m, &p);
+ req->rate = ccu_mp_find_best(req->best_parent_rate, req->rate,
+ max_m, max_p, shift, &m, &p);
} else {
- rate = ccu_mp_find_best_with_parent_adj(hw, parent_rate, rate,
- max_m, max_p, shift);
+ req->rate = ccu_mp_find_best_with_parent_adj(req->best_parent_hw,
+ &req->best_parent_rate,
+ req->rate, max_m, max_p,
+ shift);
}
if (cmp->common.features & CCU_FEATURE_FIXED_POSTDIV)
- rate /= cmp->fixed_post_div;
+ req->rate /= cmp->fixed_post_div;
- return rate;
+ return 0;
}
static void ccu_mp_disable(struct clk_hw *hw)
@@ -201,7 +201,7 @@ static int ccu_mp_determine_rate(struct clk_hw *hw,
struct ccu_mp *cmp = hw_to_ccu_mp(hw);
return ccu_mux_helper_determine_rate(&cmp->common, &cmp->mux,
- req, ccu_mp_round_rate, cmp);
+ req, ccu_mp_determine_rate_helper, cmp);
}
static int ccu_mp_set_rate(struct clk_hw *hw, unsigned long rate,
diff --git a/drivers/clk/sunxi-ng/ccu_mult.c b/drivers/clk/sunxi-ng/ccu_mult.c
index 8d5720f3dec1d4eb34bf22166277fdf5a270da42..3fc81e7de6e93d3b8efa1debe08566860617c166 100644
--- a/drivers/clk/sunxi-ng/ccu_mult.c
+++ b/drivers/clk/sunxi-ng/ccu_mult.c
@@ -29,11 +29,9 @@ static void ccu_mult_find_best(unsigned long parent, unsigned long rate,
mult->mult = _mult;
}
-static unsigned long ccu_mult_round_rate(struct ccu_mux_internal *mux,
- struct clk_hw *parent,
- unsigned long *parent_rate,
- unsigned long rate,
- void *data)
+static int ccu_mult_determine_rate_helper(struct ccu_mux_internal *mux,
+ struct clk_rate_request *req,
+ void *data)
{
struct ccu_mult *cm = data;
struct _ccu_mult _cm;
@@ -45,9 +43,11 @@ static unsigned long ccu_mult_round_rate(struct ccu_mux_internal *mux,
else
_cm.max = (1 << cm->mult.width) + cm->mult.offset - 1;
- ccu_mult_find_best(*parent_rate, rate, &_cm);
+ ccu_mult_find_best(req->best_parent_rate, req->rate, &_cm);
- return *parent_rate * _cm.mult;
+ req->rate = req->best_parent_rate * _cm.mult;
+
+ return 0;
}
static void ccu_mult_disable(struct clk_hw *hw)
@@ -97,7 +97,7 @@ static int ccu_mult_determine_rate(struct clk_hw *hw,
struct ccu_mult *cm = hw_to_ccu_mult(hw);
return ccu_mux_helper_determine_rate(&cm->common, &cm->mux,
- req, ccu_mult_round_rate, cm);
+ req, ccu_mult_determine_rate_helper, cm);
}
static int ccu_mult_set_rate(struct clk_hw *hw, unsigned long rate,
diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c
index 74f9e98a5d355d6a26b1655c25e9e48da1f6f10d..766f27cff748edca73ccee610ce1e814600e6404 100644
--- a/drivers/clk/sunxi-ng/ccu_mux.c
+++ b/drivers/clk/sunxi-ng/ccu_mux.c
@@ -79,41 +79,46 @@ static unsigned long ccu_mux_helper_unapply_prediv(struct ccu_common *common,
int ccu_mux_helper_determine_rate(struct ccu_common *common,
struct ccu_mux_internal *cm,
struct clk_rate_request *req,
- unsigned long (*round)(struct ccu_mux_internal *,
- struct clk_hw *,
- unsigned long *,
- unsigned long,
- void *),
+ int (*round)(struct ccu_mux_internal *,
+ struct clk_rate_request *,
+ void *),
void *data)
{
unsigned long best_parent_rate = 0, best_rate = 0;
struct clk_hw *best_parent, *hw = &common->hw;
unsigned int i;
+ int ret;
if (clk_hw_get_flags(hw) & CLK_SET_RATE_NO_REPARENT) {
- unsigned long adj_parent_rate;
+ struct clk_rate_request adj_req = *req;
best_parent = clk_hw_get_parent(hw);
best_parent_rate = clk_hw_get_rate(best_parent);
- adj_parent_rate = ccu_mux_helper_apply_prediv(common, cm, -1,
- best_parent_rate);
- best_rate = round(cm, best_parent, &adj_parent_rate,
- req->rate, data);
+ adj_req.best_parent_hw = best_parent;
+ adj_req.best_parent_rate = ccu_mux_helper_apply_prediv(common, cm, -1,
+ best_parent_rate);
+
+ ret = round(cm, &adj_req, data);
+ if (ret)
+ return ret;
+
+ best_rate = adj_req.rate;
/*
- * adj_parent_rate might have been modified by our clock.
+ * best_parent_rate might have been modified by our clock.
* Unapply the pre-divider if there's one, and give
* the actual frequency the parent needs to run at.
*/
best_parent_rate = ccu_mux_helper_unapply_prediv(common, cm, -1,
- adj_parent_rate);
+ adj_req.best_parent_rate);
goto out;
}
for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
- unsigned long tmp_rate, parent_rate;
+ struct clk_rate_request tmp_req = *req;
+ unsigned long parent_rate;
struct clk_hw *parent;
parent = clk_hw_get_parent_by_index(hw, i);
@@ -123,7 +128,12 @@ int ccu_mux_helper_determine_rate(struct ccu_common *common,
parent_rate = ccu_mux_helper_apply_prediv(common, cm, i,
clk_hw_get_rate(parent));
- tmp_rate = round(cm, parent, &parent_rate, req->rate, data);
+ tmp_req.best_parent_hw = parent;
+ tmp_req.best_parent_rate = parent_rate;
+
+ ret = round(cm, &tmp_req, data);
+ if (ret)
+ continue;
/*
* parent_rate might have been modified by our clock.
@@ -131,16 +141,17 @@ int ccu_mux_helper_determine_rate(struct ccu_common *common,
* the actual frequency the parent needs to run at.
*/
parent_rate = ccu_mux_helper_unapply_prediv(common, cm, i,
- parent_rate);
- if (tmp_rate == req->rate) {
+ tmp_req.best_parent_rate);
+
+ if (tmp_req.rate == req->rate) {
best_parent = parent;
best_parent_rate = parent_rate;
- best_rate = tmp_rate;
+ best_rate = tmp_req.rate;
goto out;
}
- if (ccu_is_better_rate(common, req->rate, tmp_rate, best_rate)) {
- best_rate = tmp_rate;
+ if (ccu_is_better_rate(common, req->rate, tmp_req.rate, best_rate)) {
+ best_rate = tmp_req.rate;
best_parent_rate = parent_rate;
best_parent = parent;
}
diff --git a/drivers/clk/sunxi-ng/ccu_mux.h b/drivers/clk/sunxi-ng/ccu_mux.h
index eb1172ebbd94b5e3515f618390a4753c7eb5be4d..c94a4bde5d01604ac2b317babd4368151d0d08ab 100644
--- a/drivers/clk/sunxi-ng/ccu_mux.h
+++ b/drivers/clk/sunxi-ng/ccu_mux.h
@@ -137,11 +137,9 @@ unsigned long ccu_mux_helper_apply_prediv(struct ccu_common *common,
int ccu_mux_helper_determine_rate(struct ccu_common *common,
struct ccu_mux_internal *cm,
struct clk_rate_request *req,
- unsigned long (*round)(struct ccu_mux_internal *,
- struct clk_hw *,
- unsigned long *,
- unsigned long,
- void *),
+ int (*round)(struct ccu_mux_internal *,
+ struct clk_rate_request *,
+ void *),
void *data);
u8 ccu_mux_helper_get_parent(struct ccu_common *common,
struct ccu_mux_internal *cm);
diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c
index 784eec9ac9979b22e8f384e0abbb5c1a381ae953..401fbb752479b787092c53dfd870692e9eb70dba 100644
--- a/drivers/clk/sunxi-ng/ccu_nkm.c
+++ b/drivers/clk/sunxi-ng/ccu_nkm.c
@@ -162,11 +162,9 @@ static unsigned long ccu_nkm_recalc_rate(struct clk_hw *hw,
return rate;
}
-static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux,
- struct clk_hw *parent_hw,
- unsigned long *parent_rate,
- unsigned long rate,
- void *data)
+static int ccu_nkm_determine_rate_helper(struct ccu_mux_internal *mux,
+ struct clk_rate_request *req,
+ void *data)
{
struct ccu_nkm *nkm = data;
struct _ccu_nkm _nkm;
@@ -179,18 +177,21 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux,
_nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
- rate *= nkm->fixed_post_div;
+ req->rate *= nkm->fixed_post_div;
if (!clk_hw_can_set_rate_parent(&nkm->common.hw))
- rate = ccu_nkm_find_best(*parent_rate, rate, &_nkm, &nkm->common);
+ req->rate = ccu_nkm_find_best(req->best_parent_rate, req->rate,
+ &_nkm, &nkm->common);
else
- rate = ccu_nkm_find_best_with_parent_adj(&nkm->common, parent_hw, parent_rate, rate,
- &_nkm);
+ req->rate = ccu_nkm_find_best_with_parent_adj(&nkm->common,
+ req->best_parent_hw,
+ &req->best_parent_rate,
+ req->rate, &_nkm);
if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
- rate /= nkm->fixed_post_div;
+ req->rate /= nkm->fixed_post_div;
- return rate;
+ return 0;
}
static int ccu_nkm_determine_rate(struct clk_hw *hw,
@@ -199,7 +200,7 @@ static int ccu_nkm_determine_rate(struct clk_hw *hw,
struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
return ccu_mux_helper_determine_rate(&nkm->common, &nkm->mux,
- req, ccu_nkm_round_rate, nkm);
+ req, ccu_nkm_determine_rate_helper, nkm);
}
static int ccu_nkm_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 03/27] rtc: ac100: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
2026-01-08 21:16 ` [PATCH 01/27] clk: sophgo: cv18xx-ip: convert from divider_round_rate() to divider_determine_rate() Brian Masney
2026-01-08 21:16 ` [PATCH 02/27] clk: sunxi-ng: convert from divider_round_rate_parent() " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-22 0:26 ` Alexandre Belloni
2026-01-08 21:16 ` [PATCH 04/27] clk: actions: owl-composite: convert from owl_divider_helper_round_rate() " Brian Masney
` (27 subsequent siblings)
30 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Alexandre Belloni,
linux-rtc
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-rtc@vger.kernel.org
---
drivers/rtc/rtc-ac100.c | 75 +++++++++++++++++++++++++------------------------
1 file changed, 38 insertions(+), 37 deletions(-)
diff --git a/drivers/rtc/rtc-ac100.c b/drivers/rtc/rtc-ac100.c
index 33626311fa781b5ce90dcc472f948dc933bbc897..16aca4431da8c029e6195d8a3c9fe75fa95d0bc0 100644
--- a/drivers/rtc/rtc-ac100.c
+++ b/drivers/rtc/rtc-ac100.c
@@ -140,42 +140,16 @@ static unsigned long ac100_clkout_recalc_rate(struct clk_hw *hw,
AC100_CLKOUT_DIV_WIDTH);
}
-static long ac100_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
- unsigned long prate)
-{
- unsigned long best_rate = 0, tmp_rate, tmp_prate;
- int i;
-
- if (prate == AC100_RTC_32K_RATE)
- return divider_round_rate(hw, rate, &prate, NULL,
- AC100_CLKOUT_DIV_WIDTH,
- CLK_DIVIDER_POWER_OF_TWO);
-
- for (i = 0; ac100_clkout_prediv[i].div; i++) {
- tmp_prate = DIV_ROUND_UP(prate, ac100_clkout_prediv[i].val);
- tmp_rate = divider_round_rate(hw, rate, &tmp_prate, NULL,
- AC100_CLKOUT_DIV_WIDTH,
- CLK_DIVIDER_POWER_OF_TWO);
-
- if (tmp_rate > rate)
- continue;
- if (rate - tmp_rate < best_rate - tmp_rate)
- best_rate = tmp_rate;
- }
-
- return best_rate;
-}
-
static int ac100_clkout_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
- struct clk_hw *best_parent;
+ int i, ret, num_parents = clk_hw_get_num_parents(hw);
+ struct clk_hw *best_parent = NULL;
unsigned long best = 0;
- int i, num_parents = clk_hw_get_num_parents(hw);
for (i = 0; i < num_parents; i++) {
struct clk_hw *parent = clk_hw_get_parent_by_index(hw, i);
- unsigned long tmp, prate;
+ unsigned long prate;
/*
* The clock has two parents, one is a fixed clock which is
@@ -199,13 +173,40 @@ static int ac100_clkout_determine_rate(struct clk_hw *hw,
prate = clk_hw_get_rate(parent);
- tmp = ac100_clkout_round_rate(hw, req->rate, prate);
-
- if (tmp > req->rate)
- continue;
- if (req->rate - tmp < req->rate - best) {
- best = tmp;
- best_parent = parent;
+ if (prate == AC100_RTC_32K_RATE) {
+ struct clk_rate_request div_req = *req;
+
+ div_req.best_parent_rate = prate;
+
+ ret = divider_determine_rate(hw, &div_req, NULL,
+ AC100_CLKOUT_DIV_WIDTH,
+ CLK_DIVIDER_POWER_OF_TWO);
+ if (ret != 0 || div_req.rate > req->rate)
+ continue;
+ else if (req->rate - div_req.rate < req->rate - best) {
+ best = div_req.rate;
+ best_parent = parent;
+ }
+ } else {
+ int j;
+
+ for (j = 0; ac100_clkout_prediv[j].div; j++) {
+ struct clk_rate_request div_req = *req;
+ unsigned long tmp_prate;
+
+ tmp_prate = DIV_ROUND_UP(prate, ac100_clkout_prediv[j].div);
+ div_req.best_parent_rate = tmp_prate;
+
+ ret = divider_determine_rate(hw, &div_req, NULL,
+ AC100_CLKOUT_DIV_WIDTH,
+ CLK_DIVIDER_POWER_OF_TWO);
+ if (ret != 0 || div_req.rate > req->rate)
+ continue;
+ else if (req->rate - div_req.rate < req->rate - best) {
+ best = div_req.rate;
+ best_parent = parent;
+ }
+ }
}
}
@@ -213,7 +214,7 @@ static int ac100_clkout_determine_rate(struct clk_hw *hw,
return -EINVAL;
req->best_parent_hw = best_parent;
- req->best_parent_rate = best;
+ req->best_parent_rate = clk_hw_get_rate(best_parent);
req->rate = best;
return 0;
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 04/27] clk: actions: owl-composite: convert from owl_divider_helper_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (2 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 03/27] rtc: ac100: convert from divider_round_rate() " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-16 5:27 ` Manivannan Sadhasivam
2026-01-08 21:16 ` [PATCH 05/27] clk: actions: owl-divider: convert from divider_round_rate() " Brian Masney
` (26 subsequent siblings)
30 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Andreas Färber,
Manivannan Sadhasivam, linux-arm-kernel, linux-actions
owl_divider_helper_round_rate() is just a wrapper for
divider_round_rate(), which is deprecated. Let's migrate to
divider_determine_rate() instead so that this deprecated API can be
removed.
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: "Andreas Färber" <afaerber@suse.de>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-actions@lists.infradead.org
---
drivers/clk/actions/owl-composite.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
index 00b74f8bc4375a8f42e9b54c7bf1affe91e1074a..9540444307d6c960af200ec13e7c60abd47ffc85 100644
--- a/drivers/clk/actions/owl-composite.c
+++ b/drivers/clk/actions/owl-composite.c
@@ -57,15 +57,10 @@ static int owl_comp_div_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct owl_composite *comp = hw_to_owl_comp(hw);
- long rate;
-
- rate = owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw,
- req->rate, &req->best_parent_rate);
- if (rate < 0)
- return rate;
+ struct owl_divider_hw *div = &comp->rate.div_hw;
- req->rate = rate;
- return 0;
+ return divider_determine_rate(&comp->common.hw, req, div->table,
+ div->width, div->div_flags);
}
static unsigned long owl_comp_div_recalc_rate(struct clk_hw *hw,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 05/27] clk: actions: owl-divider: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (3 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 04/27] clk: actions: owl-composite: convert from owl_divider_helper_round_rate() " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-16 5:26 ` Manivannan Sadhasivam
2026-01-08 21:16 ` [PATCH 06/27] clk: bm1880: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
` (25 subsequent siblings)
30 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Andreas Färber,
Manivannan Sadhasivam, linux-arm-kernel, linux-actions
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed. Additionally, owl_divider_helper_round_rate() is no longer used,
so let's drop that from the header file as well.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 1b04e12a8bcc ("clk: actions: owl-divider: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: "Andreas Färber" <afaerber@suse.de>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-actions@lists.infradead.org
---
drivers/clk/actions/owl-divider.c | 17 ++---------------
drivers/clk/actions/owl-divider.h | 5 -----
2 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/drivers/clk/actions/owl-divider.c b/drivers/clk/actions/owl-divider.c
index 118f1393c6780f287d26736b2547a8b43751655a..316ace80e87e3b1c22a4011e725644cf37668e5e 100644
--- a/drivers/clk/actions/owl-divider.c
+++ b/drivers/clk/actions/owl-divider.c
@@ -13,26 +13,13 @@
#include "owl-divider.h"
-long owl_divider_helper_round_rate(struct owl_clk_common *common,
- const struct owl_divider_hw *div_hw,
- unsigned long rate,
- unsigned long *parent_rate)
-{
- return divider_round_rate(&common->hw, rate, parent_rate,
- div_hw->table, div_hw->width,
- div_hw->div_flags);
-}
-
static int owl_divider_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct owl_divider *div = hw_to_owl_divider(hw);
- req->rate = owl_divider_helper_round_rate(&div->common, &div->div_hw,
- req->rate,
- &req->best_parent_rate);
-
- return 0;
+ return divider_determine_rate(hw, req, div->div_hw.table,
+ div->div_hw.width, div->div_hw.div_flags);
}
unsigned long owl_divider_helper_recalc_rate(struct owl_clk_common *common,
diff --git a/drivers/clk/actions/owl-divider.h b/drivers/clk/actions/owl-divider.h
index d76f58782c52885a66c96e8bf13b0dea3ba51efd..1d3bb4e5898a3ccf729894533ae194ac4c34b6e3 100644
--- a/drivers/clk/actions/owl-divider.h
+++ b/drivers/clk/actions/owl-divider.h
@@ -56,11 +56,6 @@ static inline struct owl_divider *hw_to_owl_divider(struct clk_hw *hw)
return container_of(common, struct owl_divider, common);
}
-long owl_divider_helper_round_rate(struct owl_clk_common *common,
- const struct owl_divider_hw *div_hw,
- unsigned long rate,
- unsigned long *parent_rate);
-
unsigned long owl_divider_helper_recalc_rate(struct owl_clk_common *common,
const struct owl_divider_hw *div_hw,
unsigned long parent_rate);
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 06/27] clk: bm1880: convert from divider_ro_round_rate() to divider_ro_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (4 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 05/27] clk: actions: owl-divider: convert from divider_round_rate() " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-16 5:23 ` Manivannan Sadhasivam
2026-01-08 21:16 ` [PATCH 07/27] clk: bm1880: convert from divider_round_rate() to divider_determine_rate() Brian Masney
` (24 subsequent siblings)
30 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Manivannan Sadhasivam,
linux-arm-kernel
The divider_ro_round_rate() function is now deprecated, so let's migrate
to divider_ro_determine_rate() instead so that this deprecated API can
be removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: cf1d95fa0c64 ("clk: bm1880: convert from divider_round_rate() to divider_determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/clk/clk-bm1880.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/clk-bm1880.c b/drivers/clk/clk-bm1880.c
index dac190bc6e19a6dd4be413ea52d41f74934a1aa9..536df8e828eab83fbd3812135139c703aa7a1ce3 100644
--- a/drivers/clk/clk-bm1880.c
+++ b/drivers/clk/clk-bm1880.c
@@ -621,12 +621,8 @@ static int bm1880_clk_div_determine_rate(struct clk_hw *hw,
val = readl(reg_addr) >> div->shift;
val &= clk_div_mask(div->width);
- req->rate = divider_ro_round_rate(hw, req->rate,
- &req->best_parent_rate,
- div->table,
- div->width, div->flags, val);
-
- return 0;
+ return divider_ro_determine_rate(hw, req, div->table,
+ div->width, div->flags, val);
}
req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 07/27] clk: bm1880: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (5 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 06/27] clk: bm1880: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-16 5:24 ` Manivannan Sadhasivam
2026-01-08 21:16 ` [PATCH 08/27] clk: hisilicon: clkdivider-hi6220: " Brian Masney
` (23 subsequent siblings)
30 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Manivannan Sadhasivam,
linux-arm-kernel
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 64613d7fb42f ("clk: bm1880: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/clk/clk-bm1880.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/clk/clk-bm1880.c b/drivers/clk/clk-bm1880.c
index 536df8e828eab83fbd3812135139c703aa7a1ce3..1bdceb36fa87e8250c10a7fc0791379e1533bb38 100644
--- a/drivers/clk/clk-bm1880.c
+++ b/drivers/clk/clk-bm1880.c
@@ -625,10 +625,7 @@ static int bm1880_clk_div_determine_rate(struct clk_hw *hw,
div->width, div->flags, val);
}
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- div->table, div->width, div->flags);
-
- return 0;
+ return divider_determine_rate(hw, req, div->table, div->width, div->flags);
}
static int bm1880_clk_div_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 08/27] clk: hisilicon: clkdivider-hi6220: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (6 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 07/27] clk: bm1880: convert from divider_round_rate() to divider_determine_rate() Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 09/27] clk: loongson1: " Brian Masney
` (22 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, linux-kernel, Brian Masney
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 619a6210f398 ("clk: hisilicon: clkdivider-hi6220: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
drivers/clk/hisilicon/clkdivider-hi6220.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/hisilicon/clkdivider-hi6220.c b/drivers/clk/hisilicon/clkdivider-hi6220.c
index 6bae18a84cb6c0e19dd00762613fd9051849fdd0..fd7ceb92d6515757f79cd0496ce4a8ae7220f321 100644
--- a/drivers/clk/hisilicon/clkdivider-hi6220.c
+++ b/drivers/clk/hisilicon/clkdivider-hi6220.c
@@ -60,10 +60,8 @@ static int hi6220_clkdiv_determine_rate(struct clk_hw *hw,
{
struct hi6220_clk_divider *dclk = to_hi6220_clk_divider(hw);
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate, dclk->table,
- dclk->width, CLK_DIVIDER_ROUND_CLOSEST);
-
- return 0;
+ return divider_determine_rate(hw, req, dclk->table, dclk->width,
+ CLK_DIVIDER_ROUND_CLOSEST);
}
static int hi6220_clkdiv_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 09/27] clk: loongson1: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (7 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 08/27] clk: hisilicon: clkdivider-hi6220: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-13 6:28 ` Keguang Zhang
2026-01-08 21:16 ` [PATCH 10/27] clk: milbeaut: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
` (21 subsequent siblings)
30 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Keguang Zhang, linux-mips
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: bb40a2ef4fc9 ("clk: loongson1: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Keguang Zhang <keguang.zhang@gmail.com>
Cc: linux-mips@vger.kernel.org
---
drivers/clk/clk-loongson1.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/clk/clk-loongson1.c b/drivers/clk/clk-loongson1.c
index f9f060d08a5fae3291a9408c6dc93531b435609f..1674181a1107dc4f30e78ee410a55a49b6d0b4b5 100644
--- a/drivers/clk/clk-loongson1.c
+++ b/drivers/clk/clk-loongson1.c
@@ -99,10 +99,7 @@ static int ls1x_divider_determine_rate(struct clk_hw *hw,
struct ls1x_clk *ls1x_clk = to_ls1x_clk(hw);
const struct ls1x_clk_div_data *d = ls1x_clk->data;
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- d->table, d->width, d->flags);
-
- return 0;
+ return divider_determine_rate(hw, req, d->table, d->width, d->flags);
}
static int ls1x_divider_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 10/27] clk: milbeaut: convert from divider_ro_round_rate() to divider_ro_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (8 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 09/27] clk: loongson1: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 11/27] clk: milbeaut: convert from divider_round_rate() to divider_determine_rate() Brian Masney
` (20 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Taichi Sugaya, Takao Orito,
linux-arm-kernel
The divider_ro_round_rate() function is now deprecated, so let's migrate
to divider_ro_determine_rate() instead so that this deprecated API can
be removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: fe67c682f91c ("clk: milbeaut: convert from divider_round_rate() to divider_determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Taichi Sugaya <sugaya.taichi@socionext.com>
To: Takao Orito <orito.takao@socionext.com>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/clk/clk-milbeaut.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/clk/clk-milbeaut.c b/drivers/clk/clk-milbeaut.c
index b4f9b7143eaa658a7f2a14ff3cc9d91d8aa071c6..4e3790b7fc9064484c20a068d0315b8fc8241290 100644
--- a/drivers/clk/clk-milbeaut.c
+++ b/drivers/clk/clk-milbeaut.c
@@ -398,13 +398,9 @@ static int m10v_clk_divider_determine_rate(struct clk_hw *hw,
val = readl(divider->reg) >> divider->shift;
val &= clk_div_mask(divider->width);
- req->rate = divider_ro_round_rate(hw, req->rate,
- &req->best_parent_rate,
- divider->table,
- divider->width,
- divider->flags, val);
-
- return 0;
+ return divider_ro_determine_rate(hw, req, divider->table,
+ divider->width, divider->flags,
+ val);
}
req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 11/27] clk: milbeaut: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (9 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 10/27] clk: milbeaut: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 12/27] clk: nuvoton: ma35d1-divider: " Brian Masney
` (19 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Taichi Sugaya, Takao Orito,
linux-arm-kernel
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 7b45988fcf78 ("clk: milbeaut: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Taichi Sugaya <sugaya.taichi@socionext.com>
To: Takao Orito <orito.takao@socionext.com>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/clk/clk-milbeaut.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/clk/clk-milbeaut.c b/drivers/clk/clk-milbeaut.c
index 4e3790b7fc9064484c20a068d0315b8fc8241290..45389db652e04e3c30c2a64da63b047b7922b8de 100644
--- a/drivers/clk/clk-milbeaut.c
+++ b/drivers/clk/clk-milbeaut.c
@@ -403,10 +403,7 @@ static int m10v_clk_divider_determine_rate(struct clk_hw *hw,
val);
}
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- divider->table, divider->width, divider->flags);
-
- return 0;
+ return divider_determine_rate(hw, req, divider->table, divider->width, divider->flags);
}
static int m10v_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 12/27] clk: nuvoton: ma35d1-divider: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (10 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 11/27] clk: milbeaut: convert from divider_round_rate() to divider_determine_rate() Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 13/27] clk: nxp: lpc32xx: " Brian Masney
` (18 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Jacky Huang,
Shan-Chun Hung, linux-arm-kernel
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 215f8aa095a1 ("clk: nuvoton: ma35d1-divider: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Jacky Huang <ychuang3@nuvoton.com>
To: Shan-Chun Hung <schung@nuvoton.com>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/clk/nuvoton/clk-ma35d1-divider.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/nuvoton/clk-ma35d1-divider.c b/drivers/clk/nuvoton/clk-ma35d1-divider.c
index e39f53d5bf4578c628d34b05233c8e8da317c4d4..e992e7c30341977bd4baaad8b24e17039252f90c 100644
--- a/drivers/clk/nuvoton/clk-ma35d1-divider.c
+++ b/drivers/clk/nuvoton/clk-ma35d1-divider.c
@@ -44,11 +44,8 @@ static int ma35d1_clkdiv_determine_rate(struct clk_hw *hw,
{
struct ma35d1_adc_clk_div *dclk = to_ma35d1_adc_clk_div(hw);
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- dclk->table, dclk->width,
- CLK_DIVIDER_ROUND_CLOSEST);
-
- return 0;
+ return divider_determine_rate(hw, req, dclk->table, dclk->width,
+ CLK_DIVIDER_ROUND_CLOSEST);
}
static int ma35d1_clkdiv_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate)
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 13/27] clk: nxp: lpc32xx: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (11 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 12/27] clk: nuvoton: ma35d1-divider: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-09 8:10 ` Vladimir Zapolskiy
2026-01-08 21:16 ` [PATCH 14/27] clk: qcom: alpha-pll: " Brian Masney
` (17 subsequent siblings)
30 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Vladimir Zapolskiy,
Piotr Wojtaszczyk, linux-arm-kernel
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 0879768df240 ("clk: nxp: lpc32xx: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Vladimir Zapolskiy <vz@mleia.com>
To: Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/clk/nxp/clk-lpc32xx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/nxp/clk-lpc32xx.c b/drivers/clk/nxp/clk-lpc32xx.c
index 23f980cf6a2b59ee1c93a2519fe5188d251fa12f..ae2fa5341a2e4fbe5f2d3ef9a6cf9e9d75180d59 100644
--- a/drivers/clk/nxp/clk-lpc32xx.c
+++ b/drivers/clk/nxp/clk-lpc32xx.c
@@ -975,10 +975,8 @@ static int clk_divider_determine_rate(struct clk_hw *hw,
return 0;
}
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- divider->table, divider->width, divider->flags);
-
- return 0;
+ return divider_determine_rate(hw, req, divider->table, divider->width,
+ divider->flags);
}
static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 14/27] clk: qcom: alpha-pll: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (12 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 13/27] clk: nxp: lpc32xx: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:28 ` Abel Vesa
2026-01-08 21:16 ` [PATCH 15/27] clk: qcom: regmap-divider: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
` (16 subsequent siblings)
30 siblings, 2 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Bjorn Andersson,
linux-arm-msm
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 0e56e3369b60 ("clk: qcom: alpha-pll: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Bjorn Andersson <andersson@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
---
drivers/clk/qcom/clk-alpha-pll.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c
index 6aeba40358c11e44c5f39d15f149d62149393cd3..a84e8bee6534629bf578af6d2592ea998f6c9090 100644
--- a/drivers/clk/qcom/clk-alpha-pll.c
+++ b/drivers/clk/qcom/clk-alpha-pll.c
@@ -1257,11 +1257,8 @@ static int clk_alpha_pll_postdiv_determine_rate(struct clk_hw *hw,
else
table = clk_alpha_div_table;
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- table, pll->width,
- CLK_DIVIDER_POWER_OF_TWO);
-
- return 0;
+ return divider_determine_rate(hw, req, table, pll->width,
+ CLK_DIVIDER_POWER_OF_TWO);
}
static int clk_alpha_pll_postdiv_ro_determine_rate(struct clk_hw *hw,
@@ -1617,11 +1614,8 @@ static int clk_trion_pll_postdiv_determine_rate(struct clk_hw *hw,
{
struct clk_alpha_pll_postdiv *pll = to_clk_alpha_pll_postdiv(hw);
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- pll->post_div_table,
- pll->width, CLK_DIVIDER_ROUND_CLOSEST);
-
- return 0;
+ return divider_determine_rate(hw, req, pll->post_div_table, pll->width,
+ CLK_DIVIDER_ROUND_CLOSEST);
};
static int
@@ -1657,11 +1651,8 @@ static int clk_alpha_pll_postdiv_fabia_determine_rate(struct clk_hw *hw,
{
struct clk_alpha_pll_postdiv *pll = to_clk_alpha_pll_postdiv(hw);
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- pll->post_div_table,
- pll->width, CLK_DIVIDER_ROUND_CLOSEST);
-
- return 0;
+ return divider_determine_rate(hw, req, pll->post_div_table, pll->width,
+ CLK_DIVIDER_ROUND_CLOSEST);
}
static int clk_alpha_pll_postdiv_fabia_set_rate(struct clk_hw *hw,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 15/27] clk: qcom: regmap-divider: convert from divider_ro_round_rate() to divider_ro_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (13 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 14/27] clk: qcom: alpha-pll: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:28 ` Abel Vesa
2026-01-08 21:16 ` [PATCH 16/27] clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate() Brian Masney
` (15 subsequent siblings)
30 siblings, 2 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Bjorn Andersson,
linux-arm-msm
The divider_ro_round_rate() function is now deprecated, so let's migrate
to divider_ro_determine_rate() instead so that this deprecated API can
be removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 859a7e020b23 ("clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Bjorn Andersson <andersson@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
---
drivers/clk/qcom/clk-regmap-divider.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/qcom/clk-regmap-divider.c b/drivers/clk/qcom/clk-regmap-divider.c
index 4f5395f0ab6d0ed8cebbb32cc231063932ba85a1..af9c01dd785372166122224e717c119a2365f4e1 100644
--- a/drivers/clk/qcom/clk-regmap-divider.c
+++ b/drivers/clk/qcom/clk-regmap-divider.c
@@ -26,12 +26,8 @@ static int div_ro_determine_rate(struct clk_hw *hw,
val >>= divider->shift;
val &= BIT(divider->width) - 1;
- req->rate = divider_ro_round_rate(hw, req->rate,
- &req->best_parent_rate, NULL,
- divider->width,
- CLK_DIVIDER_ROUND_CLOSEST, val);
-
- return 0;
+ return divider_ro_determine_rate(hw, req, NULL, divider->width,
+ CLK_DIVIDER_ROUND_CLOSEST, val);
}
static int div_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 16/27] clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (14 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 15/27] clk: qcom: regmap-divider: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:29 ` Abel Vesa
2026-01-08 21:16 ` [PATCH 17/27] clk: sophgo: sg2042-clkgen: " Brian Masney
` (14 subsequent siblings)
30 siblings, 2 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Bjorn Andersson,
linux-arm-msm
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: b6f90511c165 ("clk: qcom: regmap-divider: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Bjorn Andersson <andersson@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
---
drivers/clk/qcom/clk-regmap-divider.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/qcom/clk-regmap-divider.c b/drivers/clk/qcom/clk-regmap-divider.c
index af9c01dd785372166122224e717c119a2365f4e1..672e82caf2050446d14e64617a4b90d0b09201a4 100644
--- a/drivers/clk/qcom/clk-regmap-divider.c
+++ b/drivers/clk/qcom/clk-regmap-divider.c
@@ -34,12 +34,8 @@ static int div_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
{
struct clk_regmap_div *divider = to_clk_regmap_div(hw);
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- NULL,
- divider->width,
- CLK_DIVIDER_ROUND_CLOSEST);
-
- return 0;
+ return divider_determine_rate(hw, req, NULL, divider->width,
+ CLK_DIVIDER_ROUND_CLOSEST);
}
static int div_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 17/27] clk: sophgo: sg2042-clkgen: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (15 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 16/27] clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate() Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-12 2:57 ` Chen Wang
2026-01-08 21:16 ` [PATCH 18/27] clk: sprd: div: " Brian Masney
` (13 subsequent siblings)
30 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Chen Wang, Inochi Amaoto,
sophgo
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Note that this commit also removes a debugging message that's not really
needed.
Fixes: 9a3b6993613d ("clk: sophgo: sg2042-clkgen: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Chen Wang <unicorn_wang@outlook.com>
To: Inochi Amaoto <inochiama@gmail.com>
Cc: sophgo@lists.linux.dev
---
drivers/clk/sophgo/clk-sg2042-clkgen.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/clk/sophgo/clk-sg2042-clkgen.c b/drivers/clk/sophgo/clk-sg2042-clkgen.c
index 683661b71787c9e5428b168502f6fbb30ea9f7da..9725ac4e050a4e6afd3fd50241fbd2fc105a31ca 100644
--- a/drivers/clk/sophgo/clk-sg2042-clkgen.c
+++ b/drivers/clk/sophgo/clk-sg2042-clkgen.c
@@ -180,7 +180,6 @@ static int sg2042_clk_divider_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct sg2042_divider_clock *divider = to_sg2042_clk_divider(hw);
- unsigned long ret_rate;
u32 bestdiv;
/* if read only, just return current value */
@@ -191,17 +190,13 @@ static int sg2042_clk_divider_determine_rate(struct clk_hw *hw,
bestdiv = readl(divider->reg) >> divider->shift;
bestdiv &= clk_div_mask(divider->width);
}
- ret_rate = DIV_ROUND_UP_ULL((u64)req->best_parent_rate, bestdiv);
- } else {
- ret_rate = divider_round_rate(hw, req->rate, &req->best_parent_rate, NULL,
- divider->width, divider->div_flags);
- }
+ req->rate = DIV_ROUND_UP_ULL((u64)req->best_parent_rate, bestdiv);
- pr_debug("--> %s: divider_round_rate: val = %ld\n",
- clk_hw_get_name(hw), ret_rate);
- req->rate = ret_rate;
+ return 0;
+ }
- return 0;
+ return divider_determine_rate(hw, req, NULL, divider->width,
+ divider->div_flags);
}
static int sg2042_clk_divider_set_rate(struct clk_hw *hw,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 18/27] clk: sprd: div: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (16 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 17/27] clk: sophgo: sg2042-clkgen: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 19/27] clk: stm32: stm32-core: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
` (12 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Orson Zhai, Baolin Wang,
Chunyan Zhang
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: deb4740a5ff8 ("clk: sprd: div: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Orson Zhai <orsonzhai@gmail.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>
---
drivers/clk/sprd/div.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/clk/sprd/div.c b/drivers/clk/sprd/div.c
index 013423881968002d29c4e9536e7cd7b944779196..cd57163a7204c0b21ac081bfda3ab57cab28fbc4 100644
--- a/drivers/clk/sprd/div.c
+++ b/drivers/clk/sprd/div.c
@@ -14,11 +14,7 @@ static int sprd_div_determine_rate(struct clk_hw *hw,
{
struct sprd_div *cd = hw_to_sprd_div(hw);
- req->rate = divider_round_rate(&cd->common.hw, req->rate,
- &req->best_parent_rate,
- NULL, cd->div.width, 0);
-
- return 0;
+ return divider_determine_rate(&cd->common.hw, req, NULL, cd->div.width, 0);
}
unsigned long sprd_div_helper_recalc_rate(struct sprd_clk_common *common,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 19/27] clk: stm32: stm32-core: convert from divider_ro_round_rate() to divider_ro_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (17 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 18/27] clk: sprd: div: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 20/27] clk: stm32: stm32-core: convert from divider_round_rate_parent() to divider_determine_rate() Brian Masney
` (11 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Maxime Coquelin,
Alexandre Torgue, linux-stm32, linux-arm-kernel
The divider_ro_round_rate() function is now deprecated, so let's migrate
to divider_ro_determine_rate() instead so that this deprecated API can
be removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: cd1cb38836c0 ("clk: stm32: stm32-core: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Maxime Coquelin <mcoquelin.stm32@gmail.com>
To: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/clk/stm32/clk-stm32-core.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c
index 72825b9c36a4d3b8ba3f7615b9026c09ffaf88d1..b95b9c591fda7d900d523f50c8bd449398aba49f 100644
--- a/drivers/clk/stm32/clk-stm32-core.c
+++ b/drivers/clk/stm32/clk-stm32-core.c
@@ -369,13 +369,10 @@ static int clk_stm32_divider_determine_rate(struct clk_hw *hw,
val = readl(div->base + divider->offset) >> divider->shift;
val &= clk_div_mask(divider->width);
- req->rate = divider_ro_round_rate(hw, req->rate,
- &req->best_parent_rate,
- divider->table,
- divider->width,
- divider->flags, val);
-
- return 0;
+ return divider_ro_determine_rate(hw, req,
+ divider->table,
+ divider->width,
+ divider->flags, val);
}
req->rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw),
@@ -455,14 +452,9 @@ static int clk_stm32_composite_determine_rate(struct clk_hw *hw,
val = readl(composite->base + divider->offset) >> divider->shift;
val &= clk_div_mask(divider->width);
- rate = divider_ro_round_rate(hw, req->rate, &req->best_parent_rate,
- divider->table, divider->width, divider->flags,
- val);
- if (rate < 0)
- return rate;
-
- req->rate = rate;
- return 0;
+ return divider_ro_determine_rate(hw, req, divider->table,
+ divider->width, divider->flags,
+ val);
}
rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw),
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 20/27] clk: stm32: stm32-core: convert from divider_round_rate_parent() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (18 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 19/27] clk: stm32: stm32-core: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 21/27] clk: versaclock3: convert from divider_round_rate() " Brian Masney
` (10 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Maxime Coquelin,
Alexandre Torgue, linux-stm32, linux-arm-kernel
The divider_round_rate_parent() function is now deprecated, so let's
migrate to divider_determine_rate() instead so that this deprecated API
can be removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: cd1cb38836c0 ("clk: stm32: stm32-core: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Maxime Coquelin <mcoquelin.stm32@gmail.com>
To: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/clk/stm32/clk-stm32-core.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c
index b95b9c591fda7d900d523f50c8bd449398aba49f..e921c25a929c303a2e189bf876667178a123eae1 100644
--- a/drivers/clk/stm32/clk-stm32-core.c
+++ b/drivers/clk/stm32/clk-stm32-core.c
@@ -375,13 +375,8 @@ static int clk_stm32_divider_determine_rate(struct clk_hw *hw,
divider->flags, val);
}
- req->rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw),
- req->rate,
- &req->best_parent_rate,
- divider->table,
- divider->width, divider->flags);
-
- return 0;
+ return divider_determine_rate(hw, req, divider->table, divider->width,
+ divider->flags);
}
static unsigned long clk_stm32_divider_recalc_rate(struct clk_hw *hw,
@@ -438,7 +433,6 @@ static int clk_stm32_composite_determine_rate(struct clk_hw *hw,
{
struct clk_stm32_composite *composite = to_clk_stm32_composite(hw);
const struct stm32_div_cfg *divider;
- long rate;
if (composite->div_id == NO_STM32_DIV)
return 0;
@@ -457,14 +451,8 @@ static int clk_stm32_composite_determine_rate(struct clk_hw *hw,
val);
}
- rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw),
- req->rate, &req->best_parent_rate,
- divider->table, divider->width, divider->flags);
- if (rate < 0)
- return rate;
-
- req->rate = rate;
- return 0;
+ return divider_determine_rate(hw, req, divider->table, divider->width,
+ divider->flags);
}
static u8 clk_stm32_composite_get_parent(struct clk_hw *hw)
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 21/27] clk: versaclock3: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (19 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 20/27] clk: stm32: stm32-core: convert from divider_round_rate_parent() to divider_determine_rate() Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 22/27] clk: x86: cgu: " Brian Masney
` (9 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, linux-kernel, Brian Masney
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 9e3372b2ebac ("clk: versaclock3: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
drivers/clk/clk-versaclock3.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/clk-versaclock3.c b/drivers/clk/clk-versaclock3.c
index 1849863dbd673f3b133b9a295dc608ea43931de6..27b6cf70f3ae1bff1264933d8bac4ccc65481a1c 100644
--- a/drivers/clk/clk-versaclock3.c
+++ b/drivers/clk/clk-versaclock3.c
@@ -523,11 +523,8 @@ static int vc3_div_determine_rate(struct clk_hw *hw,
return 0;
}
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- div_data->table,
- div_data->width, div_data->flags);
-
- return 0;
+ return divider_determine_rate(hw, req, div_data->table, div_data->width,
+ div_data->flags);
}
static int vc3_div_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 22/27] clk: x86: cgu: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (20 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 21/27] clk: versaclock3: convert from divider_round_rate() " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 23/27] clk: zynqmp: divider: " Brian Masney
` (8 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, linux-kernel, Brian Masney
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: f7a6bed91a19 ("clk: x86: cgu: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
drivers/clk/x86/clk-cgu.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/x86/clk-cgu.c b/drivers/clk/x86/clk-cgu.c
index d099667355f8d80785b0f43097ad10c274dd61ea..92ee05d75af2b262d3e0e281c79fa07b3be1574c 100644
--- a/drivers/clk/x86/clk-cgu.c
+++ b/drivers/clk/x86/clk-cgu.c
@@ -137,10 +137,8 @@ static int lgm_clk_divider_determine_rate(struct clk_hw *hw,
{
struct lgm_clk_divider *divider = to_lgm_clk_divider(hw);
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate, divider->table,
- divider->width, divider->flags);
-
- return 0;
+ return divider_determine_rate(hw, req, divider->table, divider->width,
+ divider->flags);
}
static int
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 23/27] clk: zynqmp: divider: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (21 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 22/27] clk: x86: cgu: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 24/27] drm/msm/dsi_phy_14nm: " Brian Masney
` (7 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Michal Simek,
linux-arm-kernel
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 0f9cf96a01fd ("clk: zynqmp: divider: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Michal Simek <michal.simek@amd.com>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/clk/zynqmp/divider.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c
index c824eeacd8ebd4d670d78f1af2186e61008bdae2..de6f478d527d89881a9c0deb04e7bc0a5bf6ebba 100644
--- a/drivers/clk/zynqmp/divider.c
+++ b/drivers/clk/zynqmp/divider.c
@@ -151,8 +151,9 @@ static int zynqmp_clk_divider_determine_rate(struct clk_hw *hw,
width = fls(divider->max_div);
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- NULL, width, divider->flags);
+ ret = divider_determine_rate(hw, req, NULL, width, divider->flags);
+ if (ret != 0)
+ return ret;
if (divider->is_frac && (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) &&
(req->rate % req->best_parent_rate))
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 24/27] drm/msm/dsi_phy_14nm: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (22 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 23/27] clk: zynqmp: divider: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:29 ` Abel Vesa
2026-01-08 21:16 ` [PATCH 25/27] phy: ti: phy-j721e-wiz: " Brian Masney
` (6 subsequent siblings)
30 siblings, 2 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Rob Clark,
Dmitry Baryshkov, David Airlie, Simona Vetter, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, linux-arm-msm,
dri-devel, freedreno
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: cc41f29a6b04 ("drm/msm/dsi_phy_14nm: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Rob Clark <robin.clark@oss.qualcomm.com>
To: Dmitry Baryshkov <lumag@kernel.org>
To: David Airlie <airlied@gmail.com>
To: Simona Vetter <simona@ffwll.ch>
Cc: Abhinav Kumar <abhinav.kumar@linux.dev>
Cc: Jessica Zhang <jesszhan0024@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
---
drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
index fdefcbd9c2848a1c76414a41b811b29e5fed9ddc..a156c7e7cea83286e7ad47aa9818761670c68e89 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
@@ -628,12 +628,7 @@ static int dsi_pll_14nm_postdiv_determine_rate(struct clk_hw *hw,
DBG("DSI%d PLL parent rate=%lu", pll_14nm->phy->id, req->rate);
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- NULL,
- postdiv->width,
- postdiv->flags);
-
- return 0;
+ return divider_determine_rate(hw, req, NULL, postdiv->width, postdiv->flags);
}
static int dsi_pll_14nm_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 25/27] phy: ti: phy-j721e-wiz: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (23 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 24/27] drm/msm/dsi_phy_14nm: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-14 14:17 ` Vinod Koul
2026-01-08 21:16 ` [PATCH 26/27] clk: divider: remove divider_ro_round_rate_parent() Brian Masney
` (5 subsequent siblings)
30 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Brian Masney, Vinod Koul, Neil Armstrong,
linux-phy
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.
Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:
req->rate = divider_round_rate(...)
This is invalid in the case when an error occurs since it can set the
rate to a negative value.
Fixes: 27287e3b52b5 ("phy: ti: phy-j721e-wiz: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
To: Vinod Koul <vkoul@kernel.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: linux-phy@lists.infradead.org
---
drivers/phy/ti/phy-j721e-wiz.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index 12a19bf2875c601c60ff5559e1554274ee215918..6e9ecb88dc8b7842745486ae8ad57f82563d6711 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -940,10 +940,7 @@ static int wiz_clk_div_determine_rate(struct clk_hw *hw,
{
struct wiz_clk_divider *div = to_wiz_clk_div(hw);
- req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
- div->table, 2, 0x0);
-
- return 0;
+ return divider_determine_rate(hw, req, div->table, 2, 0x0);
}
static int wiz_clk_div_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 26/27] clk: divider: remove divider_ro_round_rate_parent()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (24 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 25/27] phy: ti: phy-j721e-wiz: " Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-08 21:16 ` [PATCH 27/27] clk: divider: remove divider_round_rate() and divider_round_rate_parent() Brian Masney
` (4 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, linux-kernel, Brian Masney
There are no remaining users of divider_ro_round_rate_parent(), so let's
go ahead and remove it.
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
drivers/clk/clk-divider.c | 22 ----------------------
include/linux/clk-provider.h | 15 ---------------
2 files changed, 37 deletions(-)
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index 2601b6155afb7391c6a0ffb91c58fa66cde98197..7e414017afa12c3838634ec030f960d8aa028b99 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -409,28 +409,6 @@ long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
}
EXPORT_SYMBOL_GPL(divider_round_rate_parent);
-long divider_ro_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
- unsigned long rate, unsigned long *prate,
- const struct clk_div_table *table, u8 width,
- unsigned long flags, unsigned int val)
-{
- struct clk_rate_request req;
- int ret;
-
- clk_hw_init_rate_request(hw, &req, rate);
- req.best_parent_rate = *prate;
- req.best_parent_hw = parent;
-
- ret = divider_ro_determine_rate(hw, &req, table, width, flags, val);
- if (ret)
- return ret;
-
- *prate = req.best_parent_rate;
-
- return req.rate;
-}
-EXPORT_SYMBOL_GPL(divider_ro_round_rate_parent);
-
static int clk_divider_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 630705a47129453c241f1b1755f2c2f2a7ed8f77..000f4063e0d10e6772f6d2af7feb0de7741e7255 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -743,10 +743,6 @@ long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
unsigned long rate, unsigned long *prate,
const struct clk_div_table *table,
u8 width, unsigned long flags);
-long divider_ro_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
- unsigned long rate, unsigned long *prate,
- const struct clk_div_table *table, u8 width,
- unsigned long flags, unsigned int val);
int divider_determine_rate(struct clk_hw *hw, struct clk_rate_request *req,
const struct clk_div_table *table, u8 width,
unsigned long flags);
@@ -1446,17 +1442,6 @@ static inline long divider_round_rate(struct clk_hw *hw, unsigned long rate,
rate, prate, table, width, flags);
}
-static inline long divider_ro_round_rate(struct clk_hw *hw, unsigned long rate,
- unsigned long *prate,
- const struct clk_div_table *table,
- u8 width, unsigned long flags,
- unsigned int val)
-{
- return divider_ro_round_rate_parent(hw, clk_hw_get_parent(hw),
- rate, prate, table, width, flags,
- val);
-}
-
/*
* FIXME clock api without lock protection
*/
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 27/27] clk: divider: remove divider_round_rate() and divider_round_rate_parent()
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (25 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 26/27] clk: divider: remove divider_ro_round_rate_parent() Brian Masney
@ 2026-01-08 21:16 ` Brian Masney
2026-01-10 19:11 ` (subset) [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Bjorn Andersson
` (3 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-08 21:16 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, linux-kernel, Brian Masney
There are no remaining users of divider_round_rate() and
divider_round_rate_parent(), so let's go ahead and remove them.
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
drivers/clk/clk-divider.c | 22 ----------------------
include/linux/clk-provider.h | 13 -------------
2 files changed, 35 deletions(-)
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index 7e414017afa12c3838634ec030f960d8aa028b99..8439784ba08572dcd970d5d4ce3857c6c145763e 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -387,28 +387,6 @@ int divider_ro_determine_rate(struct clk_hw *hw, struct clk_rate_request *req,
}
EXPORT_SYMBOL_GPL(divider_ro_determine_rate);
-long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
- unsigned long rate, unsigned long *prate,
- const struct clk_div_table *table,
- u8 width, unsigned long flags)
-{
- struct clk_rate_request req;
- int ret;
-
- clk_hw_init_rate_request(hw, &req, rate);
- req.best_parent_rate = *prate;
- req.best_parent_hw = parent;
-
- ret = divider_determine_rate(hw, &req, table, width, flags);
- if (ret)
- return ret;
-
- *prate = req.best_parent_rate;
-
- return req.rate;
-}
-EXPORT_SYMBOL_GPL(divider_round_rate_parent);
-
static int clk_divider_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 000f4063e0d10e6772f6d2af7feb0de7741e7255..85f456be5f12ec46e86e5819643fed3fe3790fcb 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -739,10 +739,6 @@ extern const struct clk_ops clk_divider_ro_ops;
unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate,
unsigned int val, const struct clk_div_table *table,
unsigned long flags, unsigned long width);
-long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
- unsigned long rate, unsigned long *prate,
- const struct clk_div_table *table,
- u8 width, unsigned long flags);
int divider_determine_rate(struct clk_hw *hw, struct clk_rate_request *req,
const struct clk_div_table *table, u8 width,
unsigned long flags);
@@ -1433,15 +1429,6 @@ static inline void __clk_hw_set_clk(struct clk_hw *dst, struct clk_hw *src)
dst->core = src->core;
}
-static inline long divider_round_rate(struct clk_hw *hw, unsigned long rate,
- unsigned long *prate,
- const struct clk_div_table *table,
- u8 width, unsigned long flags)
-{
- return divider_round_rate_parent(hw, clk_hw_get_parent(hw),
- rate, prate, table, width, flags);
-}
-
/*
* FIXME clock api without lock protection
*/
--
2.52.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* Re: [PATCH 13/27] clk: nxp: lpc32xx: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 13/27] clk: nxp: lpc32xx: " Brian Masney
@ 2026-01-09 8:10 ` Vladimir Zapolskiy
0 siblings, 0 replies; 56+ messages in thread
From: Vladimir Zapolskiy @ 2026-01-09 8:10 UTC (permalink / raw)
To: Brian Masney, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Piotr Wojtaszczyk, linux-arm-kernel
On 1/8/26 23:16, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: 0879768df240 ("clk: nxp: lpc32xx: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
>
> ---
> To: Vladimir Zapolskiy <vz@mleia.com>
> To: Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>
> Cc: linux-arm-kernel@lists.infradead.org
> ---
> drivers/clk/nxp/clk-lpc32xx.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/nxp/clk-lpc32xx.c b/drivers/clk/nxp/clk-lpc32xx.c
> index 23f980cf6a2b59ee1c93a2519fe5188d251fa12f..ae2fa5341a2e4fbe5f2d3ef9a6cf9e9d75180d59 100644
> --- a/drivers/clk/nxp/clk-lpc32xx.c
> +++ b/drivers/clk/nxp/clk-lpc32xx.c
> @@ -975,10 +975,8 @@ static int clk_divider_determine_rate(struct clk_hw *hw,
> return 0;
> }
>
> - req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
> - divider->table, divider->width, divider->flags);
> -
> - return 0;
> + return divider_determine_rate(hw, req, divider->table, divider->width,
> + divider->flags);
> }
>
> static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
>
Tested-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
--
Best wishes,
Vladimir
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 14/27] clk: qcom: alpha-pll: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 14/27] clk: qcom: alpha-pll: " Brian Masney
@ 2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:28 ` Abel Vesa
1 sibling, 0 replies; 56+ messages in thread
From: Konrad Dybcio @ 2026-01-09 9:12 UTC (permalink / raw)
To: Brian Masney, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Bjorn Andersson, linux-arm-msm
On 1/8/26 10:16 PM, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: 0e56e3369b60 ("clk: qcom: alpha-pll: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 15/27] clk: qcom: regmap-divider: convert from divider_ro_round_rate() to divider_ro_determine_rate()
2026-01-08 21:16 ` [PATCH 15/27] clk: qcom: regmap-divider: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
@ 2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:28 ` Abel Vesa
1 sibling, 0 replies; 56+ messages in thread
From: Konrad Dybcio @ 2026-01-09 9:12 UTC (permalink / raw)
To: Brian Masney, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Bjorn Andersson, linux-arm-msm
On 1/8/26 10:16 PM, Brian Masney wrote:
> The divider_ro_round_rate() function is now deprecated, so let's migrate
> to divider_ro_determine_rate() instead so that this deprecated API can
> be removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: 859a7e020b23 ("clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 16/27] clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 16/27] clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate() Brian Masney
@ 2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:29 ` Abel Vesa
1 sibling, 0 replies; 56+ messages in thread
From: Konrad Dybcio @ 2026-01-09 9:12 UTC (permalink / raw)
To: Brian Masney, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Bjorn Andersson, linux-arm-msm
On 1/8/26 10:16 PM, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: b6f90511c165 ("clk: qcom: regmap-divider: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 24/27] drm/msm/dsi_phy_14nm: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 24/27] drm/msm/dsi_phy_14nm: " Brian Masney
@ 2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:29 ` Abel Vesa
1 sibling, 0 replies; 56+ messages in thread
From: Konrad Dybcio @ 2026-01-09 9:12 UTC (permalink / raw)
To: Brian Masney, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Rob Clark, Dmitry Baryshkov,
David Airlie, Simona Vetter, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, linux-arm-msm, dri-devel, freedreno
On 1/8/26 10:16 PM, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: cc41f29a6b04 ("drm/msm/dsi_phy_14nm: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 14/27] clk: qcom: alpha-pll: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 14/27] clk: qcom: alpha-pll: " Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
@ 2026-01-09 9:28 ` Abel Vesa
1 sibling, 0 replies; 56+ messages in thread
From: Abel Vesa @ 2026-01-09 9:28 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Bjorn Andersson, linux-arm-msm
On 26-01-08 16:16:32, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: 0e56e3369b60 ("clk: qcom: alpha-pll: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 15/27] clk: qcom: regmap-divider: convert from divider_ro_round_rate() to divider_ro_determine_rate()
2026-01-08 21:16 ` [PATCH 15/27] clk: qcom: regmap-divider: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
@ 2026-01-09 9:28 ` Abel Vesa
1 sibling, 0 replies; 56+ messages in thread
From: Abel Vesa @ 2026-01-09 9:28 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Bjorn Andersson, linux-arm-msm
On 26-01-08 16:16:33, Brian Masney wrote:
> The divider_ro_round_rate() function is now deprecated, so let's migrate
> to divider_ro_determine_rate() instead so that this deprecated API can
> be removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: 859a7e020b23 ("clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 16/27] clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 16/27] clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate() Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
@ 2026-01-09 9:29 ` Abel Vesa
1 sibling, 0 replies; 56+ messages in thread
From: Abel Vesa @ 2026-01-09 9:29 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Bjorn Andersson, linux-arm-msm
On 26-01-08 16:16:34, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: b6f90511c165 ("clk: qcom: regmap-divider: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 24/27] drm/msm/dsi_phy_14nm: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 24/27] drm/msm/dsi_phy_14nm: " Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
@ 2026-01-09 9:29 ` Abel Vesa
1 sibling, 0 replies; 56+ messages in thread
From: Abel Vesa @ 2026-01-09 9:29 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Rob Clark, Dmitry Baryshkov, David Airlie, Simona Vetter,
Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
linux-arm-msm, dri-devel, freedreno
On 26-01-08 16:16:42, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: cc41f29a6b04 ("drm/msm/dsi_phy_14nm: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: (subset) [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (26 preceding siblings ...)
2026-01-08 21:16 ` [PATCH 27/27] clk: divider: remove divider_round_rate() and divider_round_rate_parent() Brian Masney
@ 2026-01-10 19:11 ` Bjorn Andersson
2026-01-15 21:05 ` Dmitry Baryshkov
` (2 subsequent siblings)
30 siblings, 0 replies; 56+ messages in thread
From: Bjorn Andersson @ 2026-01-10 19:11 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Brian Masney
Cc: linux-clk, linux-kernel, Chen Wang, Inochi Amaoto, sophgo,
Chen-Yu Tsai, Maxime Ripard, Jernej Skrabec, Samuel Holland,
linux-arm-kernel, linux-sunxi, Alexandre Belloni, linux-rtc,
Andreas Färber, Manivannan Sadhasivam, linux-actions,
Keguang Zhang, linux-mips, Taichi Sugaya, Takao Orito,
Jacky Huang, Shan-Chun Hung, Vladimir Zapolskiy,
Piotr Wojtaszczyk, linux-arm-msm, Orson Zhai, Baolin Wang,
Chunyan Zhang, Maxime Coquelin, Alexandre Torgue, linux-stm32,
Michal Simek, Rob Clark, Dmitry Baryshkov, David Airlie,
Simona Vetter, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, dri-devel, freedreno, Vinod Koul, Neil Armstrong,
linux-phy
On Thu, 08 Jan 2026 16:16:18 -0500, Brian Masney wrote:
> Here's a series that gets rid of the deprecated APIs
> divider_round_rate(), divider_round_rate_parent(), and
> divider_ro_round_rate_parent() since these functions are just wrappers
> for the determine_rate variant.
>
> Note that when I converted some of these drivers from round_rate to
> determine_rate, this was mistakenly converted to the following in some
> cases:
>
> [...]
Applied, thanks!
[14/27] clk: qcom: alpha-pll: convert from divider_round_rate() to divider_determine_rate()
commit: e1f08613e113f02a3ec18c9a7964de97f940acbf
[15/27] clk: qcom: regmap-divider: convert from divider_ro_round_rate() to divider_ro_determine_rate()
commit: 35a48f41b63f67c490f3a2a89b042536be67cf0f
[16/27] clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate()
commit: b2f36d675e09299d9aee395c6f83d8a95d4c9441
Best regards,
--
Bjorn Andersson <andersson@kernel.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/27] clk: sunxi-ng: convert from divider_round_rate_parent() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 02/27] clk: sunxi-ng: convert from divider_round_rate_parent() " Brian Masney
@ 2026-01-11 5:48 ` Chen-Yu Tsai
0 siblings, 0 replies; 56+ messages in thread
From: Chen-Yu Tsai @ 2026-01-11 5:48 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Maxime Ripard, Jernej Skrabec, Samuel Holland, linux-arm-kernel,
linux-sunxi
On Fri, Jan 9, 2026 at 5:17 AM Brian Masney <bmasney@redhat.com> wrote:
>
> The divider_round_rate_parent() function is now deprecated, so let's
> migrate to divider_determine_rate() instead so that this deprecated API
> can be removed. Also go ahead and convert all of the driver from round
> rate type to determine rate that accepts a 'struct clk_rate_request' to
> simplify the overall driver code.
>
> Signed-off-by: Brian Masney <bmasney@redhat.com>
Acked-by: Chen-Yu Tsai <wens@kernel.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 17/27] clk: sophgo: sg2042-clkgen: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 17/27] clk: sophgo: sg2042-clkgen: " Brian Masney
@ 2026-01-12 2:57 ` Chen Wang
2026-01-12 17:27 ` Brian Masney
0 siblings, 1 reply; 56+ messages in thread
From: Chen Wang @ 2026-01-12 2:57 UTC (permalink / raw)
To: Brian Masney, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Inochi Amaoto, sophgo
On 1/9/2026 5:16 AM, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Note that this commit also removes a debugging message that's not really
> needed.
>
> Fixes: 9a3b6993613d ("clk: sophgo: sg2042-clkgen: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
>
> ---
> To: Chen Wang <unicorn_wang@outlook.com>
> To: Inochi Amaoto <inochiama@gmail.com>
> Cc: sophgo@lists.linux.dev
> ---
> drivers/clk/sophgo/clk-sg2042-clkgen.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/clk/sophgo/clk-sg2042-clkgen.c b/drivers/clk/sophgo/clk-sg2042-clkgen.c
> index 683661b71787c9e5428b168502f6fbb30ea9f7da..9725ac4e050a4e6afd3fd50241fbd2fc105a31ca 100644
> --- a/drivers/clk/sophgo/clk-sg2042-clkgen.c
> +++ b/drivers/clk/sophgo/clk-sg2042-clkgen.c
> @@ -180,7 +180,6 @@ static int sg2042_clk_divider_determine_rate(struct clk_hw *hw,
> struct clk_rate_request *req)
> {
> struct sg2042_divider_clock *divider = to_sg2042_clk_divider(hw);
> - unsigned long ret_rate;
> u32 bestdiv;
>
> /* if read only, just return current value */
> @@ -191,17 +190,13 @@ static int sg2042_clk_divider_determine_rate(struct clk_hw *hw,
> bestdiv = readl(divider->reg) >> divider->shift;
> bestdiv &= clk_div_mask(divider->width);
> }
> - ret_rate = DIV_ROUND_UP_ULL((u64)req->best_parent_rate, bestdiv);
> - } else {
> - ret_rate = divider_round_rate(hw, req->rate, &req->best_parent_rate, NULL,
> - divider->width, divider->div_flags);
> - }
> + req->rate = DIV_ROUND_UP_ULL((u64)req->best_parent_rate, bestdiv);
>
> - pr_debug("--> %s: divider_round_rate: val = %ld\n",
> - clk_hw_get_name(hw), ret_rate);
> - req->rate = ret_rate;
> + return 0;
> + }
>
> - return 0;
> + return divider_determine_rate(hw, req, NULL, divider->width,
> + divider->div_flags);
> }
>
> static int sg2042_clk_divider_set_rate(struct clk_hw *hw,
Tested-by: Chen Wang <unicorn_wang@outlook.com>
Reviewed-by: Chen Wang <unicorn_wang@outlook.com>
BTW: I have a question about the base-commit on which your patch series
is based. Could you please tell me where I can find this base-commit?
I'm asking this because I found that for the changes in [25/27]
phy-j721e-wiz, if I'm based on the latest upstream master, I can't
successfully apply this patch.
So, in my testing, I'm based on 6.19-rc1 and haven't picked [25/27].
Thanks,
Chen
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 17/27] clk: sophgo: sg2042-clkgen: convert from divider_round_rate() to divider_determine_rate()
2026-01-12 2:57 ` Chen Wang
@ 2026-01-12 17:27 ` Brian Masney
0 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-12 17:27 UTC (permalink / raw)
To: Chen Wang
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Inochi Amaoto, sophgo
Hi Chen,
On Mon, Jan 12, 2026 at 10:57:17AM +0800, Chen Wang wrote:
>
> On 1/9/2026 5:16 AM, Brian Masney wrote:
> > The divider_round_rate() function is now deprecated, so let's migrate
> > to divider_determine_rate() instead so that this deprecated API can be
> > removed.
> >
> > Note that when the main function itself was migrated to use
> > determine_rate, this was mistakenly converted to:
> >
> > req->rate = divider_round_rate(...)
> >
> > This is invalid in the case when an error occurs since it can set the
> > rate to a negative value.
> >
> > Note that this commit also removes a debugging message that's not really
> > needed.
> >
> > Fixes: 9a3b6993613d ("clk: sophgo: sg2042-clkgen: convert from round_rate() to determine_rate()")
> > Signed-off-by: Brian Masney <bmasney@redhat.com>
> >
> > ---
> > To: Chen Wang <unicorn_wang@outlook.com>
> > To: Inochi Amaoto <inochiama@gmail.com>
> > Cc: sophgo@lists.linux.dev
> > ---
> > drivers/clk/sophgo/clk-sg2042-clkgen.c | 15 +++++----------
> > 1 file changed, 5 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/clk/sophgo/clk-sg2042-clkgen.c b/drivers/clk/sophgo/clk-sg2042-clkgen.c
> > index 683661b71787c9e5428b168502f6fbb30ea9f7da..9725ac4e050a4e6afd3fd50241fbd2fc105a31ca 100644
> > --- a/drivers/clk/sophgo/clk-sg2042-clkgen.c
> > +++ b/drivers/clk/sophgo/clk-sg2042-clkgen.c
> > @@ -180,7 +180,6 @@ static int sg2042_clk_divider_determine_rate(struct clk_hw *hw,
> > struct clk_rate_request *req)
> > {
> > struct sg2042_divider_clock *divider = to_sg2042_clk_divider(hw);
> > - unsigned long ret_rate;
> > u32 bestdiv;
> > /* if read only, just return current value */
> > @@ -191,17 +190,13 @@ static int sg2042_clk_divider_determine_rate(struct clk_hw *hw,
> > bestdiv = readl(divider->reg) >> divider->shift;
> > bestdiv &= clk_div_mask(divider->width);
> > }
> > - ret_rate = DIV_ROUND_UP_ULL((u64)req->best_parent_rate, bestdiv);
> > - } else {
> > - ret_rate = divider_round_rate(hw, req->rate, &req->best_parent_rate, NULL,
> > - divider->width, divider->div_flags);
> > - }
> > + req->rate = DIV_ROUND_UP_ULL((u64)req->best_parent_rate, bestdiv);
> > - pr_debug("--> %s: divider_round_rate: val = %ld\n",
> > - clk_hw_get_name(hw), ret_rate);
> > - req->rate = ret_rate;
> > + return 0;
> > + }
> > - return 0;
> > + return divider_determine_rate(hw, req, NULL, divider->width,
> > + divider->div_flags);
> > }
> > static int sg2042_clk_divider_set_rate(struct clk_hw *hw,
> Tested-by: Chen Wang <unicorn_wang@outlook.com>
>
> Reviewed-by: Chen Wang <unicorn_wang@outlook.com>
>
> BTW: I have a question about the base-commit on which your patch series is
> based. Could you please tell me where I can find this base-commit? I'm
> asking this because I found that for the changes in [25/27] phy-j721e-wiz,
> if I'm based on the latest upstream master, I can't successfully apply this
> patch.
>
> So, in my testing, I'm based on 6.19-rc1 and haven't picked [25/27].
My branch is based on linux-next-20260105. I verified that this series
also applies to linux-next-20260109. The TI patch depends on patch 9
from this series that's in linux-next:
https://lore.kernel.org/linux-phy/176656156358.817806.16966474957670370356.b4-ty@kernel.org/
Brian
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 09/27] clk: loongson1: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 09/27] clk: loongson1: " Brian Masney
@ 2026-01-13 6:28 ` Keguang Zhang
0 siblings, 0 replies; 56+ messages in thread
From: Keguang Zhang @ 2026-01-13 6:28 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
linux-mips
Reviewed-by: Keguang Zhang <keguang.zhang@gmail.com>
Tested-by: Keguang Zhang <keguang.zhang@gmail.com> # on LS1B & LS1C
On Fri, Jan 9, 2026 at 5:17 AM Brian Masney <bmasney@redhat.com> wrote:
>
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: bb40a2ef4fc9 ("clk: loongson1: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
>
> ---
> To: Keguang Zhang <keguang.zhang@gmail.com>
> Cc: linux-mips@vger.kernel.org
> ---
> drivers/clk/clk-loongson1.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/clk/clk-loongson1.c b/drivers/clk/clk-loongson1.c
> index f9f060d08a5fae3291a9408c6dc93531b435609f..1674181a1107dc4f30e78ee410a55a49b6d0b4b5 100644
> --- a/drivers/clk/clk-loongson1.c
> +++ b/drivers/clk/clk-loongson1.c
> @@ -99,10 +99,7 @@ static int ls1x_divider_determine_rate(struct clk_hw *hw,
> struct ls1x_clk *ls1x_clk = to_ls1x_clk(hw);
> const struct ls1x_clk_div_data *d = ls1x_clk->data;
>
> - req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
> - d->table, d->width, d->flags);
> -
> - return 0;
> + return divider_determine_rate(hw, req, d->table, d->width, d->flags);
> }
>
> static int ls1x_divider_set_rate(struct clk_hw *hw, unsigned long rate,
>
> --
> 2.52.0
>
--
Best regards,
Keguang Zhang
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 25/27] phy: ti: phy-j721e-wiz: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 25/27] phy: ti: phy-j721e-wiz: " Brian Masney
@ 2026-01-14 14:17 ` Vinod Koul
2026-01-15 14:18 ` Brian Masney
0 siblings, 1 reply; 56+ messages in thread
From: Vinod Koul @ 2026-01-14 14:17 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Neil Armstrong, linux-phy
On 08-01-26, 16:16, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
Acked-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 25/27] phy: ti: phy-j721e-wiz: convert from divider_round_rate() to divider_determine_rate()
2026-01-14 14:17 ` Vinod Koul
@ 2026-01-15 14:18 ` Brian Masney
2026-01-21 7:56 ` Vinod Koul
0 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-15 14:18 UTC (permalink / raw)
To: Vinod Koul
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Neil Armstrong, linux-phy
Hi Vinod,
On Wed, Jan 14, 2026 at 07:47:18PM +0530, Vinod Koul wrote:
> On 08-01-26, 16:16, Brian Masney wrote:
> > The divider_round_rate() function is now deprecated, so let's migrate
> > to divider_determine_rate() instead so that this deprecated API can be
> > removed.
> >
> > Note that when the main function itself was migrated to use
> > determine_rate, this was mistakenly converted to:
> >
> > req->rate = divider_round_rate(...)
> >
> > This is invalid in the case when an error occurs since it can set the
> > rate to a negative value.
>
> Acked-by: Vinod Koul <vkoul@kernel.org>
Thanks for the Acked-by.
However, this patch depends on this other series of mine that's merged
into your phy tree:
https://lore.kernel.org/linux-clk/176661322399.4169.14248756511703978007@lazor/
Stephen asked for an Acked-by for that series or an immutable branch.
This will allow us to remove round_rate from the clk core.
I also have a small series to post that's dependent on all of this that
lets us get rid of the noop determine_rate implementations that only
'return 0'. I haven't posted that because of the dependencies.
Brian
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (27 preceding siblings ...)
2026-01-10 19:11 ` (subset) [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Bjorn Andersson
@ 2026-01-15 21:05 ` Dmitry Baryshkov
2026-01-21 22:53 ` Brian Masney
2026-02-04 15:44 ` (subset) " Vinod Koul
30 siblings, 0 replies; 56+ messages in thread
From: Dmitry Baryshkov @ 2026-01-15 21:05 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Brian Masney
Cc: linux-clk, linux-kernel, Chen Wang, Inochi Amaoto, sophgo,
Chen-Yu Tsai, Maxime Ripard, Jernej Skrabec, Samuel Holland,
linux-arm-kernel, linux-sunxi, Alexandre Belloni, linux-rtc,
Andreas Färber, Manivannan Sadhasivam, linux-actions,
Keguang Zhang, linux-mips, Taichi Sugaya, Takao Orito,
Jacky Huang, Shan-Chun Hung, Vladimir Zapolskiy,
Piotr Wojtaszczyk, Bjorn Andersson, linux-arm-msm, Orson Zhai,
Baolin Wang, Chunyan Zhang, Maxime Coquelin, Alexandre Torgue,
linux-stm32, Michal Simek, Rob Clark, Dmitry Baryshkov,
David Airlie, Simona Vetter, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, dri-devel, freedreno, Vinod Koul,
Neil Armstrong, linux-phy
On Thu, 08 Jan 2026 16:16:18 -0500, Brian Masney wrote:
> Here's a series that gets rid of the deprecated APIs
> divider_round_rate(), divider_round_rate_parent(), and
> divider_ro_round_rate_parent() since these functions are just wrappers
> for the determine_rate variant.
>
> Note that when I converted some of these drivers from round_rate to
> determine_rate, this was mistakenly converted to the following in some
> cases:
>
> [...]
Applied to msm-next, thanks!
[24/27] drm/msm/dsi_phy_14nm: convert from divider_round_rate() to divider_determine_rate()
https://gitlab.freedesktop.org/lumag/msm/-/commit/1d232f793d4d
Best regards,
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 06/27] clk: bm1880: convert from divider_ro_round_rate() to divider_ro_determine_rate()
2026-01-08 21:16 ` [PATCH 06/27] clk: bm1880: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
@ 2026-01-16 5:23 ` Manivannan Sadhasivam
0 siblings, 0 replies; 56+ messages in thread
From: Manivannan Sadhasivam @ 2026-01-16 5:23 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
linux-arm-kernel
On Thu, Jan 08, 2026 at 04:16:24PM -0500, Brian Masney wrote:
> The divider_ro_round_rate() function is now deprecated, so let's migrate
> to divider_ro_determine_rate() instead so that this deprecated API can
> be removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: cf1d95fa0c64 ("clk: bm1880: convert from divider_round_rate() to divider_determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
- Mani
>
> ---
> To: Manivannan Sadhasivam <mani@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> ---
> drivers/clk/clk-bm1880.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clk/clk-bm1880.c b/drivers/clk/clk-bm1880.c
> index dac190bc6e19a6dd4be413ea52d41f74934a1aa9..536df8e828eab83fbd3812135139c703aa7a1ce3 100644
> --- a/drivers/clk/clk-bm1880.c
> +++ b/drivers/clk/clk-bm1880.c
> @@ -621,12 +621,8 @@ static int bm1880_clk_div_determine_rate(struct clk_hw *hw,
> val = readl(reg_addr) >> div->shift;
> val &= clk_div_mask(div->width);
>
> - req->rate = divider_ro_round_rate(hw, req->rate,
> - &req->best_parent_rate,
> - div->table,
> - div->width, div->flags, val);
> -
> - return 0;
> + return divider_ro_determine_rate(hw, req, div->table,
> + div->width, div->flags, val);
> }
>
> req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
>
> --
> 2.52.0
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 07/27] clk: bm1880: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 07/27] clk: bm1880: convert from divider_round_rate() to divider_determine_rate() Brian Masney
@ 2026-01-16 5:24 ` Manivannan Sadhasivam
0 siblings, 0 replies; 56+ messages in thread
From: Manivannan Sadhasivam @ 2026-01-16 5:24 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
linux-arm-kernel
On Thu, Jan 08, 2026 at 04:16:25PM -0500, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: 64613d7fb42f ("clk: bm1880: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
- Mani
>
> ---
> To: Manivannan Sadhasivam <mani@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> ---
> drivers/clk/clk-bm1880.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/clk/clk-bm1880.c b/drivers/clk/clk-bm1880.c
> index 536df8e828eab83fbd3812135139c703aa7a1ce3..1bdceb36fa87e8250c10a7fc0791379e1533bb38 100644
> --- a/drivers/clk/clk-bm1880.c
> +++ b/drivers/clk/clk-bm1880.c
> @@ -625,10 +625,7 @@ static int bm1880_clk_div_determine_rate(struct clk_hw *hw,
> div->width, div->flags, val);
> }
>
> - req->rate = divider_round_rate(hw, req->rate, &req->best_parent_rate,
> - div->table, div->width, div->flags);
> -
> - return 0;
> + return divider_determine_rate(hw, req, div->table, div->width, div->flags);
> }
>
> static int bm1880_clk_div_set_rate(struct clk_hw *hw, unsigned long rate,
>
> --
> 2.52.0
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 05/27] clk: actions: owl-divider: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 05/27] clk: actions: owl-divider: convert from divider_round_rate() " Brian Masney
@ 2026-01-16 5:26 ` Manivannan Sadhasivam
0 siblings, 0 replies; 56+ messages in thread
From: Manivannan Sadhasivam @ 2026-01-16 5:26 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Andreas Färber, linux-arm-kernel, linux-actions
On Thu, Jan 08, 2026 at 04:16:23PM -0500, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed. Additionally, owl_divider_helper_round_rate() is no longer used,
> so let's drop that from the header file as well.
>
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
>
> req->rate = divider_round_rate(...)
>
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
>
> Fixes: 1b04e12a8bcc ("clk: actions: owl-divider: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
- Mani
>
> ---
> To: "Andreas Färber" <afaerber@suse.de>
> To: Manivannan Sadhasivam <mani@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-actions@lists.infradead.org
> ---
> drivers/clk/actions/owl-divider.c | 17 ++---------------
> drivers/clk/actions/owl-divider.h | 5 -----
> 2 files changed, 2 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/clk/actions/owl-divider.c b/drivers/clk/actions/owl-divider.c
> index 118f1393c6780f287d26736b2547a8b43751655a..316ace80e87e3b1c22a4011e725644cf37668e5e 100644
> --- a/drivers/clk/actions/owl-divider.c
> +++ b/drivers/clk/actions/owl-divider.c
> @@ -13,26 +13,13 @@
>
> #include "owl-divider.h"
>
> -long owl_divider_helper_round_rate(struct owl_clk_common *common,
> - const struct owl_divider_hw *div_hw,
> - unsigned long rate,
> - unsigned long *parent_rate)
> -{
> - return divider_round_rate(&common->hw, rate, parent_rate,
> - div_hw->table, div_hw->width,
> - div_hw->div_flags);
> -}
> -
> static int owl_divider_determine_rate(struct clk_hw *hw,
> struct clk_rate_request *req)
> {
> struct owl_divider *div = hw_to_owl_divider(hw);
>
> - req->rate = owl_divider_helper_round_rate(&div->common, &div->div_hw,
> - req->rate,
> - &req->best_parent_rate);
> -
> - return 0;
> + return divider_determine_rate(hw, req, div->div_hw.table,
> + div->div_hw.width, div->div_hw.div_flags);
> }
>
> unsigned long owl_divider_helper_recalc_rate(struct owl_clk_common *common,
> diff --git a/drivers/clk/actions/owl-divider.h b/drivers/clk/actions/owl-divider.h
> index d76f58782c52885a66c96e8bf13b0dea3ba51efd..1d3bb4e5898a3ccf729894533ae194ac4c34b6e3 100644
> --- a/drivers/clk/actions/owl-divider.h
> +++ b/drivers/clk/actions/owl-divider.h
> @@ -56,11 +56,6 @@ static inline struct owl_divider *hw_to_owl_divider(struct clk_hw *hw)
> return container_of(common, struct owl_divider, common);
> }
>
> -long owl_divider_helper_round_rate(struct owl_clk_common *common,
> - const struct owl_divider_hw *div_hw,
> - unsigned long rate,
> - unsigned long *parent_rate);
> -
> unsigned long owl_divider_helper_recalc_rate(struct owl_clk_common *common,
> const struct owl_divider_hw *div_hw,
> unsigned long parent_rate);
>
> --
> 2.52.0
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 04/27] clk: actions: owl-composite: convert from owl_divider_helper_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 04/27] clk: actions: owl-composite: convert from owl_divider_helper_round_rate() " Brian Masney
@ 2026-01-16 5:27 ` Manivannan Sadhasivam
0 siblings, 0 replies; 56+ messages in thread
From: Manivannan Sadhasivam @ 2026-01-16 5:27 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Andreas Färber, linux-arm-kernel, linux-actions
On Thu, Jan 08, 2026 at 04:16:22PM -0500, Brian Masney wrote:
> owl_divider_helper_round_rate() is just a wrapper for
> divider_round_rate(), which is deprecated. Let's migrate to
> divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Signed-off-by: Brian Masney <bmasney@redhat.com>
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
- Mani
>
> ---
> To: "Andreas Färber" <afaerber@suse.de>
> To: Manivannan Sadhasivam <mani@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-actions@lists.infradead.org
> ---
> drivers/clk/actions/owl-composite.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
> index 00b74f8bc4375a8f42e9b54c7bf1affe91e1074a..9540444307d6c960af200ec13e7c60abd47ffc85 100644
> --- a/drivers/clk/actions/owl-composite.c
> +++ b/drivers/clk/actions/owl-composite.c
> @@ -57,15 +57,10 @@ static int owl_comp_div_determine_rate(struct clk_hw *hw,
> struct clk_rate_request *req)
> {
> struct owl_composite *comp = hw_to_owl_comp(hw);
> - long rate;
> -
> - rate = owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw,
> - req->rate, &req->best_parent_rate);
> - if (rate < 0)
> - return rate;
> + struct owl_divider_hw *div = &comp->rate.div_hw;
>
> - req->rate = rate;
> - return 0;
> + return divider_determine_rate(&comp->common.hw, req, div->table,
> + div->width, div->div_flags);
> }
>
> static unsigned long owl_comp_div_recalc_rate(struct clk_hw *hw,
>
> --
> 2.52.0
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 25/27] phy: ti: phy-j721e-wiz: convert from divider_round_rate() to divider_determine_rate()
2026-01-15 14:18 ` Brian Masney
@ 2026-01-21 7:56 ` Vinod Koul
2026-01-21 12:13 ` Brian Masney
0 siblings, 1 reply; 56+ messages in thread
From: Vinod Koul @ 2026-01-21 7:56 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Neil Armstrong, linux-phy
On 15-01-26, 09:18, Brian Masney wrote:
> Hi Vinod,
>
> On Wed, Jan 14, 2026 at 07:47:18PM +0530, Vinod Koul wrote:
> > On 08-01-26, 16:16, Brian Masney wrote:
> > > The divider_round_rate() function is now deprecated, so let's migrate
> > > to divider_determine_rate() instead so that this deprecated API can be
> > > removed.
> > >
> > > Note that when the main function itself was migrated to use
> > > determine_rate, this was mistakenly converted to:
> > >
> > > req->rate = divider_round_rate(...)
> > >
> > > This is invalid in the case when an error occurs since it can set the
> > > rate to a negative value.
> >
> > Acked-by: Vinod Koul <vkoul@kernel.org>
>
> Thanks for the Acked-by.
>
> However, this patch depends on this other series of mine that's merged
> into your phy tree:
Should I pick this one then..? If there are no other dependencies...
>
> https://lore.kernel.org/linux-clk/176661322399.4169.14248756511703978007@lazor/
>
> Stephen asked for an Acked-by for that series or an immutable branch.
>
> This will allow us to remove round_rate from the clk core.
>
> I also have a small series to post that's dependent on all of this that
> lets us get rid of the noop determine_rate implementations that only
> 'return 0'. I haven't posted that because of the dependencies.
>
> Brian
--
~Vinod
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 25/27] phy: ti: phy-j721e-wiz: convert from divider_round_rate() to divider_determine_rate()
2026-01-21 7:56 ` Vinod Koul
@ 2026-01-21 12:13 ` Brian Masney
0 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-21 12:13 UTC (permalink / raw)
To: Vinod Koul
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
Neil Armstrong, linux-phy
On Wed, Jan 21, 2026 at 01:26:05PM +0530, Vinod Koul wrote:
> On 15-01-26, 09:18, Brian Masney wrote:
> > Hi Vinod,
> >
> > On Wed, Jan 14, 2026 at 07:47:18PM +0530, Vinod Koul wrote:
> > > On 08-01-26, 16:16, Brian Masney wrote:
> > > > The divider_round_rate() function is now deprecated, so let's migrate
> > > > to divider_determine_rate() instead so that this deprecated API can be
> > > > removed.
> > > >
> > > > Note that when the main function itself was migrated to use
> > > > determine_rate, this was mistakenly converted to:
> > > >
> > > > req->rate = divider_round_rate(...)
> > > >
> > > > This is invalid in the case when an error occurs since it can set the
> > > > rate to a negative value.
> > >
> > > Acked-by: Vinod Koul <vkoul@kernel.org>
> >
> > Thanks for the Acked-by.
> >
> > However, this patch depends on this other series of mine that's merged
> > into your phy tree:
>
> Should I pick this one then..? If there are no other dependencies...
Yes, this patch stands on it's own, and it would be great if you could
pick up this patch in your tree this dev cycle.
Thanks,
Brian
> > https://lore.kernel.org/linux-clk/176661322399.4169.14248756511703978007@lazor/
> >
> > Stephen asked for an Acked-by for that series or an immutable branch.
> >
> > This will allow us to remove round_rate from the clk core.
> >
> > I also have a small series to post that's dependent on all of this that
> > lets us get rid of the noop determine_rate implementations that only
> > 'return 0'. I haven't posted that because of the dependencies.
> >
> > Brian
>
> --
> ~Vinod
>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (28 preceding siblings ...)
2026-01-15 21:05 ` Dmitry Baryshkov
@ 2026-01-21 22:53 ` Brian Masney
2026-02-04 15:44 ` (subset) " Vinod Koul
30 siblings, 0 replies; 56+ messages in thread
From: Brian Masney @ 2026-01-21 22:53 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-kernel, Chen Wang, Inochi Amaoto, sophgo,
Chen-Yu Tsai, Maxime Ripard, Jernej Skrabec, Samuel Holland,
linux-arm-kernel, linux-sunxi, Alexandre Belloni, linux-rtc,
Andreas Färber, Manivannan Sadhasivam, linux-actions,
Keguang Zhang, linux-mips, Taichi Sugaya, Takao Orito,
Jacky Huang, Shan-Chun Hung, Vladimir Zapolskiy,
Piotr Wojtaszczyk, Bjorn Andersson, linux-arm-msm, Orson Zhai,
Baolin Wang, Chunyan Zhang, Maxime Coquelin, Alexandre Torgue,
linux-stm32, Michal Simek, Rob Clark, Dmitry Baryshkov,
David Airlie, Simona Vetter, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, dri-devel, freedreno, Vinod Koul,
Neil Armstrong, linux-phy
Hi Stephen,
On Thu, Jan 08, 2026 at 04:16:18PM -0500, Brian Masney wrote:
> Here's a series that gets rid of the deprecated APIs
> divider_round_rate(), divider_round_rate_parent(), and
> divider_ro_round_rate_parent() since these functions are just wrappers
> for the determine_rate variant.
I sent you a GIT PULL for what can go to Linus for the upcoming merge
window from this series:
https://lore.kernel.org/linux-clk/aXFYU324yQ6uBmk0@redhat.com/T/#u
Thanks,
Brian
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 03/27] rtc: ac100: convert from divider_round_rate() to divider_determine_rate()
2026-01-08 21:16 ` [PATCH 03/27] rtc: ac100: convert from divider_round_rate() " Brian Masney
@ 2026-01-22 0:26 ` Alexandre Belloni
2026-01-22 0:48 ` Brian Masney
0 siblings, 1 reply; 56+ messages in thread
From: Alexandre Belloni @ 2026-01-22 0:26 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
linux-rtc
Hello,
On 08/01/2026 16:16:21-0500, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed.
>
> Signed-off-by: Brian Masney <bmasney@redhat.com>
>
> ---
> To: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: linux-rtc@vger.kernel.org
> ---
> drivers/rtc/rtc-ac100.c | 75 +++++++++++++++++++++++++------------------------
> 1 file changed, 38 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ac100.c b/drivers/rtc/rtc-ac100.c
> index 33626311fa781b5ce90dcc472f948dc933bbc897..16aca4431da8c029e6195d8a3c9fe75fa95d0bc0 100644
> --- a/drivers/rtc/rtc-ac100.c
> +++ b/drivers/rtc/rtc-ac100.c
> @@ -140,42 +140,16 @@ static unsigned long ac100_clkout_recalc_rate(struct clk_hw *hw,
> AC100_CLKOUT_DIV_WIDTH);
> }
>
> -static long ac100_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
> - unsigned long prate)
> -{
> - unsigned long best_rate = 0, tmp_rate, tmp_prate;
> - int i;
> -
> - if (prate == AC100_RTC_32K_RATE)
> - return divider_round_rate(hw, rate, &prate, NULL,
> - AC100_CLKOUT_DIV_WIDTH,
> - CLK_DIVIDER_POWER_OF_TWO);
> -
> - for (i = 0; ac100_clkout_prediv[i].div; i++) {
> - tmp_prate = DIV_ROUND_UP(prate, ac100_clkout_prediv[i].val);
> - tmp_rate = divider_round_rate(hw, rate, &tmp_prate, NULL,
> - AC100_CLKOUT_DIV_WIDTH,
> - CLK_DIVIDER_POWER_OF_TWO);
> -
> - if (tmp_rate > rate)
> - continue;
> - if (rate - tmp_rate < best_rate - tmp_rate)
> - best_rate = tmp_rate;
> - }
> -
> - return best_rate;
> -}
> -
> static int ac100_clkout_determine_rate(struct clk_hw *hw,
> struct clk_rate_request *req)
> {
> - struct clk_hw *best_parent;
> + int i, ret, num_parents = clk_hw_get_num_parents(hw);
> + struct clk_hw *best_parent = NULL;
> unsigned long best = 0;
> - int i, num_parents = clk_hw_get_num_parents(hw);
>
> for (i = 0; i < num_parents; i++) {
> struct clk_hw *parent = clk_hw_get_parent_by_index(hw, i);
> - unsigned long tmp, prate;
> + unsigned long prate;
>
> /*
> * The clock has two parents, one is a fixed clock which is
> @@ -199,13 +173,40 @@ static int ac100_clkout_determine_rate(struct clk_hw *hw,
>
> prate = clk_hw_get_rate(parent);
>
> - tmp = ac100_clkout_round_rate(hw, req->rate, prate);
> -
> - if (tmp > req->rate)
> - continue;
> - if (req->rate - tmp < req->rate - best) {
> - best = tmp;
> - best_parent = parent;
> + if (prate == AC100_RTC_32K_RATE) {
> + struct clk_rate_request div_req = *req;
> +
> + div_req.best_parent_rate = prate;
> +
> + ret = divider_determine_rate(hw, &div_req, NULL,
> + AC100_CLKOUT_DIV_WIDTH,
> + CLK_DIVIDER_POWER_OF_TWO);
> + if (ret != 0 || div_req.rate > req->rate)
> + continue;
This leaves a braces inbalance
> + else if (req->rate - div_req.rate < req->rate - best) {
> + best = div_req.rate;
> + best_parent = parent;
> + }
> + } else {
> + int j;
> +
> + for (j = 0; ac100_clkout_prediv[j].div; j++) {
> + struct clk_rate_request div_req = *req;
> + unsigned long tmp_prate;
> +
> + tmp_prate = DIV_ROUND_UP(prate, ac100_clkout_prediv[j].div);
> + div_req.best_parent_rate = tmp_prate;
> +
> + ret = divider_determine_rate(hw, &div_req, NULL,
> + AC100_CLKOUT_DIV_WIDTH,
> + CLK_DIVIDER_POWER_OF_TWO);
> + if (ret != 0 || div_req.rate > req->rate)
> + continue;
Ditto.
> + else if (req->rate - div_req.rate < req->rate - best) {
> + best = div_req.rate;
> + best_parent = parent;
> + }
> + }
> }
> }
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 03/27] rtc: ac100: convert from divider_round_rate() to divider_determine_rate()
2026-01-22 0:26 ` Alexandre Belloni
@ 2026-01-22 0:48 ` Brian Masney
2026-01-22 2:02 ` Alexandre Belloni
0 siblings, 1 reply; 56+ messages in thread
From: Brian Masney @ 2026-01-22 0:48 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
linux-rtc
Hi Alexandre,
On Thu, Jan 22, 2026 at 01:26:09AM +0100, Alexandre Belloni wrote:
> On 08/01/2026 16:16:21-0500, Brian Masney wrote:
> > The divider_round_rate() function is now deprecated, so let's migrate
> > to divider_determine_rate() instead so that this deprecated API can be
> > removed.
> >
> > Signed-off-by: Brian Masney <bmasney@redhat.com>
> >
> > ---
> > To: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > Cc: linux-rtc@vger.kernel.org
> > ---
> > drivers/rtc/rtc-ac100.c | 75 +++++++++++++++++++++++++------------------------
> > 1 file changed, 38 insertions(+), 37 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-ac100.c b/drivers/rtc/rtc-ac100.c
> > index 33626311fa781b5ce90dcc472f948dc933bbc897..16aca4431da8c029e6195d8a3c9fe75fa95d0bc0 100644
> > --- a/drivers/rtc/rtc-ac100.c
> > +++ b/drivers/rtc/rtc-ac100.c
> > @@ -140,42 +140,16 @@ static unsigned long ac100_clkout_recalc_rate(struct clk_hw *hw,
> > AC100_CLKOUT_DIV_WIDTH);
> > }
> >
> > -static long ac100_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
> > - unsigned long prate)
> > -{
> > - unsigned long best_rate = 0, tmp_rate, tmp_prate;
> > - int i;
> > -
> > - if (prate == AC100_RTC_32K_RATE)
> > - return divider_round_rate(hw, rate, &prate, NULL,
> > - AC100_CLKOUT_DIV_WIDTH,
> > - CLK_DIVIDER_POWER_OF_TWO);
> > -
> > - for (i = 0; ac100_clkout_prediv[i].div; i++) {
> > - tmp_prate = DIV_ROUND_UP(prate, ac100_clkout_prediv[i].val);
> > - tmp_rate = divider_round_rate(hw, rate, &tmp_prate, NULL,
> > - AC100_CLKOUT_DIV_WIDTH,
> > - CLK_DIVIDER_POWER_OF_TWO);
> > -
> > - if (tmp_rate > rate)
> > - continue;
> > - if (rate - tmp_rate < best_rate - tmp_rate)
> > - best_rate = tmp_rate;
> > - }
> > -
> > - return best_rate;
> > -}
> > -
> > static int ac100_clkout_determine_rate(struct clk_hw *hw,
> > struct clk_rate_request *req)
> > {
> > - struct clk_hw *best_parent;
> > + int i, ret, num_parents = clk_hw_get_num_parents(hw);
> > + struct clk_hw *best_parent = NULL;
> > unsigned long best = 0;
> > - int i, num_parents = clk_hw_get_num_parents(hw);
> >
> > for (i = 0; i < num_parents; i++) {
> > struct clk_hw *parent = clk_hw_get_parent_by_index(hw, i);
> > - unsigned long tmp, prate;
> > + unsigned long prate;
> >
> > /*
> > * The clock has two parents, one is a fixed clock which is
> > @@ -199,13 +173,40 @@ static int ac100_clkout_determine_rate(struct clk_hw *hw,
> >
> > prate = clk_hw_get_rate(parent);
> >
> > - tmp = ac100_clkout_round_rate(hw, req->rate, prate);
> > -
> > - if (tmp > req->rate)
> > - continue;
> > - if (req->rate - tmp < req->rate - best) {
> > - best = tmp;
> > - best_parent = parent;
> > + if (prate == AC100_RTC_32K_RATE) {
> > + struct clk_rate_request div_req = *req;
> > +
> > + div_req.best_parent_rate = prate;
> > +
> > + ret = divider_determine_rate(hw, &div_req, NULL,
> > + AC100_CLKOUT_DIV_WIDTH,
> > + CLK_DIVIDER_POWER_OF_TWO);
> > + if (ret != 0 || div_req.rate > req->rate)
> > + continue;
>
> This leaves a braces inbalance
To be clear, you also want the braces around the if like this:
if (ret != 0 || div_req.rate > req->rate) {
continue;
} else if (req->rate - div_req.rate < req->rate - best) {
best = div_req.rate;
best_parent = parent;
}
Brian
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 03/27] rtc: ac100: convert from divider_round_rate() to divider_determine_rate()
2026-01-22 0:48 ` Brian Masney
@ 2026-01-22 2:02 ` Alexandre Belloni
0 siblings, 0 replies; 56+ messages in thread
From: Alexandre Belloni @ 2026-01-22 2:02 UTC (permalink / raw)
To: Brian Masney
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel,
linux-rtc
On 21/01/2026 19:48:19-0500, Brian Masney wrote:
> Hi Alexandre,
>
> On Thu, Jan 22, 2026 at 01:26:09AM +0100, Alexandre Belloni wrote:
> > On 08/01/2026 16:16:21-0500, Brian Masney wrote:
> > > The divider_round_rate() function is now deprecated, so let's migrate
> > > to divider_determine_rate() instead so that this deprecated API can be
> > > removed.
> > >
> > > Signed-off-by: Brian Masney <bmasney@redhat.com>
> > >
> > > ---
> > > To: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > > Cc: linux-rtc@vger.kernel.org
> > > ---
> > > drivers/rtc/rtc-ac100.c | 75 +++++++++++++++++++++++++------------------------
> > > 1 file changed, 38 insertions(+), 37 deletions(-)
> > >
> > > diff --git a/drivers/rtc/rtc-ac100.c b/drivers/rtc/rtc-ac100.c
> > > index 33626311fa781b5ce90dcc472f948dc933bbc897..16aca4431da8c029e6195d8a3c9fe75fa95d0bc0 100644
> > > --- a/drivers/rtc/rtc-ac100.c
> > > +++ b/drivers/rtc/rtc-ac100.c
> > > @@ -140,42 +140,16 @@ static unsigned long ac100_clkout_recalc_rate(struct clk_hw *hw,
> > > AC100_CLKOUT_DIV_WIDTH);
> > > }
> > >
> > > -static long ac100_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
> > > - unsigned long prate)
> > > -{
> > > - unsigned long best_rate = 0, tmp_rate, tmp_prate;
> > > - int i;
> > > -
> > > - if (prate == AC100_RTC_32K_RATE)
> > > - return divider_round_rate(hw, rate, &prate, NULL,
> > > - AC100_CLKOUT_DIV_WIDTH,
> > > - CLK_DIVIDER_POWER_OF_TWO);
> > > -
> > > - for (i = 0; ac100_clkout_prediv[i].div; i++) {
> > > - tmp_prate = DIV_ROUND_UP(prate, ac100_clkout_prediv[i].val);
> > > - tmp_rate = divider_round_rate(hw, rate, &tmp_prate, NULL,
> > > - AC100_CLKOUT_DIV_WIDTH,
> > > - CLK_DIVIDER_POWER_OF_TWO);
> > > -
> > > - if (tmp_rate > rate)
> > > - continue;
> > > - if (rate - tmp_rate < best_rate - tmp_rate)
> > > - best_rate = tmp_rate;
> > > - }
> > > -
> > > - return best_rate;
> > > -}
> > > -
> > > static int ac100_clkout_determine_rate(struct clk_hw *hw,
> > > struct clk_rate_request *req)
> > > {
> > > - struct clk_hw *best_parent;
> > > + int i, ret, num_parents = clk_hw_get_num_parents(hw);
> > > + struct clk_hw *best_parent = NULL;
> > > unsigned long best = 0;
> > > - int i, num_parents = clk_hw_get_num_parents(hw);
> > >
> > > for (i = 0; i < num_parents; i++) {
> > > struct clk_hw *parent = clk_hw_get_parent_by_index(hw, i);
> > > - unsigned long tmp, prate;
> > > + unsigned long prate;
> > >
> > > /*
> > > * The clock has two parents, one is a fixed clock which is
> > > @@ -199,13 +173,40 @@ static int ac100_clkout_determine_rate(struct clk_hw *hw,
> > >
> > > prate = clk_hw_get_rate(parent);
> > >
> > > - tmp = ac100_clkout_round_rate(hw, req->rate, prate);
> > > -
> > > - if (tmp > req->rate)
> > > - continue;
> > > - if (req->rate - tmp < req->rate - best) {
> > > - best = tmp;
> > > - best_parent = parent;
> > > + if (prate == AC100_RTC_32K_RATE) {
> > > + struct clk_rate_request div_req = *req;
> > > +
> > > + div_req.best_parent_rate = prate;
> > > +
> > > + ret = divider_determine_rate(hw, &div_req, NULL,
> > > + AC100_CLKOUT_DIV_WIDTH,
> > > + CLK_DIVIDER_POWER_OF_TWO);
> > > + if (ret != 0 || div_req.rate > req->rate)
> > > + continue;
> >
> > This leaves a braces inbalance
>
> To be clear, you also want the braces around the if like this:
>
> if (ret != 0 || div_req.rate > req->rate) {
> continue;
> } else if (req->rate - div_req.rate < req->rate - best) {
> best = div_req.rate;
> best_parent = parent;
> }
>
Yes, you can change that and add my ack on v2, I'm fine with this going
through clk.
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: (subset) [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
` (29 preceding siblings ...)
2026-01-21 22:53 ` Brian Masney
@ 2026-02-04 15:44 ` Vinod Koul
30 siblings, 0 replies; 56+ messages in thread
From: Vinod Koul @ 2026-02-04 15:44 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Brian Masney
Cc: linux-clk, linux-kernel, Chen Wang, Inochi Amaoto, sophgo,
Chen-Yu Tsai, Maxime Ripard, Jernej Skrabec, Samuel Holland,
linux-arm-kernel, linux-sunxi, Alexandre Belloni, linux-rtc,
Andreas Färber, Manivannan Sadhasivam, linux-actions,
Keguang Zhang, linux-mips, Taichi Sugaya, Takao Orito,
Jacky Huang, Shan-Chun Hung, Vladimir Zapolskiy,
Piotr Wojtaszczyk, Bjorn Andersson, linux-arm-msm, Orson Zhai,
Baolin Wang, Chunyan Zhang, Maxime Coquelin, Alexandre Torgue,
linux-stm32, Michal Simek, Rob Clark, Dmitry Baryshkov,
David Airlie, Simona Vetter, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, dri-devel, freedreno, Neil Armstrong,
linux-phy
On Thu, 08 Jan 2026 16:16:18 -0500, Brian Masney wrote:
> Here's a series that gets rid of the deprecated APIs
> divider_round_rate(), divider_round_rate_parent(), and
> divider_ro_round_rate_parent() since these functions are just wrappers
> for the determine_rate variant.
>
> Note that when I converted some of these drivers from round_rate to
> determine_rate, this was mistakenly converted to the following in some
> cases:
>
> [...]
Applied, thanks!
[25/27] phy: ti: phy-j721e-wiz: convert from divider_round_rate() to divider_determine_rate()
commit: dbeea86fecef7cf2b93aded4525d74f6277376ef
Best regards,
--
~Vinod
^ permalink raw reply [flat|nested] 56+ messages in thread
end of thread, other threads:[~2026-02-04 15:44 UTC | newest]
Thread overview: 56+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-08 21:16 [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Brian Masney
2026-01-08 21:16 ` [PATCH 01/27] clk: sophgo: cv18xx-ip: convert from divider_round_rate() to divider_determine_rate() Brian Masney
2026-01-08 21:16 ` [PATCH 02/27] clk: sunxi-ng: convert from divider_round_rate_parent() " Brian Masney
2026-01-11 5:48 ` Chen-Yu Tsai
2026-01-08 21:16 ` [PATCH 03/27] rtc: ac100: convert from divider_round_rate() " Brian Masney
2026-01-22 0:26 ` Alexandre Belloni
2026-01-22 0:48 ` Brian Masney
2026-01-22 2:02 ` Alexandre Belloni
2026-01-08 21:16 ` [PATCH 04/27] clk: actions: owl-composite: convert from owl_divider_helper_round_rate() " Brian Masney
2026-01-16 5:27 ` Manivannan Sadhasivam
2026-01-08 21:16 ` [PATCH 05/27] clk: actions: owl-divider: convert from divider_round_rate() " Brian Masney
2026-01-16 5:26 ` Manivannan Sadhasivam
2026-01-08 21:16 ` [PATCH 06/27] clk: bm1880: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
2026-01-16 5:23 ` Manivannan Sadhasivam
2026-01-08 21:16 ` [PATCH 07/27] clk: bm1880: convert from divider_round_rate() to divider_determine_rate() Brian Masney
2026-01-16 5:24 ` Manivannan Sadhasivam
2026-01-08 21:16 ` [PATCH 08/27] clk: hisilicon: clkdivider-hi6220: " Brian Masney
2026-01-08 21:16 ` [PATCH 09/27] clk: loongson1: " Brian Masney
2026-01-13 6:28 ` Keguang Zhang
2026-01-08 21:16 ` [PATCH 10/27] clk: milbeaut: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
2026-01-08 21:16 ` [PATCH 11/27] clk: milbeaut: convert from divider_round_rate() to divider_determine_rate() Brian Masney
2026-01-08 21:16 ` [PATCH 12/27] clk: nuvoton: ma35d1-divider: " Brian Masney
2026-01-08 21:16 ` [PATCH 13/27] clk: nxp: lpc32xx: " Brian Masney
2026-01-09 8:10 ` Vladimir Zapolskiy
2026-01-08 21:16 ` [PATCH 14/27] clk: qcom: alpha-pll: " Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:28 ` Abel Vesa
2026-01-08 21:16 ` [PATCH 15/27] clk: qcom: regmap-divider: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:28 ` Abel Vesa
2026-01-08 21:16 ` [PATCH 16/27] clk: qcom: regmap-divider: convert from divider_round_rate() to divider_determine_rate() Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:29 ` Abel Vesa
2026-01-08 21:16 ` [PATCH 17/27] clk: sophgo: sg2042-clkgen: " Brian Masney
2026-01-12 2:57 ` Chen Wang
2026-01-12 17:27 ` Brian Masney
2026-01-08 21:16 ` [PATCH 18/27] clk: sprd: div: " Brian Masney
2026-01-08 21:16 ` [PATCH 19/27] clk: stm32: stm32-core: convert from divider_ro_round_rate() to divider_ro_determine_rate() Brian Masney
2026-01-08 21:16 ` [PATCH 20/27] clk: stm32: stm32-core: convert from divider_round_rate_parent() to divider_determine_rate() Brian Masney
2026-01-08 21:16 ` [PATCH 21/27] clk: versaclock3: convert from divider_round_rate() " Brian Masney
2026-01-08 21:16 ` [PATCH 22/27] clk: x86: cgu: " Brian Masney
2026-01-08 21:16 ` [PATCH 23/27] clk: zynqmp: divider: " Brian Masney
2026-01-08 21:16 ` [PATCH 24/27] drm/msm/dsi_phy_14nm: " Brian Masney
2026-01-09 9:12 ` Konrad Dybcio
2026-01-09 9:29 ` Abel Vesa
2026-01-08 21:16 ` [PATCH 25/27] phy: ti: phy-j721e-wiz: " Brian Masney
2026-01-14 14:17 ` Vinod Koul
2026-01-15 14:18 ` Brian Masney
2026-01-21 7:56 ` Vinod Koul
2026-01-21 12:13 ` Brian Masney
2026-01-08 21:16 ` [PATCH 26/27] clk: divider: remove divider_ro_round_rate_parent() Brian Masney
2026-01-08 21:16 ` [PATCH 27/27] clk: divider: remove divider_round_rate() and divider_round_rate_parent() Brian Masney
2026-01-10 19:11 ` (subset) [PATCH 00/27] clk: remove deprecated API divider_round_rate() and friends Bjorn Andersson
2026-01-15 21:05 ` Dmitry Baryshkov
2026-01-21 22:53 ` Brian Masney
2026-02-04 15:44 ` (subset) " Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox