Commit 2204d96b authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by Stephen Boyd
Browse files

clk: mediatek: Add mtk_clk_simple_remove()



In commit c58cd0e4 ("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: default avatarChen-Yu Tsai <wenst@chromium.org>
Reviewed-by: default avatarMiles Chen <miles.chen@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220208124034.414635-20-wenst@chromium.org


Reviewed-by: default avatarChun-Jie Chen <chun-jie.chen@mediatek.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent cb50864f
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -374,6 +374,8 @@ int mtk_clk_simple_probe(struct platform_device *pdev)
	if (r)
		goto free_data;

	platform_set_drvdata(pdev, clk_data);

	return r;

free_data:
@@ -381,4 +383,17 @@ int mtk_clk_simple_probe(struct platform_device *pdev)
	return r;
}

int mtk_clk_simple_remove(struct platform_device *pdev)
{
	const struct mtk_clk_desc *mcd = of_device_get_match_data(&pdev->dev);
	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_gates(mcd->clks, mcd->num_clks, clk_data);
	mtk_free_clk_data(clk_data);

	return 0;
}

MODULE_LICENSE("GPL");
+1 −0
Original line number Diff line number Diff line
@@ -202,5 +202,6 @@ struct mtk_clk_desc {
};

int mtk_clk_simple_probe(struct platform_device *pdev);
int mtk_clk_simple_remove(struct platform_device *pdev);

#endif /* __DRV_CLK_MTK_H */