Skip to contentSkip to conversation

Drop RK3568's variant of the CLK_NR_CLKS constant

PATCH Applied Heiko Stuebner 3 participants 6 messages Nov 3, 2025 – Nov 5, 2025

Subsystems (3)
lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

cover Drop RK3568's variant of the CLK_NR_CLKS constant

This drops the use of the CLK_NR_CLKS constant from the rk3568 clock driver and after that, drops the constant from the binding that should not have been part of it in the first place.

Heiko Stuebner (2):
clk: rockchip: rk3568: Drop CLK_NR_CLKS usage
dt-bindings: clock: rk3568: Drop CLK_NR_CLKS define

 drivers/clk/rockchip/clk-rk3568.c      | 5 ++++-
 include/dt-bindings/clock/rk3568-cru.h | 2 --
 2 files changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.47.2
author maintainer
#1 lore raw

PATCH 1/2 clk: rockchip: rk3568: Drop CLK_NR_CLKS usage

In order to get rid of CLK_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

---
 drivers/clk/rockchip/clk-rk3568.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3568.c +4 -1
index 97d279399ae8..74eabf9b2ae2 100644
@@ -1652,6 +1652,7 @@ CLK_OF_DECLARE(rk3568_cru_pmu, "rockchip,rk3568-pmucru", rk3568_pmu_clk_init);
 static void __init rk3568_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clk_nr_clks;
 	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
@@ -1660,7 +1661,9 @@ static void __init rk3568_clk_init(struct device_node *np)
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
+	clk_nr_clks = rockchip_clk_find_max_clk_id(rk3568_clk_branches,
+						   ARRAY_SIZE(rk3568_clk_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip clk init failed\n", __func__);
 		iounmap(reg_base);
Signature · 1 line
2.47.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] clk: rockchip: rk3568: Drop CLK_NR_CLKS usage

Hi,

Quoted 6 lines · Heiko Stuebner

In order to get rid of CLK_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

---

-- Sebastian

Quoted 30 lines
 drivers/clk/rockchip/clk-rk3568.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3568.c +4 -1
index 97d279399ae8..74eabf9b2ae2 100644
@@ -1652,6 +1652,7 @@ CLK_OF_DECLARE(rk3568_cru_pmu, "rockchip,rk3568-pmucru", rk3568_pmu_clk_init);
 static void __init rk3568_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clk_nr_clks;
 	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
@@ -1660,7 +1661,9 @@ static void __init rk3568_clk_init(struct device_node *np)
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
+	clk_nr_clks = rockchip_clk_find_max_clk_id(rk3568_clk_branches,
+						   ARRAY_SIZE(rk3568_clk_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip clk init failed\n", __func__);
 		iounmap(reg_base);
Signature · 1 line
2.47.2
author maintainer
#3 lore raw

PATCH 2/2 dt-bindings: clock: rk3568: Drop CLK_NR_CLKS define

In reply to Heiko Stuebner

CLK_NR_CLKS has always only be used on the driver side to calculate array sizes should never have been part of the clock-binding.

Let's drop it, since the kernel code no longer uses it either and nothing else has ever used it.

---
 include/dt-bindings/clock/rk3568-cru.h | 2 --
 1 file changed, 2 deletions(-)
include/dt-bindings/clock/rk3568-cru.h +0 -2
index 5263085c5b23..f01f0e9ce8f1 100644
@@ -483,8 +483,6 @@
 
 #define PCLK_CORE_PVTM		450
 
-#define CLK_NR_CLKS		(PCLK_CORE_PVTM + 1)
-
 /* pmu soft-reset indices */
 /* pmucru_softrst_con0 */
 #define SRST_P_PDPMU_NIU	0
Signature · 1 line
2.47.2
author maintainer Applied
#5 lore raw
In reply to Heiko Stuebner
Quoted 9 lines · Heiko Stuebner

This drops the use of the CLK_NR_CLKS constant from the rk3568 clock driver and after that, drops the constant from the binding that should not have been part of it in the first place.

Heiko Stuebner (2):
clk: rockchip: rk3568: Drop CLK_NR_CLKS usage
dt-bindings: clock: rk3568: Drop CLK_NR_CLKS define

[...]

Applied, thanks!

[1/2] clk: rockchip: rk3568: Drop CLK_NR_CLKS usage

      commit: 2a42e3210d4331dddfb04b020050bd774cf99659
[2/2] dt-bindings: clock: rk3568: Drop CLK_NR_CLKS define
      commit: ca38f0f65eefd79889b409c89c6932d7e2fe0993

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>