Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clk: rockchip: rk3128: 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.

Signed-off-by: Alex Bee <knaerzche@gmail.com>
Link: https://lore.kernel.org/r/20240606143401.32454-3-knaerzche@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>

authored by

Alex Bee and committed by
Heiko Stuebner
3d0316c9 e7456982

+16 -4
+16 -4
drivers/clk/rockchip/clk-rk3128.c
··· 569 569 "sclk_timer5", 570 570 }; 571 571 572 - static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device_node *np) 572 + static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device_node *np, 573 + unsigned long soc_nr_clks) 573 574 { 574 575 struct rockchip_clk_provider *ctx; 576 + unsigned long common_nr_clks; 575 577 void __iomem *reg_base; 576 578 579 + common_nr_clks = rockchip_clk_find_max_clk_id(common_clk_branches, 580 + ARRAY_SIZE(common_clk_branches)) + 1; 577 581 reg_base = of_iomap(np, 0); 578 582 if (!reg_base) { 579 583 pr_err("%s: could not map cru region\n", __func__); 580 584 return ERR_PTR(-ENOMEM); 581 585 } 582 586 583 - ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS); 587 + ctx = rockchip_clk_init(np, reg_base, max(common_nr_clks, soc_nr_clks)); 584 588 if (IS_ERR(ctx)) { 585 589 pr_err("%s: rockchip clk init failed\n", __func__); 586 590 iounmap(reg_base); ··· 613 609 static void __init rk3126_clk_init(struct device_node *np) 614 610 { 615 611 struct rockchip_clk_provider *ctx; 612 + unsigned long soc_nr_clks; 616 613 617 - ctx = rk3128_common_clk_init(np); 614 + soc_nr_clks = rockchip_clk_find_max_clk_id(rk3126_clk_branches, 615 + ARRAY_SIZE(rk3126_clk_branches)) + 1; 616 + 617 + ctx = rk3128_common_clk_init(np, soc_nr_clks); 618 618 if (IS_ERR(ctx)) 619 619 return; 620 620 ··· 635 627 static void __init rk3128_clk_init(struct device_node *np) 636 628 { 637 629 struct rockchip_clk_provider *ctx; 630 + unsigned long soc_nr_clks; 638 631 639 - ctx = rk3128_common_clk_init(np); 632 + soc_nr_clks = rockchip_clk_find_max_clk_id(rk3128_clk_branches, 633 + ARRAY_SIZE(rk3128_clk_branches)) + 1; 634 + 635 + ctx = rk3128_common_clk_init(np, soc_nr_clks); 640 636 if (IS_ERR(ctx)) 641 637 return; 642 638