diff options
author | Chen-Yu Tsai <wenst@chromium.org> | 2022-02-08 20:40:33 +0800 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2022-02-17 12:12:25 -0800 |
commit | cf8a482afc286dde5eaf4a08d12b63590c599764 (patch) | |
tree | 71692b8832f960a44a685b7ae180f9f95a098ef7 /drivers/clk/mediatek/clk-mt8195-apusys_pll.c | |
parent | f3e690b00b86d2b2182b70433993fb038515f086 (diff) | |
download | linux-cf8a482afc286dde5eaf4a08d12b63590c599764.tar.gz |
clk: mediatek: mt8195: Implement remove functions
Until now the mediatek clk driver library did not have any way to
unregister clks, and so none of the drivers implemented remove
functions.
Now that the library does have APIs to unregister clks, use them
to implement remove functions for the mt8195 clk drivers.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Miles Chen <miles.chen@mediatek.com>
Link: https://lore.kernel.org/r/20220208124034.414635-31-wenst@chromium.org
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/mediatek/clk-mt8195-apusys_pll.c')
-rw-r--r-- | drivers/clk/mediatek/clk-mt8195-apusys_pll.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/clk/mediatek/clk-mt8195-apusys_pll.c b/drivers/clk/mediatek/clk-mt8195-apusys_pll.c index f489b57e325e..8cd88dfc3283 100644 --- a/drivers/clk/mediatek/clk-mt8195-apusys_pll.c +++ b/drivers/clk/mediatek/clk-mt8195-apusys_pll.c @@ -74,6 +74,8 @@ static int clk_mt8195_apusys_pll_probe(struct platform_device *pdev) if (r) goto unregister_plls; + platform_set_drvdata(pdev, clk_data); + return r; unregister_plls: @@ -83,6 +85,18 @@ free_apusys_pll_data: return r; } +static int clk_mt8195_apusys_pll_remove(struct platform_device *pdev) +{ + struct clk_onecell_data *clk_data = platform_get_drvdata(pdev); + struct device_node *node = pdev->dev.of_node; + + of_clk_del_provider(node); + mtk_clk_unregister_plls(apusys_plls, ARRAY_SIZE(apusys_plls), clk_data); + mtk_free_clk_data(clk_data); + + return 0; +} + static const struct of_device_id of_match_clk_mt8195_apusys_pll[] = { { .compatible = "mediatek,mt8195-apusys_pll", }, {} @@ -90,6 +104,7 @@ static const struct of_device_id of_match_clk_mt8195_apusys_pll[] = { static struct platform_driver clk_mt8195_apusys_pll_drv = { .probe = clk_mt8195_apusys_pll_probe, + .remove = clk_mt8195_apusys_pll_remove, .driver = { .name = "clk-mt8195-apusys_pll", .of_match_table = of_match_clk_mt8195_apusys_pll, |