linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/31] thermal: Convert to platform remove callback returning void
@ 2023-09-27 19:37 Uwe Kleine-König
  2023-09-27 19:37 ` [PATCH 20/31] thermal: rcar_gen3: " Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2023-09-27 19:37 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano
  Cc: Guillaume La Roque, Amit Kucheria, Zhang Rui, linux-pm,
	linux-amlogic, kernel, Miquel Raynal, Florian Fainelli,
	Broadcom internal kernel review list, Ray Jui, Scott Branden,
	Niklas Söderlund, Heiko Stuebner, ye xingchen,
	linux-rpi-kernel, linux-arm-kernel, Balsam CHIHI, Adam Ward,
	Kunihiko Hayashi, AngeloGioacchino Del Regno, Support Opensource,
	Shawn Guo, Sascha Hauer, Fabio Estevam, NXP Linux Team,
	Srinivas Pandruvada, Yang Yingliang, Matthias Brugger,
	Nícolas F. R. A. Prado, Alexandre Mergnat, Chen-Yu Tsai,
	Chen Jiahao, linux-mediatek, Thara Gopinath, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
	Niklas Söderlund, linux-renesas-soc, linux-rockchip,
	Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Alim Akhtar,
	linux-samsung-soc, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Florian Fainelli, Rob Herring,
	Minghao Chi, linux-stm32, Thierry Reding, Jonathan Hunter,
	Jernej Skrabec, Johan Hovold, linux-tegra, Mikko Perttunen,
	Eduardo Valentin, Keerthy, linux-omap, Masami Hiramatsu

Hello,

this series converts all platform drivers below drivers/thermal to use
.remove_new(). The motivation is to get rid of an integer return code
that is (mostly) ignored by the platform driver core and error prone on
the driver side.

See commit 5c5a7680e67b ("platform: Provide a remove callback that
returns no value") for an extended explanation and the eventual goal.

There are no interdependencies between the patches. As there are still
quite a few drivers to convert, I'm happy about every patch that makes
it in. So even if there is a merge conflict with one patch until you
apply or a subject prefix is suboptimal, please apply the remainder of
this series anyhow.

Best regards
Uwe

Uwe Kleine-König (31):
  thermal: amlogic: Convert to platform remove callback returning void
  thermal: armada: Convert to platform remove callback returning void
  thermal: bcm2835: Convert to platform remove callback returning void
  thermal: ns: Convert to platform remove callback returning void
  thermal: da9062: Convert to platform remove callback returning void
  thermal: dove: Convert to platform remove callback returning void
  thermal: hisi: Convert to platform remove callback returning void
  thermal: imx8mm: Convert to platform remove callback returning void
  thermal: imx: Convert to platform remove callback returning void
  thermal: int3400: Convert to platform remove callback returning void
  thermal: int3401: Convert to platform remove callback returning void
  thermal: int3402: Convert to platform remove callback returning void
  thermal: int3403: Convert to platform remove callback returning void
  thermal: int3406: Convert to platform remove callback returning void
  thermal: k3_bandgap: Convert to platform remove callback returning void
  thermal: k3_j72xx_bandgap: Convert to platform remove callback returning void
  thermal: kirkwood: Convert to platform remove callback returning void
  thermal: lvts: Convert to platform remove callback returning void
  thermal: tsens: Convert to platform remove callback returning void
  thermal: rcar_gen3: Convert to platform remove callback returning void
  thermal: rcar: Convert to platform remove callback returning void
  thermal: rockchip: Convert to platform remove callback returning void
  thermal: rzg2l: Convert to platform remove callback returning void
  thermal: exynos_tmu: Convert to platform remove callback returning void
  thermal: spear: Convert to platform remove callback returning void
  thermal: sprd: Convert to platform remove callback returning void
  thermal: stm: Convert to platform remove callback returning void
  thermal: soctherm: Convert to platform remove callback returning void
  thermal: tegra-bpmp: Convert to platform remove callback returning void
  thermal: ti-bandgap: Convert to platform remove callback returning void
  thermal: uniphier: Convert to platform remove callback returning void

 drivers/thermal/amlogic_thermal.c                    | 12 +++++-------
 drivers/thermal/armada_thermal.c                     |  6 ++----
 drivers/thermal/broadcom/bcm2835_thermal.c           |  6 ++----
 drivers/thermal/broadcom/ns-thermal.c                |  6 ++----
 drivers/thermal/da9062-thermal.c                     |  5 ++---
 drivers/thermal/dove_thermal.c                       |  6 ++----
 drivers/thermal/hisi_thermal.c                       |  6 ++----
 drivers/thermal/imx8mm_thermal.c                     |  6 ++----
 drivers/thermal/imx_thermal.c                        |  6 ++----
 .../thermal/intel/int340x_thermal/int3400_thermal.c  |  5 ++---
 .../thermal/intel/int340x_thermal/int3401_thermal.c  |  6 ++----
 .../thermal/intel/int340x_thermal/int3402_thermal.c  |  6 ++----
 .../thermal/intel/int340x_thermal/int3403_thermal.c  |  6 ++----
 .../thermal/intel/int340x_thermal/int3406_thermal.c  |  5 ++---
 drivers/thermal/k3_bandgap.c                         |  6 ++----
 drivers/thermal/k3_j72xx_bandgap.c                   |  6 ++----
 drivers/thermal/kirkwood_thermal.c                   |  6 ++----
 drivers/thermal/mediatek/lvts_thermal.c              |  6 ++----
 drivers/thermal/qcom/tsens.c                         |  6 ++----
 drivers/thermal/rcar_gen3_thermal.c                  |  6 ++----
 drivers/thermal/rcar_thermal.c                       |  6 ++----
 drivers/thermal/rockchip_thermal.c                   |  6 ++----
 drivers/thermal/rzg2l_thermal.c                      |  6 ++----
 drivers/thermal/samsung/exynos_tmu.c                 |  6 ++----
 drivers/thermal/spear_thermal.c                      |  6 ++----
 drivers/thermal/sprd_thermal.c                       |  5 ++---
 drivers/thermal/st/stm_thermal.c                     |  6 ++----
 drivers/thermal/tegra/soctherm.c                     |  6 ++----
 drivers/thermal/tegra/tegra-bpmp-thermal.c           |  6 ++----
 drivers/thermal/ti-soc-thermal/ti-bandgap.c          |  6 ++----
 drivers/thermal/uniphier_thermal.c                   |  6 ++----
 31 files changed, 65 insertions(+), 123 deletions(-)

base-commit: 18030226a48de1fbfabf4ae16aaa2695a484254f
-- 
2.40.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 20/31] thermal: rcar_gen3: Convert to platform remove callback returning void
  2023-09-27 19:37 [PATCH 00/31] thermal: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-09-27 19:37 ` Uwe Kleine-König
  2023-09-27 19:40   ` Wolfram Sang
                     ` (2 more replies)
  2023-09-27 19:37 ` [PATCH 21/31] thermal: rcar: " Uwe Kleine-König
  2023-09-27 19:45 ` [PATCH 00/31] thermal: " Rafael J. Wysocki
  2 siblings, 3 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2023-09-27 19:37 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano
  Cc: Niklas Söderlund, Amit Kucheria, Zhang Rui,
	linux-renesas-soc, linux-pm, kernel

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/thermal/rcar_gen3_thermal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index bd2fb8c2e968..cafcb6d6e235 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -432,14 +432,12 @@ static const struct of_device_id rcar_gen3_thermal_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, rcar_gen3_thermal_dt_ids);
 
