diff options
author | Chen-Yu Tsai <wenst@chromium.org> | 2022-02-08 15:40:33 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2022-02-17 23:12:25 +0300 |
commit | cf8a482afc286dde5eaf4a08d12b63590c599764 (patch) | |
tree | 71692b8832f960a44a685b7ae180f9f95a098ef7 /drivers/clk/mediatek/clk-mt8195-apmixedsys.c | |
parent | f3e690b00b86d2b2182b70433993fb038515f086 (diff) | |
download | linux-cf8a482afc286dde5eaf4a08d12b63590c599764.tar.xz |
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-apmixedsys.c')
-rw-r--r-- | drivers/clk/mediatek/clk-mt8195-apmixedsys.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/clk/mediatek/clk-mt8195-apmixedsys.c b/drivers/clk/mediatek/clk-mt8195-apmixedsys.c index d0fdb5a4a921..eecc7035a56a 100644 --- a/drivers/clk/mediatek/clk-mt8195-apmixedsys.c +++ b/drivers/clk/mediatek/clk-mt8195-apmixedsys.c @@ -132,6 +132,8 @@ static int clk_mt8195_apmixed_probe(struct platform_device *pdev) if (r) goto unregister_gates; + platform_set_drvdata(pdev, clk_data); + return r; unregister_gates: @@ -143,8 +145,22 @@ free_apmixed_data: return r; } +static int clk_mt8195_apmixed_remove(struct platform_device *pdev) +{ + struct device_node *node = pdev->dev.of_node; + struct clk_onecell_data *clk_data = platform_get_drvdata(pdev); + + of_clk_del_provider(node); + mtk_clk_unregister_gates(apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data); + mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data); + mtk_free_clk_data(clk_data); + + return 0; +} + static struct platform_driver clk_mt8195_apmixed_drv = { .probe = clk_mt8195_apmixed_probe, + .remove = clk_mt8195_apmixed_remove, .driver = { .name = "clk-mt8195-apmixed", .of_match_table = of_match_clk_mt8195_apmixed, |