Commit a65615df authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Stephen Boyd
Browse files

clk: mediatek: Convert all remaining drivers to platform_driver's .remove_new()



The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert all mediatek clk drivers from always returning zero in
the remove callback to the void returning variant.

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230430190233.878921-4-u.kleine-koenig@pengutronix.de


Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent b3bc7275
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ static int clk_mt2712_apmixed_probe(struct platform_device *pdev)
	return r;
}

static int clk_mt2712_apmixed_remove(struct platform_device *pdev)
static void clk_mt2712_apmixed_remove(struct platform_device *pdev)
{
	struct device_node *node = pdev->dev.of_node;
	struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -146,8 +146,6 @@ static int clk_mt2712_apmixed_remove(struct platform_device *pdev)
	of_clk_del_provider(node);
	mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
	mtk_free_clk_data(clk_data);

	return 0;
}

static const struct of_device_id of_match_clk_mt2712_apmixed[] = {
@@ -158,7 +156,7 @@ MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_apmixed);

static struct platform_driver clk_mt2712_apmixed_drv = {
	.probe = clk_mt2712_apmixed_probe,
	.remove = clk_mt2712_apmixed_remove,
	.remove_new = clk_mt2712_apmixed_remove,
	.driver = {
		.name = "clk-mt2712-apmixed",
		.of_match_table = of_match_clk_mt2712_apmixed,
+2 −4
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ static int clk_mt6795_apmixed_probe(struct platform_device *pdev)
	return ret;
}

static int clk_mt6795_apmixed_remove(struct platform_device *pdev)
static void clk_mt6795_apmixed_remove(struct platform_device *pdev)
{
	struct device_node *node = pdev->dev.of_node;
	struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -197,13 +197,11 @@ static int clk_mt6795_apmixed_remove(struct platform_device *pdev)
	mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs,
				  ARRAY_SIZE(pllfhs), clk_data);
	mtk_free_clk_data(clk_data);

	return 0;
}

static struct platform_driver clk_mt6795_apmixed_drv = {
	.probe = clk_mt6795_apmixed_probe,
	.remove = clk_mt6795_apmixed_remove,
	.remove_new = clk_mt6795_apmixed_remove,
	.driver = {
		.name = "clk-mt6795-apmixed",
		.of_match_table = of_match_clk_mt6795_apmixed,
+2 −4
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ static int clk_mt6795_infracfg_probe(struct platform_device *pdev)
	return ret;
}

static int clk_mt6795_infracfg_remove(struct platform_device *pdev)
static void clk_mt6795_infracfg_remove(struct platform_device *pdev)
{
	struct device_node *node = pdev->dev.of_node;
	struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -136,8 +136,6 @@ static int clk_mt6795_infracfg_remove(struct platform_device *pdev)
	mtk_clk_unregister_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
	mtk_clk_unregister_gates(infra_gates, ARRAY_SIZE(infra_gates), clk_data);
	mtk_free_clk_data(clk_data);

	return 0;
}

static struct platform_driver clk_mt6795_infracfg_drv = {
@@ -146,7 +144,7 @@ static struct platform_driver clk_mt6795_infracfg_drv = {
		.of_match_table = of_match_clk_mt6795_infracfg,
	},
	.probe = clk_mt6795_infracfg_probe,
	.remove = clk_mt6795_infracfg_remove,
	.remove_new = clk_mt6795_infracfg_remove,
};
module_platform_driver(clk_mt6795_infracfg_drv);

+2 −4
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ static int clk_mt6795_pericfg_probe(struct platform_device *pdev)
	return ret;
}

static int clk_mt6795_pericfg_remove(struct platform_device *pdev)
static void clk_mt6795_pericfg_remove(struct platform_device *pdev)
{
	struct device_node *node = pdev->dev.of_node;
	struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -145,8 +145,6 @@ static int clk_mt6795_pericfg_remove(struct platform_device *pdev)
	mtk_clk_unregister_composites(peri_clks, ARRAY_SIZE(peri_clks), clk_data);
	mtk_clk_unregister_gates(peri_gates, ARRAY_SIZE(peri_gates), clk_data);
	mtk_free_clk_data(clk_data);

	return 0;
}

static struct platform_driver clk_mt6795_pericfg_drv = {
@@ -155,7 +153,7 @@ static struct platform_driver clk_mt6795_pericfg_drv = {
		.of_match_table = of_match_clk_mt6795_pericfg,
	},
	.probe = clk_mt6795_pericfg_probe,
	.remove = clk_mt6795_pericfg_remove,
	.remove_new = clk_mt6795_pericfg_remove,
};
module_platform_driver(clk_mt6795_pericfg_drv);

+2 −4
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ static int clk_mt7622_apmixed_probe(struct platform_device *pdev)
	return ret;
}

static int clk_mt7622_apmixed_remove(struct platform_device *pdev)
static void clk_mt7622_apmixed_remove(struct platform_device *pdev)
{
	struct device_node *node = pdev->dev.of_node;
	struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -128,8 +128,6 @@ static int clk_mt7622_apmixed_remove(struct platform_device *pdev)
	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 const struct of_device_id of_match_clk_mt7622_apmixed[] = {
@@ -140,7 +138,7 @@ MODULE_DEVICE_TABLE(of, of_match_clk_mt7622_apmixed);

static struct platform_driver clk_mt7622_apmixed_drv = {
	.probe = clk_mt7622_apmixed_probe,
	.remove = clk_mt7622_apmixed_remove,
	.remove_new = clk_mt7622_apmixed_remove,
	.driver = {
		.name = "clk-mt7622-apmixed",
		.of_match_table = of_match_clk_mt7622_apmixed,
Loading