-static int rcar_gen3_thermal_remove(struct platform_device *pdev)
+static void rcar_gen3_thermal_remove(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 
 	pm_runtime_put(dev);
 	pm_runtime_disable(dev);
-
-	return 0;
 }
 
 static void rcar_gen3_hwmon_action(void *data)
@@ -594,7 +592,7 @@ static struct platform_driver rcar_gen3_thermal_driver = {
 		.of_match_table = rcar_gen3_thermal_dt_ids,
 	},
 	.probe		= rcar_gen3_thermal_probe,
-	.remove		= rcar_gen3_thermal_remove,
+	.remove_new	= rcar_gen3_thermal_remove,
 };
 module_platform_driver(rcar_gen3_thermal_driver);
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 21/31] thermal: rcar: Convert to platform remove callback returning void
  2023-09-27 19:37 [PATCH 00/31] thermal: Convert to platform remove callback returning void Uwe Kleine-König
  2023-09-27 19:37 ` [PATCH 20/31] thermal: rcar_gen3: " Uwe Kleine-König
@ 2023-09-27 19:37 ` Uwe Kleine-König
  2023-09-27 19:40   ` Wolfram Sang
                     ` (2 more replies)
  2023-09-27 19:45 ` [PATCH 00/31] thermal: " Rafael J. Wysocki
  2 siblings, 3 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2023-09-27 19:37 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano
  Cc: Niklas Söderlund, Amit Kucheria, Zhang Rui,
	linux-renesas-soc, linux-pm, kernel

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/thermal/rcar_thermal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 293f8dd9fe0a..feb848d595fa 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -371,7 +371,7 @@ static irqreturn_t rcar_thermal_irq(int irq, void *data)
 /*
  *		platform functions
  */
-static int rcar_thermal_remove(struct platform_device *pdev)
+static void rcar_thermal_remove(struct platform_device *pdev)
 {
 	struct rcar_thermal_common *common = platform_get_drvdata(pdev);
 	struct device *dev = &pdev->dev;
@@ -388,8 +388,6 @@ static int rcar_thermal_remove(struct platform_device *pdev)
 
 	pm_runtime_put(dev);
 	pm_runtime_disable(dev);
-
-	return 0;
 }
 
 static int rcar_thermal_probe(struct platform_device *pdev)
@@ -581,7 +579,7 @@ static struct platform_driver rcar_thermal_driver = {
 		.of_match_table = rcar_thermal_dt_ids,
 	},
 	.probe		= rcar_thermal_probe,
-	.remove		= rcar_thermal_remove,
+	.remove_new	= rcar_thermal_remove,
 };
 module_platform_driver(rcar_thermal_driver);
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 20/31] thermal: rcar_gen3: Convert to platform remove callback returning void
  2023-09-27 19:37 ` [PATCH 20/31] thermal: rcar_gen3: " Uwe Kleine-König
