PM / devfreq: Convert to platform remove callback returning void
Subsystems (5)
cover PM / devfreq: Convert to platform remove callback returning void
Hello,
this series converts all drivers below drivers/devfreq to struct platform_driver::remove_new(). See commit 5c5a7680e67b ("platform: Provide a remove callback that returns no value") for an extended explanation and the eventual goal.
All conversations are trivial, because their .remove() callbacks returned zero unconditionally.
There are no interdependencies between these patches, so they could be picked up individually. But I'd hope that they get picked up all together by the devfreq maintainers.
Best regards
Uwe
Uwe Kleine-König (5):
PM / devfreq: exynos-nocp: Convert to platform remove callback returning void PM / devfreq: exynos-ppmu: Convert to platform remove callback returning void PM / devfreq: mtk-cci: Convert to platform remove callback returning void PM / devfreq: rk3399_dmc: Convert to platform remove callback returning void PM / devfreq: sun8i-a33-mbus: Convert to platform remove callback returning void
drivers/devfreq/event/exynos-nocp.c | 6 ++---- drivers/devfreq/event/exynos-ppmu.c | 6 ++---- drivers/devfreq/mtk-cci-devfreq.c | 6 ++---- drivers/devfreq/rk3399_dmc.c | 6 ++---- drivers/devfreq/sun8i-a33-mbus.c | 6 ++---- 5 files changed, 10 insertions(+), 20 deletions(-)
base-commit: 67908bf6954b7635d33760ff6dfc189fc26ccc89
Signature · 1 line
2.43.0
PATCH 1/5 PM / devfreq: exynos-nocp: Convert to platform remove callback returning void
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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/devfreq/event/exynos-nocp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/devfreq/event/exynos-nocp.c +2 -4
@@ -275,18 +275,16 @@ static int exynos_nocp_probe(struct platform_device *pdev)return 0 ; } -static int exynos_nocp_remove (struct platform_device *pdev) +static void exynos_nocp_remove (struct platform_device *pdev) {struct exynos_nocp *nocp =platform_get_drvdata (pdev);clk_disable_unprepare (nocp->clk); - -return 0 ; }static struct platform_driver exynos_nocp_driver = { .probe = exynos_nocp_probe, - .remove = exynos_nocp_remove, + .remove_new = exynos_nocp_remove, .driver = { .name ="exynos-nocp" , .of_match_table = exynos_nocp_id_match,
Signature · 1 line
2.43.0
PATCH 2/5 PM / devfreq: exynos-ppmu: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/devfreq/event/exynos-ppmu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/devfreq/event/exynos-ppmu.c +2 -4
@@ -692,18 +692,16 @@ static int exynos_ppmu_probe(struct platform_device *pdev)return 0 ; } -static int exynos_ppmu_remove (struct platform_device *pdev) +static void exynos_ppmu_remove (struct platform_device *pdev) {struct exynos_ppmu *info =platform_get_drvdata (pdev);clk_disable_unprepare (info->ppmu.clk); - -return 0 ; }static struct platform_driver exynos_ppmu_driver = { .probe = exynos_ppmu_probe, - .remove = exynos_ppmu_remove, + .remove_new = exynos_ppmu_remove, .driver = { .name ="exynos-ppmu" , .of_match_table = exynos_ppmu_id_match,
Signature · 1 line
2.43.0
PATCH 3/5 PM / devfreq: mtk-cci: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/devfreq/mtk-cci-devfreq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/devfreq/mtk-cci-devfreq.c +2 -4
@@ -392,7 +392,7 @@ static int mtk_ccifreq_probe(struct platform_device *pdev)return ret; } -static int mtk_ccifreq_remove (struct platform_device *pdev) +static void mtk_ccifreq_remove (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct mtk_ccifreq_drv *drv;
@@ -405,8 +405,6 @@ static int mtk_ccifreq_remove(struct platform_device *pdev)regulator_disable (drv->proc_reg);if (drv->sram_reg)regulator_disable (drv->sram_reg); - -return 0 ; }static const struct mtk_ccifreq_platform_data mt8183_platform_data = {
@@ -432,7 +430,7 @@ MODULE_DEVICE_TABLE(of, mtk_ccifreq_machines);static struct platform_driver mtk_ccifreq_platdrv = { .probe = mtk_ccifreq_probe, - .remove = mtk_ccifreq_remove, + .remove_new = mtk_ccifreq_remove, .driver = { .name ="mtk-ccifreq" , .of_match_table = mtk_ccifreq_machines,
Signature · 1 line
2.43.0
PATCH 4/5 PM / devfreq: rk3399_dmc: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/devfreq/rk3399_dmc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/devfreq/rk3399_dmc.c +2 -4
@@ -459,13 +459,11 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)return ret; } -static int rk3399_dmcfreq_remove (struct platform_device *pdev) +static void rk3399_dmcfreq_remove (struct platform_device *pdev) {struct rk3399_dmcfreq *dmcfreq =dev_get_drvdata (&pdev->dev);devfreq_event_disable_edev (dmcfreq->edev); - -return 0 ; }static const struct of_device_id rk3399dmc_devfreq_of_match[] = {
@@ -476,7 +474,7 @@ MODULE_DEVICE_TABLE(of, rk3399dmc_devfreq_of_match);static struct platform_driver rk3399_dmcfreq_driver = { .probe = rk3399_dmcfreq_probe, - .remove = rk3399_dmcfreq_remove, + .remove_new = rk3399_dmcfreq_remove, .driver = { .name ="rk3399-dmc-freq" , .pm = &rk3399_dmcfreq_pm,
Signature · 1 line
2.43.0
PATCH 5/5 PM / devfreq: sun8i-a33-mbus: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/devfreq/sun8i-a33-mbus.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/devfreq/sun8i-a33-mbus.c +2 -4
@@ -458,7 +458,7 @@ static int sun8i_a33_mbus_probe(struct platform_device *pdev)return dev_err_probe (dev, ret, err); } -static int sun8i_a33_mbus_remove (struct platform_device *pdev) +static void sun8i_a33_mbus_remove (struct platform_device *pdev) {struct sun8i_a33_mbus *priv =platform_get_drvdata (pdev);unsigned long initial_freq = priv->profile.initial_freq;
@@ -475,8 +475,6 @@ static int sun8i_a33_mbus_remove(struct platform_device *pdev)clk_rate_exclusive_put (priv->clk_mbus);clk_rate_exclusive_put (priv->clk_dram);clk_disable_unprepare (priv->clk_bus); - -return 0 ; }static const struct sun8i_a33_mbus_variant sun50i_a64_mbus = {
@@ -497,7 +495,7 @@ static SIMPLE_DEV_PM_OPS(sun8i_a33_mbus_pm_ops,static struct platform_driver sun8i_a33_mbus_driver = { .probe = sun8i_a33_mbus_probe, - .remove = sun8i_a33_mbus_remove, + .remove_new = sun8i_a33_mbus_remove, .driver = { .name ="sun8i-a33-mbus" , .of_match_table = sun8i_a33_mbus_of_match,
Signature · 1 line
2.43.0
Re: [PATCH 5/5] PM / devfreq: sun8i-a33-mbus: Convert to platform remove callback returning void
Dne ponedeljek, 04. marec 2024 ob 22:28:43 CET je Uwe Kleine-König napisal(a):
Quoted 10 lines
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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Quoted 4 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>
Best regards,
Jernej
Quoted 36 lines
--- drivers/devfreq/sun8i-a33-mbus.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/devfreq/sun8i-a33-mbus.c +2
-4@@ -458,7 +458,7 @@ static int sun8i_a33_mbus_probe(struct platform_device *pdev)return dev_err_probe (dev, ret, err); } -static int sun8i_a33_mbus_remove (struct platform_device *pdev) +static void sun8i_a33_mbus_remove (struct platform_device *pdev) {struct sun8i_a33_mbus *priv =platform_get_drvdata (pdev);unsigned long initial_freq = priv->profile.initial_freq;@@ -475,8 +475,6 @@ static int sun8i_a33_mbus_remove(struct platform_device *pdev)clk_rate_exclusive_put (priv->clk_mbus);clk_rate_exclusive_put (priv->clk_dram);clk_disable_unprepare (priv->clk_bus); - -return 0 ; }static const struct sun8i_a33_mbus_variant sun50i_a64_mbus = {@@ -497,7 +495,7 @@ static SIMPLE_DEV_PM_OPS(sun8i_a33_mbus_pm_ops,static struct platform_driver sun8i_a33_mbus_driver = { .probe = sun8i_a33_mbus_probe, - .remove = sun8i_a33_mbus_remove, + .remove_new = sun8i_a33_mbus_remove, .driver = { .name ="sun8i-a33-mbus" , .of_match_table = sun8i_a33_mbus_of_match,
Quoted 53 lines
-----Original Message-----
From: Uwe Kleine-König <[email protected]>
Sent: Tuesday, March 5, 2024 6:29 AM
To: Chanwoo Choi <[email protected]>; MyungJoo Ham <[email protected]>; Kyungmin Park <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>; Alim Akhtar <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; Matthias Brugger <[email protected]>; AngeloGioacchino Del Regno <[email protected]>; linux- [email protected]; Chen-Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>; linux- [email protected]
Subject: [PATCH 0/5] PM / devfreq: Convert to platform remove callback returning voidHello,
this series converts all drivers below
drivers/devfreqto structplatform_driver::remove_new(). See commit5c5a7680e67b("platform: Provide a remove callback that returns no value") for an extended explanation and the eventual goal.All conversations are trivial, because their .remove() callbacks returned zero unconditionally.
There are no interdependencies between these patches, so they could be picked up individually. But I'd hope that they get picked up all together by the devfreq maintainers.
Best regards
UweUwe Kleine-König (5):
PM / devfreq: exynos-nocp: Convert to platform remove callback returning
void
PM / devfreq: exynos-ppmu: Convert to platform remove callback returning
void
PM / devfreq: mtk-cci: Convert to platform remove callback returning void PM / devfreq:rk3399_dmc: Convert to platform remove callback returning
void
PM / devfreq: sun8i-a33-mbus: Convert to platform remove callback returning
voiddrivers/devfreq/event/exynos-nocp.c | 6 ++---- drivers/devfreq/event/exynos-ppmu.c | 6 ++---- drivers/devfreq/mtk-cci-devfreq.c | 6 ++---- drivers/devfreq/rk3399_dmc.c | 6 ++---- drivers/devfreq/sun8i-a33-mbus.c | 6 ++---- 5 files changed, 10 insertions(+), 20 deletions(-)
Quoted 4 lines
base-commit:
67908bf6954b7635d33760ff6dfc189fc26ccc89--
2.43.0
Applied it. Thanks.
Best Regards,
Chanwoo Choi