Re: [PATCH v3 1/9] clk: bcm: kona: Move CLOCK_COUNT defines into the driver

From: Artur Weber
Date: Sun Mar 16 2025 - 15:01:54 EST


On 10.03.2025 09:40, Krzysztof Kozlowski wrote:
On Sat, Mar 08, 2025 at 08:50:39AM +0100, Artur Weber wrote:
CLOCK_COUNT defines for each CCU are stored in the DT binding header.
This is not correct - they are not used by device trees, only internally
by the driver.

Move the CLOCK_COUNT defines directly into the driver in preparation
for dropping them from the DT binding include.

Signed-off-by: Artur Weber <aweber.kernel@xxxxxxxxx>
---
drivers/clk/bcm/clk-bcm21664.c | 8 ++++++++
drivers/clk/bcm/clk-bcm281xx.c | 10 ++++++++++
2 files changed, 18 insertions(+)

diff --git a/drivers/clk/bcm/clk-bcm21664.c b/drivers/clk/bcm/clk-bcm21664.c
index 520c3aeb4ea9c4a431512c0909f9545c1761d17a..fa6e1649d6f5f459b63026109caea9e2f72e22dd 100644
--- a/drivers/clk/bcm/clk-bcm21664.c
+++ b/drivers/clk/bcm/clk-bcm21664.c
@@ -17,6 +17,8 @@ static struct peri_clk_data frac_1m_data = {
.clocks = CLOCKS("ref_crystal"),
};
+#define BCM21664_ROOT_CCU_CLOCK_COUNT (BCM21664_ROOT_CCU_FRAC_1M + 1)

I hit that wall too, no worries. It might surprise you but 0+1 != 1 :),

Do you mean that I should specify the clock count directly rather than
incrementing the last ID? Some other drivers seem to do this the way I
did here (samsung/clk-exynos*, renesas/r9a06g032-clocks.c).

so you redefine a define. You need to test this patch bisectability.

I assume renaming the define to not collide with the old name is the way
to go?

Best regards
Artur