@ 2023-09-27 19:40   ` Wolfram Sang
  2023-09-28  8:21   ` Geert Uytterhoeven
  2023-09-28 15:26   ` Niklas Söderlund
  2 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2023-09-27 19:40 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rafael J. Wysocki, Daniel Lezcano, Niklas Söderlund,
	Amit Kucheria, Zhang Rui, linux-renesas-soc, linux-pm, kernel

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

On Wed, Sep 27, 2023 at 09:37:25PM +0200, Uwe Kleine-König wrote:
> 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 21/31] thermal: rcar: Convert to platform remove callback returning void
  2023-09-27 19:37 ` [PATCH 21/31] thermal: rcar: " Uwe Kleine-König
@ 2023-09-27 19:40   ` Wolfram Sang
  2023-09-28  8:22   ` Geert Uytterhoeven
  2023-09-28 15:26   ` Niklas Söderlund
  2 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2023-09-27 19:40 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rafael J. Wysocki, Daniel Lezcano, Niklas Söderlund,
	Amit Kucheria, Zhang Rui, linux-renesas-soc, linux-pm, kernel

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

On Wed, Sep 27, 2023 at 09:37:26PM +0200, Uwe Kleine-König wrote:
> 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 00/31] thermal: Convert to platform remove callback returning void
  2023-09-27 19:37 [PATCH 00/31] thermal: Convert to platform remove callback returning void Uwe Kleine-König
  2023-09-27 19:37 ` [PATCH 20/31] thermal: rcar_gen3: " Uwe Kleine-König
  2023-09-27 19:37 ` [PATCH 21/31] thermal: rcar: " Uwe Kleine-König
@ 2023-09-27 19:45 ` Rafael J. Wysocki
  2023-09-28  7:05   ` Daniel Lezcano
  2 siblings, 1 reply; 11+ messages in thread
From: Rafael J. Wysocki @ 2023-09-27 19:45 UTC (permalink / raw)
  To: Uwe Kleine-König, Daniel Lezcano
  Cc: Rafael J. Wysocki, Guillaume La Roque, Amit Kucheria, Zhang Rui,
	linux-pm, linux-amlogic, kernel, Miquel Raynal, Florian Fainelli,
	Broadcom internal kernel review list, Ray Jui, Scott Branden,
	Niklas Söderlund, Heiko Stuebner, ye xingchen,
	linux-rpi-kernel, linux-arm-kernel, Balsam CHIHI, Adam Ward,
	Kunihiko Hayashi, AngeloGioacchino Del Regno, Support Opensource,
	Shawn Guo, Sascha Hauer, Fabio Estevam, NXP Linux Team,
	Srinivas Pandruvada, Yang Yingliang, Matthias Brugger,
	Nícolas F. R. A. Prado, Alexandre Mergnat, Chen-Yu Tsai,
	Chen Jiahao, linux-mediatek, Thara Gopinath, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
	Niklas Söderlund, linux-renesas-soc, linux-rockchip,
	Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Alim Akhtar,
	linux-samsung-soc, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Florian Fainelli, Rob Herring,
	Minghao Chi, linux-stm32, Thierry Reding, Jonathan Hunter,
	Jernej Skrabec, Johan Hovold, linux-tegra, Mikko Perttunen,
	Eduardo Valentin, Keerthy, linux-omap, Masami Hiramatsu

Hi,

On Wed, Sep 27, 2023 at 9:38 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Hello,
>
> this series converts all platform drivers below drivers/thermal to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
>
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for an extended explanation and the eventual goal.
>
> There are no interdependencies between the patches. As there are still
> quite a few drivers to convert, I'm happy about every patch that makes
> it in. So even if there is a merge conflict with one patch until you
> apply or a subject prefix is suboptimal, please apply the remainder of
> this series anyhow.

I think I'll go ahead and apply all of this in one go (for 6.7).

Daniel, any objections?


> Uwe Kleine-König (31):
>   thermal: amlogic: Convert to platform remove callback returning void
>   thermal: armada: Convert to platform remove callback returning void
>   thermal: bcm2835: Convert to platform remove callback returning void
>   thermal: ns: Convert to platform remove callback returning void
>   thermal: da9062: Convert to platform remove callback returning void
>   thermal: dove: Convert to platform remove callback returning void
>   thermal: hisi: Convert to platform remove callback returning void
>   thermal: imx8mm: Convert to platform remove callback returning void
>   thermal: imx: Convert to platform remove callback returning void
>   thermal: int3400: Convert to platform remove callback returning void
>   thermal: int3401: Convert to platform remove callback returning void
>   thermal: int3402: Convert to platform remove callback returning void
>   thermal: int3403: Convert to platform remove callback returning void
>   thermal: int3406: Convert to platform remove callback returning void
>   thermal: k3_bandgap: Convert to platform remove callback returning void
>   thermal: k3_j72xx_bandgap: Convert to platform remove callback returning void
>   thermal: kirkwood: Convert to platform remove callback returning void
>   thermal: lvts: Convert to platform remove callback returning void
>   thermal: tsens: Convert to platform remove callback returning void
>   thermal: rcar_gen3: Convert to platform remove callback returning void
>   thermal: rcar: Convert to platform remove callback returning void
>   thermal: rockchip: Convert to platform remove callback returning void
>   thermal: rzg2l: Convert to platform remove callback returning void
>   thermal: exynos_tmu: Convert to platform remove callback returning void
>   thermal: spear: Convert to platform remove callback returning void
>   thermal: sprd: Convert to platform remove callback returning void
>   thermal: stm: Convert to platform remove callback returning void
>   thermal: soctherm: Convert to platform remove callback returning void
>   thermal: tegra-bpmp: Convert to platform remove callback returning void
>   thermal: ti-bandgap: Convert to platform remove callback returning void
>   thermal: uniphier: Convert to platform remove callback returning void
>
>  drivers/thermal/amlogic_thermal.c                    | 12 +++++-------
>  drivers/thermal/armada_thermal.c                     |  6 ++----
>  drivers/thermal/broadcom/bcm2835_thermal.c           |  6 ++----
>  drivers/thermal/broadcom/ns-thermal.c                |  6 ++----
>  drivers/thermal/da9062-thermal.c                     |  5 ++---
>  drivers/thermal/dove_thermal.c                       |  6 ++----
>  drivers/thermal/hisi_thermal.c                       |  6 ++----
>  drivers/thermal/imx8mm_thermal.c                     |  6 ++----
>  drivers/thermal/imx_thermal.c                        |  6 ++----
>  .../thermal/intel/int340x_thermal/int3400_thermal.c  |  5 ++---
>  .../thermal/intel/int340x_thermal/int3401_thermal.c  |  6 ++----
>  .../thermal/intel/int340x_thermal/int3402_thermal.c  |  6 ++----
>  .../thermal/intel/int340x_thermal/int3403_thermal.c  |  6 ++----
>  .../thermal/intel/int340x_thermal/int3406_thermal.c  |  5 ++---
>  drivers/thermal/k3_bandgap.c                         |  6 ++----
>  drivers/thermal/k3_j72xx_bandgap.c                   |  6 ++----
>  drivers/thermal/kirkwood_thermal.c                   |  6 ++----
>  drivers/thermal/mediatek/lvts_thermal.c              |  6 ++----
>  drivers/thermal/qcom/tsens.c                         |  6 ++----
>  drivers/thermal/rcar_gen3_thermal.c                  |  6 ++----
>  drivers/thermal/rcar_thermal.c                       |  6 ++----
>  drivers/thermal/rockchip_thermal.c                   |  6 ++----
>  drivers/thermal/rzg2l_thermal.c                      |  6 ++----
>  drivers/thermal/samsung/exynos_tmu.c                 |  6 ++----
>  drivers/thermal/spear_thermal.c                      |  6 ++----
>  drivers/thermal/sprd_thermal.c                       |  5 ++---
>  drivers/thermal/st/stm_thermal.c                     |  6 ++----
>  drivers/thermal/tegra/soctherm.c                     |  6 ++----
>  drivers/thermal/tegra/tegra-bpmp-thermal.c           |  6 ++----
>  drivers/thermal/ti-soc-thermal/ti-bandgap.c          |  6 ++----
>  drivers/thermal/uniphier_thermal.c                   |  6 ++----
>  31 files changed, 65 insertions(+), 123 deletions(-)
>
> base-commit: 18030226a48de1fbfabf4ae16aaa2695a484254f
> --
> 2.40.1
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 00/31] thermal: Convert to platform remove callback returning void
  2023-09-27 19:45 ` [PATCH 00/31] thermal: " Rafael J. Wysocki
