Skip to content

Commit 2204d96

Browse files
wensbebarino
authored andcommitted
clk: mediatek: Add mtk_clk_simple_remove()
In commit c58cd0e ("clk: mediatek: Add mtk_clk_simple_probe() to simplify clock providers"), a generic probe function was added to simplify clk drivers that only needed to support clk gates. However due to the lack of unregister APIs, a corresponding remove function was not added. Now that the unregister APIs have been implemented, add aforementioned remove function to make it complete. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: Miles Chen <miles.chen@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220208124034.414635-20-wenst@chromium.org Reviewed-by: Chun-Jie Chen <chun-jie.chen@mediatek.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent cb50864 commit 2204d96

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

drivers/clk/mediatek/clk-mtk.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,26 @@ int mtk_clk_simple_probe(struct platform_device *pdev)
374374
if (r)
375375
goto free_data;
376376

377+
platform_set_drvdata(pdev, clk_data);
378+
377379
return r;
378380

379381
free_data:
380382
mtk_free_clk_data(clk_data);
381383
return r;
382384
}
383385

386+
int mtk_clk_simple_remove(struct platform_device *pdev)
387+
{
388+
const struct mtk_clk_desc *mcd = of_device_get_match_data(&pdev->dev);
389+
struct clk_onecell_data *clk_data = platform_get_drvdata(pdev);
390+
struct device_node *node = pdev->dev.of_node;
391+
392+
of_clk_del_provider(node);
393+
mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data);
394+
mtk_free_clk_data(clk_data);
395+
396+
return 0;
397+
}
398+
384399
MODULE_LICENSE("GPL");

drivers/clk/mediatek/clk-mtk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,5 +202,6 @@ struct mtk_clk_desc {
202202
};
203203

204204
int mtk_clk_simple_probe(struct platform_device *pdev);
205+
int mtk_clk_simple_remove(struct platform_device *pdev);
205206

206207
#endif /* __DRV_CLK_MTK_H */

0 commit comments

Comments
 (0)