[PATCH 2/3] clk: mediatek: clk-mt8192: drop CLK_OF_DECLARE_DRIVER

From: Miles Chen
Date: Mon Jan 10 2022 - 12:10:18 EST


clk-mt8192.c uses CLK_OF_DECLARE_DRIVER and it does not work for
kernel modules.

To support clk-mt8192 moudle build, move the
clk_mt8192_top_init_early() logic to clk_mt8192_top_probe()
and drop clk_mt8192_top_init_early() and CLK_OF_DECLARE_DRIVER.

Cc: Chun-Jie Chen <chun-jie.chen@xxxxxxxxxxxx>
Cc: Chen-Yu Tsai <wenst@xxxxxxxxxxxx>
Signed-off-by: Miles Chen <miles.chen@xxxxxxxxxxxx>
---
drivers/clk/mediatek/clk-mt8192.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/clk/mediatek/clk-mt8192.c b/drivers/clk/mediatek/clk-mt8192.c
index cbc7c6dbe0f4..552fae4f0fd5 100644
--- a/drivers/clk/mediatek/clk-mt8192.c
+++ b/drivers/clk/mediatek/clk-mt8192.c
@@ -1179,31 +1179,20 @@ static const struct mtk_pll_data plls[] = {

static struct clk_onecell_data *top_clk_data;

-static void clk_mt8192_top_init_early(struct device_node *node)
+static int clk_mt8192_top_probe(struct platform_device *pdev)
{
+ struct device_node *node = pdev->dev.of_node;
+ int r;
+ void __iomem *base;
int i;

top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
if (!top_clk_data)
- return;
+ return -ENOMEM;

for (i = 0; i < CLK_TOP_NR_CLK; i++)
top_clk_data->clks[i] = ERR_PTR(-EPROBE_DEFER);

- mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs), top_clk_data);
-
- of_clk_add_provider(node, of_clk_src_onecell_get, top_clk_data);
-}
-
-CLK_OF_DECLARE_DRIVER(mt8192_topckgen, "mediatek,mt8192-topckgen",
- clk_mt8192_top_init_early);
-
-static int clk_mt8192_top_probe(struct platform_device *pdev)
-{
- struct device_node *node = pdev->dev.of_node;
- int r;
- void __iomem *base;
-
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
--
2.18.0