@ 2023-09-28  7:05   ` Daniel Lezcano
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Lezcano @ 2023-09-28  7:05 UTC (permalink / raw)
  To: Rafael J. Wysocki, Uwe Kleine-König
  Cc: Guillaume La Roque, Amit Kucheria, Zhang Rui, linux-pm,
	linux-amlogic, kernel, Miquel Raynal, Florian Fainelli,
	Broadcom internal kernel review list, Ray Jui, Scott Branden,
	Niklas Söderlund, Heiko Stuebner, ye xingchen,
	linux-rpi-kernel, linux-arm-kernel, Balsam CHIHI, Adam Ward,
	Kunihiko Hayashi, AngeloGioacchino Del Regno, Support Opensource,
	Shawn Guo, Sascha Hauer, Fabio Estevam, NXP Linux Team,
	Srinivas Pandruvada, Yang Yingliang, Matthias Brugger,
	Nícolas F. R. A. Prado, Alexandre Mergnat, Chen-Yu Tsai,
	Chen Jiahao, linux-mediatek, Thara Gopinath, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
	Niklas Söderlund, linux-renesas-soc, linux-rockchip,
	Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Alim Akhtar,
	linux-samsung-soc, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Florian Fainelli, Rob Herring,
	Minghao Chi, linux-stm32, Thierry Reding, Jonathan Hunter,
	Jernej Skrabec, Johan Hovold, linux-tegra, Mikko Perttunen,
	Eduardo Valentin, Keerthy, linux-omap, Masami Hiramatsu

On 27/09/2023 21:45, Rafael J. Wysocki wrote:
> Hi,
> 
> On Wed, Sep 27, 2023 at 9:38 PM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
>>
>> Hello,
>>
>> this series converts all platform drivers below drivers/thermal to use
>> .remove_new(). The motivation is to get rid of an integer return code
>> that is (mostly) ignored by the platform driver core and error prone on
>> the driver side.
>>
>> See commit 5c5a7680e67b ("platform: Provide a remove callback that
>> returns no value") for an extended explanation and the eventual goal.
>>
>> There are no interdependencies between the patches. As there are still
>> quite a few drivers to convert, I'm happy about every patch that makes
>> it in. So even if there is a merge conflict with one patch until you
>> apply or a subject prefix is suboptimal, please apply the remainder of
>> this series anyhow.
> 
> I think I'll go ahead and apply all of this in one go (for 6.7).
> 
> Daniel, any objections?

No objection, for the series:

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 20/31] thermal: rcar_gen3: Convert to platform remove callback returning void
  2023-09-27 19:37 ` [PATCH 20/31] thermal: rcar_gen3: " Uwe Kleine-König
  2023-09-27 19:40   ` Wolfram Sang
@ 2023-09-28  8:21   ` Geert Uytterhoeven
  2023-09-28 15:26   ` Niklas Söderlund
  2 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2023-09-28  8:21 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rafael J. Wysocki, Daniel Lezcano, Niklas Söderlund,
	Amit Kucheria, Zhang Rui, linux-renesas-soc, linux-pm, kernel

On Wed, Sep 27, 2023 at 9:49 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 21/31] thermal: rcar: Convert to platform remove callback returning void
  2023-09-27 19:37 ` [PATCH 21/31] thermal: rcar: " Uwe Kleine-König
  2023-09-27 19:40   ` Wolfram Sang
@ 2023-09-28  8:22   ` Geert Uytterhoeven
  2023-09-28 15:26   ` Niklas Söderlund
  2 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2023-09-28  8:22 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rafael J. Wysocki, Daniel Lezcano, Niklas Söderlund,
	Amit Kucheria, Zhang Rui, linux-renesas-soc, linux-pm, kernel

On Wed, Sep 27, 2023 at 9:42 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 20/31] thermal: rcar_gen3: Convert to platform remove callback returning void
  2023-09-27 19:37 ` [PATCH 20/31] thermal: rcar_gen3: " Uwe Kleine-König
  2023-09-27 19:40   ` Wolfram Sang
  2023-09-28  8:21   ` Geert Uytterhoeven
