ARM Sunxi Platform Development
 help / color / mirror / Atom feed
* [PATCH 00/12] bus: Convert to platform remove callback returning void
@ 2023-11-09 20:28 Uwe Kleine-König
  2023-11-09 20:28 ` [PATCH 06/12] bus: sun50i-de2: " Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2023-11-09 20:28 UTC (permalink / raw)
  To: Jay Fang, Arnd Bergmann, Rob Herring, Jernej Skrabec,
	Laurentiu Tudor, Tony Lindgren, Sicelo A. Mhlongo, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Greg Kroah-Hartman, Liu Ying,
	Geert Uytterhoeven, Luis Chamberlain, Nick Alcock, Chen-Yu Tsai,
	Samuel Holland, Hans de Goede, Yangtao Li, Yuan Can,
	Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, kernel, linux-arm-msm, linux-arm-kernel,
	linux-sunxi, linux-tegra, linux-omap

Hello,

this series converts all drivers below drivers/bus 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.

drivers/bus/fsl-mc was already addressed earlier with a separate
series[1].

All conversations are trivial, because all .remove() callbacks returned
zero unconditionally.

Some of the drivers touched here don't have a maintainer and there is no
maintainer for all of drivers/bus. It would be great if someone could pick up
the whole series, maybe Arnd might do that?

Best regards
Uwe

[1] https://lore.kernel.org/lkml/20231103230001.3652259-3-u.kleine-koenig@pengutronix.de

Uwe Kleine-König (12):
  bus: hisi_lpc: Convert to platform remove callback returning void
  bus: omap-ocp2scp: Convert to platform remove callback returning void
  bus: omap_l3_smx: Convert to platform remove callback returning void
  bus: qcom-ssc-block-bus: Convert to platform remove callback returning
    void
  bus: simple-pm-bus: Convert to platform remove callback returning void
  bus: sun50i-de2: Convert to platform remove callback returning void
  bus: sunxi-rsb: Convert to platform remove callback returning void
  bus: tegra-aconnect: Convert to platform remove callback returning
    void
  bus: tegra-gmi: Convert to platform remove callback returning void
  bus: ti-pwmss: Convert to platform remove callback returning void
  bus: ti-sysc: Convert to platform remove callback returning void
  bus: ts-nbus: Convert to platform remove callback returning void

 drivers/bus/hisi_lpc.c           | 6 ++----
 drivers/bus/omap-ocp2scp.c       | 6 ++----
 drivers/bus/omap_l3_smx.c        | 6 ++----
 drivers/bus/qcom-ssc-block-bus.c | 6 ++----
 drivers/bus/simple-pm-bus.c      | 7 +++----
 drivers/bus/sun50i-de2.c         | 5 ++---
 drivers/bus/sunxi-rsb.c          | 6 ++----
 drivers/bus/tegra-aconnect.c     | 6 ++----
 drivers/bus/tegra-gmi.c          | 6 ++----
 drivers/bus/ti-pwmss.c           | 5 ++---
 drivers/bus/ti-sysc.c            | 6 ++----
 drivers/bus/ts-nbus.c            | 6 ++----
 12 files changed, 25 insertions(+), 46 deletions(-)

base-commit: b622d91ca201bf97582e9b09ebbaab005ecee86f
-- 
2.42.0


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

* [PATCH 06/12] bus: sun50i-de2: Convert to platform remove callback returning void
  2023-11-09 20:28 [PATCH 00/12] bus: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-11-09 20:28 ` Uwe Kleine-König
  2023-11-10 10:18   ` Andre Przywara
  2023-11-18 21:50   ` Jernej Škrabec
  2023-11-09 20:28 ` [PATCH 07/12] bus: sunxi-rsb: " Uwe Kleine-König
  2023-11-10  6:32 ` [PATCH 00/12] bus: " Arnd Bergmann
  2 siblings, 2 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2023-11-09 20:28 UTC (permalink / raw)
  To: Arnd Bergmann, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: linux-arm-kernel, linux-sunxi, linux-kernel, 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/bus/sun50i-de2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/sun50i-de2.c b/drivers/bus/sun50i-de2.c
