2023-09-18 10:47:37

by zhangqing

[permalink] [raw]
Subject: [PATCH v1 7/8] clk: rockchip: rk3588: Support module build

support CLK_OF_DECLARE and module_platform_driver
double clk init method.

Signed-off-by: Elaine Zhang <[email protected]>
---
drivers/clk/rockchip/clk-rk3588.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3588.c b/drivers/clk/rockchip/clk-rk3588.c
index 6f0db8ce3ba9..70ced70a3559 100644
--- a/drivers/clk/rockchip/clk-rk3588.c
+++ b/drivers/clk/rockchip/clk-rk3588.c
@@ -2504,6 +2504,7 @@ static void __init rk3588_clk_init(struct device_node *np)

CLK_OF_DECLARE(rk3588_cru, "rockchip,rk3588-cru", rk3588_clk_init);

+#ifdef MODULE
struct clk_rk3588_inits {
void (*inits)(struct device_node *np);
};
@@ -2519,8 +2520,9 @@ static const struct of_device_id clk_rk3588_match_table[] = {
},
{ }
};
+MODULE_DEVICE_TABLE(of, clk_rk3588_match_table);

-static int __init clk_rk3588_probe(struct platform_device *pdev)
+static int clk_rk3588_probe(struct platform_device *pdev)
{
const struct clk_rk3588_inits *init_data;
struct device *dev = &pdev->dev;
@@ -2536,10 +2538,15 @@ static int __init clk_rk3588_probe(struct platform_device *pdev)
}

static struct platform_driver clk_rk3588_driver = {
+ .probe = clk_rk3588_probe,
.driver = {
.name = "clk-rk3588",
.of_match_table = clk_rk3588_match_table,
.suppress_bind_attrs = true,
},
};
-builtin_platform_driver_probe(clk_rk3588_driver, clk_rk3588_probe);
+module_platform_driver(clk_rk3588_driver);
+
+MODULE_DESCRIPTION("Rockchip RK3588 Clock Driver");
+MODULE_LICENSE("GPL");
+#endif /* MODULE */
--
2.17.1