@ 2023-09-28 15:26   ` Niklas Söderlund
  2 siblings, 0 replies; 11+ messages in thread
From: Niklas Söderlund @ 2023-09-28 15:26 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rafael J. Wysocki, Daniel Lezcano, Amit Kucheria, Zhang Rui,
	linux-renesas-soc, linux-pm, kernel

On 2023-09-27 21:37:25 +0200, Uwe Kleine-König wrote:
> 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/thermal/rcar_gen3_thermal.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
> index bd2fb8c2e968..cafcb6d6e235 100644
> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -432,14 +432,12 @@ static const struct of_device_id rcar_gen3_thermal_dt_ids[] = {
>  };
>  MODULE_DEVICE_TABLE(of, rcar_gen3_thermal_dt_ids);
>  
> -static int rcar_gen3_thermal_remove(struct platform_device *pdev)
> +static void rcar_gen3_thermal_remove(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  
>  	pm_runtime_put(dev);
>  	pm_runtime_disable(dev);
> -
> -	return 0;
>  }
>  
>  static void rcar_gen3_hwmon_action(void *data)
> @@ -594,7 +592,7 @@ static struct platform_driver rcar_gen3_thermal_driver = {
>  		.of_match_table = rcar_gen3_thermal_dt_ids,
>  	},
>  	.probe		= rcar_gen3_thermal_probe,
> -	.remove		= rcar_gen3_thermal_remove,
> +	.remove_new	= rcar_gen3_thermal_remove,
>  };
>  module_platform_driver(rcar_gen3_thermal_driver);
>  
> -- 
> 2.40.1
> 

-- 
Kind Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 21/31] thermal: rcar: Convert to platform remove callback returning void
  2023-09-27 19:37 ` [PATCH 21/31] thermal: rcar: " Uwe Kleine-König
  2023-09-27 19:40   ` Wolfram Sang
  2023-09-28  8:22   ` Geert Uytterhoeven
@ 2023-09-28 15:26   ` Niklas Söderlund
  2 siblings, 0 replies; 11+ messages in thread
From: Niklas Söderlund @ 2023-09-28 15:26 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rafael J. Wysocki, Daniel Lezcano, Amit Kucheria, Zhang Rui,
	linux-renesas-soc, linux-pm, kernel

On 2023-09-27 21:37:26 +0200, Uwe Kleine-König wrote:
> 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/thermal/rcar_thermal.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 293f8dd9fe0a..feb848d595fa 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -371,7 +371,7 @@ static irqreturn_t rcar_thermal_irq(int irq, void *data)
>  /*
>   *		platform functions
>   */
> -static int rcar_thermal_remove(struct platform_device *pdev)
> +static void rcar_thermal_remove(struct platform_device *pdev)
>  {
>  	struct rcar_thermal_common *common = platform_get_drvdata(pdev);
>  	struct device *dev = &pdev->dev;
> @@ -388,8 +388,6 @@ static int rcar_thermal_remove(struct platform_device *pdev)
>  
>  	pm_runtime_put(dev);
>  	pm_runtime_disable(dev);
> -
> -	return 0;
>  }
>  
>  static int rcar_thermal_probe(struct platform_device *pdev)
> @@ -581,7 +579,7 @@ static struct platform_driver rcar_thermal_driver = {
>  		.of_match_table = rcar_thermal_dt_ids,
>  	},
>  	.probe		= rcar_thermal_probe,
> -	.remove		= rcar_thermal_remove,
> +	.remove_new	= rcar_thermal_remove,
>  };
>  module_platform_driver(rcar_thermal_driver);
>  
> -- 
> 2.40.1
> 

-- 
Kind Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-09-28 15:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27 19:37 [PATCH 00/31] thermal: Convert to platform remove callback returning void Uwe Kleine-König
2023-09-27 19:37 ` [PATCH 20/31] thermal: rcar_gen3: " Uwe Kleine-König
2023-09-27 19:40   ` Wolfram Sang
2023-09-28  8:21   ` Geert Uytterhoeven
2023-09-28 15:26   ` Niklas Söderlund
2023-09-27 19:37 ` [PATCH 21/31] thermal: rcar: " Uwe Kleine-König
2023-09-27 19:40   ` Wolfram Sang
2023-09-28  8:22   ` Geert Uytterhoeven
2023-09-28 15:26   ` Niklas Söderlund
2023-09-27 19:45 ` [PATCH 00/31] thermal: " Rafael J. Wysocki
2023-09-28  7:05   ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).