Skip to content

Commit 2496910

Browse files
Johan Jonkermmind
authored andcommitted
clk: rockchip: px30: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage
In order to get rid of CLK_NR_CLKS and CLKPMU_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. Signed-off-by: Johan Jonker <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Stuebner <[email protected]>
1 parent 1d34b97 commit 2496910

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/clk/rockchip/clk-px30.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,7 @@ static const char *const px30_cru_critical_clocks[] __initconst = {
10021002
static void __init px30_clk_init(struct device_node *np)
10031003
{
10041004
struct rockchip_clk_provider *ctx;
1005+
unsigned long clk_nr_clks;
10051006
void __iomem *reg_base;
10061007

10071008
reg_base = of_iomap(np, 0);
@@ -1010,7 +1011,9 @@ static void __init px30_clk_init(struct device_node *np)
10101011
return;
10111012
}
10121013

1013-
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
1014+
clk_nr_clks = rockchip_clk_find_max_clk_id(px30_clk_branches,
1015+
ARRAY_SIZE(px30_clk_branches)) + 1;
1016+
ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
10141017
if (IS_ERR(ctx)) {
10151018
pr_err("%s: rockchip clk init failed\n", __func__);
10161019
iounmap(reg_base);
@@ -1043,6 +1046,7 @@ CLK_OF_DECLARE(px30_cru, "rockchip,px30-cru", px30_clk_init);
10431046
static void __init px30_pmu_clk_init(struct device_node *np)
10441047
{
10451048
struct rockchip_clk_provider *ctx;
1049+
unsigned long clkpmu_nr_clks;
10461050
void __iomem *reg_base;
10471051

10481052
reg_base = of_iomap(np, 0);
@@ -1051,7 +1055,9 @@ static void __init px30_pmu_clk_init(struct device_node *np)
10511055
return;
10521056
}
10531057

1054-
ctx = rockchip_clk_init(np, reg_base, CLKPMU_NR_CLKS);
1058+
clkpmu_nr_clks = rockchip_clk_find_max_clk_id(px30_clk_pmu_branches,
1059+
ARRAY_SIZE(px30_clk_pmu_branches)) + 1;
1060+
ctx = rockchip_clk_init(np, reg_base, clkpmu_nr_clks);
10551061
if (IS_ERR(ctx)) {
10561062
pr_err("%s: rockchip pmu clk init failed\n", __func__);
10571063
return;

0 commit comments

Comments
 (0)