index 414f29cdedf0..3339311ce068 100644
--- a/drivers/bus/sun50i-de2.c
+++ b/drivers/bus/sun50i-de2.c
@@ -24,10 +24,9 @@ static int sun50i_de2_bus_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sun50i_de2_bus_remove(struct platform_device *pdev)
+static void sun50i_de2_bus_remove(struct platform_device *pdev)
 {
 	sunxi_sram_release(&pdev->dev);
-	return 0;
 }
 
 static const struct of_device_id sun50i_de2_bus_of_match[] = {
@@ -37,7 +36,7 @@ static const struct of_device_id sun50i_de2_bus_of_match[] = {
 
 static struct platform_driver sun50i_de2_bus_driver = {
 	.probe = sun50i_de2_bus_probe,
-	.remove = sun50i_de2_bus_remove,
+	.remove_new = sun50i_de2_bus_remove,
 	.driver = {
 		.name = "sun50i-de2-bus",
 		.of_match_table = sun50i_de2_bus_of_match,
-- 
2.42.0


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

* [PATCH 07/12] bus: sunxi-rsb: Convert to platform remove callback returning void
  2023-11-09 20:28 [PATCH 00/12] bus: Convert to platform remove callback returning void Uwe Kleine-König
  2023-11-09 20:28 ` [PATCH 06/12] bus: sun50i-de2: " Uwe Kleine-König
@ 2023-11-09 20:28 ` Uwe Kleine-König
  2023-11-10 10:20   ` Andre Przywara
  2023-11-18 21:51   ` Jernej Škrabec
  2023-11-10  6:32 ` [PATCH 00/12] bus: " Arnd Bergmann
  2 siblings, 2 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2023-11-09 20:28 UTC (permalink / raw)
  To: Arnd Bergmann, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Greg Kroah-Hartman, Hans de Goede, Laurentiu Tudor, Rob Herring,
	Yangtao Li, Yuan Can
  Cc: linux-arm-kernel, linux-sunxi, linux-kernel, 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/bus/sunxi-rsb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
index db0ed4e5d315..fd3e9d82340a 100644
--- a/drivers/bus/sunxi-rsb.c
+++ b/drivers/bus/sunxi-rsb.c
@@ -817,15 +817,13 @@ static int sunxi_rsb_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sunxi_rsb_remove(struct platform_device *pdev)
+static void sunxi_rsb_remove(struct platform_device *pdev)
 {
 	struct sunxi_rsb *rsb = platform_get_drvdata(pdev);
 
 	device_for_each_child(rsb->dev, NULL, sunxi_rsb_remove_devices);
 	pm_runtime_disable(&pdev->dev);
 	sunxi_rsb_hw_exit(rsb);
-
-	return 0;
 }
 
 static const struct dev_pm_ops sunxi_rsb_dev_pm_ops = {
@@ -842,7 +840,7 @@ MODULE_DEVICE_TABLE(of, sunxi_rsb_of_match_table);
 
 static struct platform_driver sunxi_rsb_driver = {
 	.probe = sunxi_rsb_probe,
-	.remove	= sunxi_rsb_remove,
+	.remove_new = sunxi_rsb_remove,
 	.driver	= {
 		.name = RSB_CTRL_NAME,
 		.of_match_table = sunxi_rsb_of_match_table,
-- 
2.42.0


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

* Re: [PATCH 00/12] bus: Convert to platform remove callback returning void
  2023-11-09 20:28 [PATCH 00/12] bus: Convert to platform remove callback returning void Uwe Kleine-König
  2023-11-09 20:28 ` [PATCH 06/12] bus: sun50i-de2: " Uwe Kleine-König
  2023-11-09 20:28 ` [PATCH 07/12] bus: sunxi-rsb: " Uwe Kleine-König
@ 2023-11-10  6:32 ` Arnd Bergmann
  2023-11-16 11:53   ` [PULL] " Uwe Kleine-König
  2 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2023-11-10  6:32 UTC (permalink / raw)
  To: Uwe Kleine-König, Jay Fang, Rob Herring, Jernej Skrabec,
	Laurentiu Tudor, Tony Lindgren, Sicelo A. Mhlongo, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Greg Kroah-Hartman, Liu Ying,
	Geert Uytterhoeven, Luis Chamberlain, Nick Alcock, Chen-Yu Tsai,
	Samuel Holland, Hans de Goede, Yangtao Li, Yuan Can,
	Thierry Reding, Jon Hunter
  Cc: linux-kernel, Pengutronix Kernel Team, linux-arm-msm,
	linux-arm-kernel, linux-sunxi, linux-tegra, Linux-OMAP

On Thu, Nov 9, 2023, at 21:28, Uwe Kleine-König wrote:
> Hello,
>
> this series converts all drivers below drivers/bus 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.
>
> drivers/bus/fsl-mc was already addressed earlier with a separate
> series[1].
>
> All conversations are trivial, because all .remove() callbacks returned
> zero unconditionally.
>
> Some of the drivers touched here don't have a maintainer and there is no
> maintainer for all of drivers/bus. It would be great if someone could pick up
> the whole series, maybe Arnd might do that?

Sure, please send a pull request to soc@kernel.org if there
are no further comments.

      Arnd

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

* Re: [PATCH 06/12] bus: sun50i-de2: Convert to platform remove callback returning void
  2023-11-09 20:28 ` [PATCH 06/12] bus: sun50i-de2: " Uwe Kleine-König
@ 2023-11-10 10:18   ` Andre Przywara
  2023-11-18 21:50   ` Jernej Škrabec
  1 sibling, 0 replies; 10+ messages in thread
From: Andre Przywara @ 2023-11-10 10:18 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Arnd Bergmann, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	linux-arm-kernel, linux-sunxi, linux-kernel, kernel

On Thu,  9 Nov 2023 21:28:36 +0100
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

Hi,

> 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: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  drivers/bus/sun50i-de2.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/bus/sun50i-de2.c b/drivers/bus/sun50i-de2.c
> index 414f29cdedf0..3339311ce068 100644
> --- a/drivers/bus/sun50i-de2.c
> +++ b/drivers/bus/sun50i-de2.c
> @@ -24,10 +24,9 @@ static int sun50i_de2_bus_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int sun50i_de2_bus_remove(struct platform_device *pdev)
> +static void sun50i_de2_bus_remove(struct platform_device *pdev)
>  {
>  	sunxi_sram_release(&pdev->dev);
> -	return 0;
>  }
>  
>  static const struct of_device_id sun50i_de2_bus_of_match[] = {
> @@ -37,7 +36,7 @@ static const struct of_device_id sun50i_de2_bus_of_match[] = {
>  
>  static struct platform_driver sun50i_de2_bus_driver = {
>  	.probe = sun50i_de2_bus_probe,
> -	.remove = sun50i_de2_bus_remove,
> +	.remove_new = sun50i_de2_bus_remove,
>  	.driver = {
>  		.name = "sun50i-de2-bus",
>  		.of_match_table = sun50i_de2_bus_of_match,


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

* Re: [PATCH 07/12] bus: sunxi-rsb: Convert to platform remove callback returning void
  2023-11-09 20:28 ` [PATCH 07/12] bus: sunxi-rsb: " Uwe Kleine-König
@ 2023-11-10 10:20   ` Andre Przywara
  2023-11-18 21:51   ` Jernej Škrabec
  1 sibling, 0 replies; 10+ messages in thread
From: Andre Przywara @ 2023-11-10 10:20 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Arnd Bergmann, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Greg Kroah-Hartman, Hans de Goede, Laurentiu Tudor, Rob Herring,
	Yangtao Li, Yuan Can, linux-arm-kernel, linux-sunxi, linux-kernel,
	kernel

On Thu,  9 Nov 2023 21:28:37 +0100
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: Andre Przywara <andre.przywara@arm.com>

Thanks,
Andre

> ---
>  drivers/bus/sunxi-rsb.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
> index db0ed4e5d315..fd3e9d82340a 100644
> --- a/drivers/bus/sunxi-rsb.c
> +++ b/drivers/bus/sunxi-rsb.c
> @@ -817,15 +817,13 @@ static int sunxi_rsb_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int sunxi_rsb_remove(struct platform_device *pdev)
> +static void sunxi_rsb_remove(struct platform_device *pdev)
>  {
>  	struct sunxi_rsb *rsb = platform_get_drvdata(pdev);
>  
>  	device_for_each_child(rsb->dev, NULL, sunxi_rsb_remove_devices);
>  	pm_runtime_disable(&pdev->dev);
>  	sunxi_rsb_hw_exit(rsb);
> -
> -	return 0;
>  }
>  
>  static const struct dev_pm_ops sunxi_rsb_dev_pm_ops = {
> @@ -842,7 +840,7 @@ MODULE_DEVICE_TABLE(of, sunxi_rsb_of_match_table);
>  
>  static struct platform_driver sunxi_rsb_driver = {
>  	.probe = sunxi_rsb_probe,
> -	.remove	= sunxi_rsb_remove,
> +	.remove_new = sunxi_rsb_remove,
>  	.driver	= {
>  		.name = RSB_CTRL_NAME,
>  		.of_match_table = sunxi_rsb_of_match_table,


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

* [PULL] bus: Convert to platform remove callback returning void
  2023-11-10  6:32 ` [PATCH 00/12] bus: " Arnd Bergmann
@ 2023-11-16 11:53   ` Uwe Kleine-König
  2023-11-28 17:49     ` [PULL v2] " Uwe Kleine-König
  0 siblings, 1 reply; 10+ messages in thread
From: Uwe Kleine-König @ 2023-11-16 11:53 UTC (permalink / raw)
  To: Arnd Bergmann, soc
  Cc: Jay Fang, Rob Herring, Jernej Skrabec, Laurentiu Tudor,
	Tony Lindgren, Sicelo A. Mhlongo, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Greg Kroah-Hartman, Liu Ying, Geert Uytterhoeven,
	Luis Chamberlain, Nick Alcock, Chen-Yu Tsai, Samuel Holland,
	Hans de Goede, Yangtao Li, Yuan Can, Thierry Reding, Jon Hunter,
	linux-arm-msm, linux-kernel, Pengutronix Kernel Team, linux-tegra,
	Linux-OMAP, linux-sunxi, linux-arm-kernel

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

Hello Arnd,

On Fri, Nov 10, 2023 at 07:32:01AM +0100, Arnd Bergmann wrote:
> On Thu, Nov 9, 2023, at 21:28, Uwe Kleine-König wrote:
> > this series converts all drivers below drivers/bus 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.
> >
> > drivers/bus/fsl-mc was already addressed earlier with a separate
> > series[1].
> >
> > All conversations are trivial, because all .remove() callbacks returned
> > zero unconditionally.
> >
> > Some of the drivers touched here don't have a maintainer and there is no
> > maintainer for all of drivers/bus. It would be great if someone could pick up
> > the whole series, maybe Arnd might do that?
> 
> Sure, please send a pull request to soc@kernel.org if there
> are no further comments.

here it comes:

The following changes since commit b85ea95d086471afb4ad062012a4d73cd328fa86:

  Linux 6.7-rc1 (2023-11-12 16:19:07 -0800)

are available in the Git repository at:

  https://git.pengutronix.de/git/ukl/linux tags/bus-platform-remove-void

for you to fetch changes up to 7d6da8800a35d2257ff8b4b7d7c4551978f0a71a:

  bus: ts-nbus: Convert to platform remove callback returning void (2023-11-16 12:43:57 +0100)

----------------------------------------------------------------
This series converts all drivers below drivers/bus 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.

After the initial simplification in commit 864acca58000 ("bus: fsl-mc:
Drop if block with always false condition") all conversations are
trivial because the remove callbacks all return zero unconditionally.

----------------------------------------------------------------
Uwe Kleine-König (14):
      bus: fsl-mc: Drop if block with always false condition
      bus: fsl-mc: Convert to platform remove callback returning void
      bus: hisi_lpc: Convert to platform remove callback returning void
      bus: omap-ocp2scp: Convert to platform remove callback returning void
      bus: omap_l3_smx: Convert to platform remove callback returning void
      bus: qcom-ssc-block-bus: Convert to platform remove callback returning void
      bus: simple-pm-bus: Convert to platform remove callback returning void
      bus: sun50i-de2: Convert to platform remove callback returning void
      bus: sunxi-rsb: Convert to platform remove callback returning void
      bus: tegra-aconnect: Convert to platform remove callback returning void
      bus: tegra-gmi: Convert to platform remove callback returning void
      bus: ti-pwmss: Convert to platform remove callback returning void
      bus: ti-sysc: Convert to platform remove callback returning void
      bus: ts-nbus: Convert to platform remove callback returning void

 drivers/bus/fsl-mc/fsl-mc-bus.c  | 16 +++-------------
 drivers/bus/hisi_lpc.c           |  6 ++----
 drivers/bus/omap-ocp2scp.c       |  6 ++----
 drivers/bus/omap_l3_smx.c        |  6 ++----
 drivers/bus/qcom-ssc-block-bus.c |  6 ++----
 drivers/bus/simple-pm-bus.c      |  7 +++----
 drivers/bus/sun50i-de2.c         |  5 ++---
 drivers/bus/sunxi-rsb.c          |  6 ++----
 drivers/bus/tegra-aconnect.c     |  6 ++----
 drivers/bus/tegra-gmi.c          |  6 ++----
 drivers/bus/ti-pwmss.c           |  5 ++---
 drivers/bus/ti-sysc.c            |  6 ++----
 drivers/bus/ts-nbus.c            |  6 ++----
 13 files changed, 28 insertions(+), 59 deletions(-)

Thanks for considering these changes,
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

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

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

* Re: [PATCH 06/12] bus: sun50i-de2: Convert to platform remove callback returning void
  2023-11-09 20:28 ` [PATCH 06/12] bus: sun50i-de2: " Uwe Kleine-König
  2023-11-10 10:18   ` Andre Przywara
@ 2023-11-18 21:50   ` Jernej Škrabec
  1 sibling, 0 replies; 10+ messages in thread
From: Jernej Škrabec @ 2023-11-18 21:50 UTC (permalink / raw)
  To: Arnd Bergmann, Chen-Yu Tsai, Samuel Holland,
	Uwe Kleine-König
  Cc: linux-arm-kernel, linux-sunxi, linux-kernel, kernel

Dne četrtek, 09. november 2023 ob 21:28:36 CET je Uwe Kleine-König napisal(a):
> 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: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

> ---
>  drivers/bus/sun50i-de2.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/bus/sun50i-de2.c b/drivers/bus/sun50i-de2.c
> index 414f29cdedf0..3339311ce068 100644
> --- a/drivers/bus/sun50i-de2.c
> +++ b/drivers/bus/sun50i-de2.c
> @@ -24,10 +24,9 @@ static int sun50i_de2_bus_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int sun50i_de2_bus_remove(struct platform_device *pdev)
> +static void sun50i_de2_bus_remove(struct platform_device *pdev)
>  {
>  	sunxi_sram_release(&pdev->dev);
> -	return 0;
>  }
>  
>  static const struct of_device_id sun50i_de2_bus_of_match[] = {
> @@ -37,7 +36,7 @@ static const struct of_device_id sun50i_de2_bus_of_match[] = {
>  
>  static struct platform_driver sun50i_de2_bus_driver = {
>  	.probe = sun50i_de2_bus_probe,
> -	.remove = sun50i_de2_bus_remove,
> +	.remove_new = sun50i_de2_bus_remove,
>  	.driver = {
>  		.name = "sun50i-de2-bus",
>  		.of_match_table = sun50i_de2_bus_of_match,
> 





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

* Re: [PATCH 07/12] bus: sunxi-rsb: Convert to platform remove callback returning void
  2023-11-09 20:28 ` [PATCH 07/12] bus: sunxi-rsb: " Uwe Kleine-König
  2023-11-10 10:20   ` Andre Przywara
@ 2023-11-18 21:51   ` Jernej Škrabec
  1 sibling, 0 replies; 10+ messages in thread
From: Jernej Škrabec @ 2023-11-18 21:51 UTC (permalink / raw)
  To: Arnd Bergmann, Chen-Yu Tsai, Samuel Holland, Greg Kroah-Hartman,
	Hans de Goede, Laurentiu Tudor, Rob Herring, Yangtao Li, Yuan Can,
	Uwe Kleine-König
  Cc: linux-arm-kernel, linux-sunxi, linux-kernel, kernel

Dne četrtek, 09. november 2023 ob 21:28:37 CET je Uwe Kleine-König napisal(a):
> 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: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

> ---
>  drivers/bus/sunxi-rsb.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
> index db0ed4e5d315..fd3e9d82340a 100644
> --- a/drivers/bus/sunxi-rsb.c
> +++ b/drivers/bus/sunxi-rsb.c
> @@ -817,15 +817,13 @@ static int sunxi_rsb_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int sunxi_rsb_remove(struct platform_device *pdev)
> +static void sunxi_rsb_remove(struct platform_device *pdev)
>  {
>  	struct sunxi_rsb *rsb = platform_get_drvdata(pdev);
>  
>  	device_for_each_child(rsb->dev, NULL, sunxi_rsb_remove_devices);
>  	pm_runtime_disable(&pdev->dev);
>  	sunxi_rsb_hw_exit(rsb);
> -
> -	return 0;
>  }
>  
>  static const struct dev_pm_ops sunxi_rsb_dev_pm_ops = {
> @@ -842,7 +840,7 @@ MODULE_DEVICE_TABLE(of, sunxi_rsb_of_match_table);
>  
>  static struct platform_driver sunxi_rsb_driver = {
>  	.probe = sunxi_rsb_probe,
> -	.remove	= sunxi_rsb_remove,
> +	.remove_new = sunxi_rsb_remove,
>  	.driver	= {
>  		.name = RSB_CTRL_NAME,
>  		.of_match_table = sunxi_rsb_of_match_table,
> 





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

* [PULL v2] bus: Convert to platform remove callback returning void
  2023-11-16 11:53   ` [PULL] " Uwe Kleine-König
@ 2023-11-28 17:49     ` Uwe Kleine-König
  0 siblings, 0 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2023-11-28 17:49 UTC (permalink / raw)
  To: Arnd Bergmann, soc
  Cc: Geert Uytterhoeven, Tony Lindgren, Yuan Can, Thierry Reding,
	Rob Herring, Samuel Holland, Jernej Skrabec, Jon Hunter,
	Chen-Yu Tsai, Andy Gross, linux-sunxi, Nick Alcock, Yangtao Li,
	Liu Ying, linux-arm-msm, Jay Fang, Hans de Goede, linux-tegra,
	Linux-OMAP, linux-arm-kernel, Laurentiu Tudor, Sicelo A. Mhlongo,
	Greg Kroah-Hartman, Bjorn Andersson, linux-kernel, Konrad Dybcio,
	Luis Chamberlain, Pengutronix Kernel Team

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

Hello Arnd,

On Thu, Nov 16, 2023 at 12:53:07PM +0100, Uwe Kleine-König wrote:
> On Fri, Nov 10, 2023 at 07:32:01AM +0100, Arnd Bergmann wrote:
> > On Thu, Nov 9, 2023, at 21:28, Uwe Kleine-König wrote:
> > > this series converts all drivers below drivers/bus 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.
> > >
> > > drivers/bus/fsl-mc was already addressed earlier with a separate
> > > series[1].
> > >
> > > All conversations are trivial, because all .remove() callbacks returned
> > > zero unconditionally.
> > >
> > > Some of the drivers touched here don't have a maintainer and there is no
> > > maintainer for all of drivers/bus. It would be great if someone could pick up
> > > the whole series, maybe Arnd might do that?
> > 
> > Sure, please send a pull request to soc@kernel.org if there
> > are no further comments.
> 
> here it comes:
> 
> The following changes since commit b85ea95d086471afb4ad062012a4d73cd328fa86:
> 
>   Linux 6.7-rc1 (2023-11-12 16:19:07 -0800)

Here comes an updated PR. The only change is that it also includes two
Reviewed-by tags for Jernej Skrabec that came in after I sent the PR.
Obviously that changed the commit hash which made it necessary to redo
the PR. I hope it doesn't disturb your tooling that there are now two
similar pull requests.

Best regards
Uwe

The following changes since commit b85ea95d086471afb4ad062012a4d73cd328fa86:

  Linux 6.7-rc1 (2023-11-12 16:19:07 -0800)

are available in the Git repository at:

  https://git.pengutronix.de/git/ukl/linux tags/bus-platform-remove-void

for you to fetch changes up to fc540426f7baa0c7d4b477e80435d075659092a2:

  bus: ts-nbus: Convert to platform remove callback returning void (2023-11-28 18:43:27 +0100)

----------------------------------------------------------------
This series converts all drivers below drivers/bus 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.

After the initial simplification in commit 864acca58000 ("bus: fsl-mc:
Drop if block with always false condition") all conversations are
trivial because the remove callbacks all return zero unconditionally.

----------------------------------------------------------------
Uwe Kleine-König (14):
      bus: fsl-mc: Drop if block with always false condition
      bus: fsl-mc: Convert to platform remove callback returning void
      bus: hisi_lpc: Convert to platform remove callback returning void
      bus: omap-ocp2scp: Convert to platform remove callback returning void
      bus: omap_l3_smx: Convert to platform remove callback returning void
      bus: qcom-ssc-block-bus: Convert to platform remove callback returning void
      bus: simple-pm-bus: Convert to platform remove callback returning void
      bus: sun50i-de2: Convert to platform remove callback returning void
      bus: sunxi-rsb: Convert to platform remove callback returning void
      bus: tegra-aconnect: Convert to platform remove callback returning void
      bus: tegra-gmi: Convert to platform remove callback returning void
      bus: ti-pwmss: Convert to platform remove callback returning void
      bus: ti-sysc: Convert to platform remove callback returning void
      bus: ts-nbus: Convert to platform remove callback returning void

 drivers/bus/fsl-mc/fsl-mc-bus.c  | 16 +++-------------
 drivers/bus/hisi_lpc.c           |  6 ++----
 drivers/bus/omap-ocp2scp.c       |  6 ++----
 drivers/bus/omap_l3_smx.c        |  6 ++----
 drivers/bus/qcom-ssc-block-bus.c |  6 ++----
 drivers/bus/simple-pm-bus.c      |  7 +++----
 drivers/bus/sun50i-de2.c         |  5 ++---
 drivers/bus/sunxi-rsb.c          |  6 ++----
 drivers/bus/tegra-aconnect.c     |  6 ++----
 drivers/bus/tegra-gmi.c          |  6 ++----
 drivers/bus/ti-pwmss.c           |  5 ++---
 drivers/bus/ti-sysc.c            |  6 ++----
 drivers/bus/ts-nbus.c            |  6 ++----
 13 files changed, 28 insertions(+), 59 deletions(-)


-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

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

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

end of thread, other threads:[~2023-11-28 17:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 20:28 [PATCH 00/12] bus: Convert to platform remove callback returning void Uwe Kleine-König
2023-11-09 20:28 ` [PATCH 06/12] bus: sun50i-de2: " Uwe Kleine-König
2023-11-10 10:18   ` Andre Przywara
2023-11-18 21:50   ` Jernej Škrabec
2023-11-09 20:28 ` [PATCH 07/12] bus: sunxi-rsb: " Uwe Kleine-König
2023-11-10 10:20   ` Andre Przywara
2023-11-18 21:51   ` Jernej Škrabec
2023-11-10  6:32 ` [PATCH 00/12] bus: " Arnd Bergmann
2023-11-16 11:53   ` [PULL] " Uwe Kleine-König
2023-11-28 17:49     ` [PULL v2] " Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox