linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/9] net: dsa: Convert to platform remove callback returning void
@ 2023-09-18 19:19 Uwe Kleine-König
  2023-09-18 19:19 ` [PATCH net-next 5/9] net: dsa: mt7530: " Uwe Kleine-König
  2023-09-20  9:30 ` [PATCH net-next 0/9] net: dsa: " patchwork-bot+netdevbpf
  0 siblings, 2 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 19:19 UTC (permalink / raw)
  To: Florian Fainelli, Andrew Lunn, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Kurt Kanzenbach,
	Florian Fainelli, Hauke Mehrtens, Arınç ÜNAL,
	Daniel Golle, Landen Chao, DENG Qingfang, Sean Wang,
	Matthias Brugger, Colin Foster, Vladimir Oltean, Claudiu Manoil,
	Alexandre Belloni, UNGLinuxDriver, Linus Walleij,
	Alvin Šipraga, Clément Léger
  Cc: netdev, kernel, AngeloGioacchino Del Regno, linux-arm-kernel,
	linux-mediatek, linux-renesas-soc

Hello,

this series converts all platform drivers below drivers/net/dsa 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 (9):
  net: dsa: b53: Convert to platform remove callback returning void
  net: dsa: bcm_sf2: Convert to platform remove callback returning void
  net: dsa: hirschmann: Convert to platform remove callback returning
    void
  net: dsa: lantiq_gswip: Convert to platform remove callback returning
    void
  net: dsa: mt7530: Convert to platform remove callback returning void
  net: dsa: ocelot: Convert to platform remove callback returning void
  net: dsa: realtek: Convert to platform remove callback returning void
  net: dsa: rzn1_a5psw: Convert to platform remove callback returning
    void
  net: dsa: vitesse-vsc73xx: Convert to platform remove callback
    returning void

 drivers/net/dsa/b53/b53_mmap.c             | 6 ++----
 drivers/net/dsa/b53/b53_srab.c             | 8 +++-----
 drivers/net/dsa/bcm_sf2.c                  | 8 +++-----
 drivers/net/dsa/hirschmann/hellcreek.c     | 8 +++-----
 drivers/net/dsa/lantiq_gswip.c             | 8 +++-----
 drivers/net/dsa/mt7530-mmio.c              | 7 ++-----
 drivers/net/dsa/ocelot/ocelot_ext.c        | 8 +++-----
 drivers/net/dsa/ocelot/seville_vsc9953.c   | 8 +++-----
 drivers/net/dsa/realtek/realtek-smi.c      | 8 +++-----
 drivers/net/dsa/rzn1_a5psw.c               | 8 +++-----
 drivers/net/dsa/vitesse-vsc73xx-platform.c | 8 +++-----
 11 files changed, 31 insertions(+), 54 deletions(-)

base-commit: 7fc7222d9680366edeecc219c21ca96310bdbc10
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next 5/9] net: dsa: mt7530: Convert to platform remove callback returning void
  2023-09-18 19:19 [PATCH net-next 0/9] net: dsa: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-09-18 19:19 ` Uwe Kleine-König
  2023-09-18 20:27   ` Andrew Lunn
                     ` (2 more replies)
  2023-09-20  9:30 ` [PATCH net-next 0/9] net: dsa: " patchwork-bot+netdevbpf
  1 sibling, 3 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 19:19 UTC (permalink / raw)
  To: Arınç ÜNAL, Daniel Golle, Landen Chao,
	DENG Qingfang, Sean Wang, Andrew Lunn, Florian Fainelli,
	Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Matthias Brugger
  Cc: AngeloGioacchino Del Regno, netdev, kernel, linux-arm-kernel,
	linux-mediatek

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() is 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/net/dsa/mt7530-mmio.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dsa/mt7530-mmio.c b/drivers/net/dsa/mt7530-mmio.c
index 0a6a2fe34e64..b74a230a3f13 100644
--- a/drivers/net/dsa/mt7530-mmio.c
+++ b/drivers/net/dsa/mt7530-mmio.c
@@ -63,15 +63,12 @@ mt7988_probe(struct platform_device *pdev)
 	return dsa_register_switch(priv->ds);
 }
 
-static int
-mt7988_remove(struct platform_device *pdev)
+static void mt7988_remove(struct platform_device *pdev)
 {
 	struct mt7530_priv *priv = platform_get_drvdata(pdev);
 
 	if (priv)
 		mt7530_remove_common(priv);
-
-	return 0;
 }
 
 static void mt7988_shutdown(struct platform_device *pdev)
@@ -88,7 +85,7 @@ static void mt7988_shutdown(struct platform_device *pdev)
 
 static struct platform_driver mt7988_platform_driver = {
 	.probe  = mt7988_probe,
-	.remove = mt7988_remove,
+	.remove_new = mt7988_remove,
 	.shutdown = mt7988_shutdown,
 	.driver = {
 		.name = "mt7530-mmio",
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 5/9] net: dsa: mt7530: Convert to platform remove callback returning void
  2023-09-18 19:19 ` [PATCH net-next 5/9] net: dsa: mt7530: " Uwe Kleine-König
@ 2023-09-18 20:27   ` Andrew Lunn
  2023-09-18 20:52   ` Florian Fainelli
  2023-09-19  8:14   ` Daniel Golle
  2 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2023-09-18 20:27 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Arınç ÜNAL, Daniel Golle, Landen Chao,
	DENG Qingfang, Sean Wang, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, AngeloGioacchino Del Regno, netdev, kernel,
	linux-arm-kernel, linux-mediatek

On Mon, Sep 18, 2023 at 09:19:12PM +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() is 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: Andrew Lunn <andrew@lunn.ch>

    Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 5/9] net: dsa: mt7530: Convert to platform remove callback returning void
  2023-09-18 19:19 ` [PATCH net-next 5/9] net: dsa: mt7530: " Uwe Kleine-König
  2023-09-18 20:27   ` Andrew Lunn
@ 2023-09-18 20:52   ` Florian Fainelli
  2023-09-19  8:14   ` Daniel Golle
  2 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2023-09-18 20:52 UTC (permalink / raw)
  To: Uwe Kleine-König, Arınç ÜNAL, Daniel Golle,
	Landen Chao, DENG Qingfang, Sean Wang, Andrew Lunn,
	Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Matthias Brugger
  Cc: AngeloGioacchino Del Regno, netdev, kernel, linux-arm-kernel,
	linux-mediatek

On 9/18/23 12:19, 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() is 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: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 5/9] net: dsa: mt7530: Convert to platform remove callback returning void
  2023-09-18 19:19 ` [PATCH net-next 5/9] net: dsa: mt7530: " Uwe Kleine-König
  2023-09-18 20:27   ` Andrew Lunn
  2023-09-18 20:52   ` Florian Fainelli
@ 2023-09-19  8:14   ` Daniel Golle
  2 siblings, 0 replies; 6+ messages in thread
From: Daniel Golle @ 2023-09-19  8:14 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Arınç ÜNAL, Landen Chao, DENG Qingfang, Sean Wang,
	Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
	AngeloGioacchino Del Regno, netdev, kernel, linux-arm-kernel,
	linux-mediatek

On Mon, Sep 18, 2023 at 09:19:12PM +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() is 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>

Acked-by: Daniel Golle <daniel@makrotopia.org>

> ---
>  drivers/net/dsa/mt7530-mmio.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/dsa/mt7530-mmio.c b/drivers/net/dsa/mt7530-mmio.c
> index 0a6a2fe34e64..b74a230a3f13 100644
> --- a/drivers/net/dsa/mt7530-mmio.c
> +++ b/drivers/net/dsa/mt7530-mmio.c
> @@ -63,15 +63,12 @@ mt7988_probe(struct platform_device *pdev)
>  	return dsa_register_switch(priv->ds);
>  }
>  
> -static int
> -mt7988_remove(struct platform_device *pdev)
> +static void mt7988_remove(struct platform_device *pdev)
>  {
>  	struct mt7530_priv *priv = platform_get_drvdata(pdev);
>  
>  	if (priv)
>  		mt7530_remove_common(priv);
> -
> -	return 0;
>  }
>  
>  static void mt7988_shutdown(struct platform_device *pdev)
> @@ -88,7 +85,7 @@ static void mt7988_shutdown(struct platform_device *pdev)
>  
>  static struct platform_driver mt7988_platform_driver = {
>  	.probe  = mt7988_probe,
> -	.remove = mt7988_remove,
> +	.remove_new = mt7988_remove,
>  	.shutdown = mt7988_shutdown,
>  	.driver = {
>  		.name = "mt7530-mmio",
> -- 
> 2.40.1
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 0/9] net: dsa: Convert to platform remove callback returning void
  2023-09-18 19:19 [PATCH net-next 0/9] net: dsa: Convert to platform remove callback returning void Uwe Kleine-König
  2023-09-18 19:19 ` [PATCH net-next 5/9] net: dsa: mt7530: " Uwe Kleine-König
@ 2023-09-20  9:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-20  9:30 UTC (permalink / raw)
  To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
  Cc: florian.fainelli, andrew, olteanv, davem, edumazet, kuba, pabeni,
	kurt, f.fainelli, hauke, arinc.unal, daniel, Landen.Chao, dqfext,
	sean.wang, matthias.bgg, colin.foster, vladimir.oltean,
	claudiu.manoil, alexandre.belloni, UNGLinuxDriver, linus.walleij,
	alsi, clement.leger, netdev, kernel, angelogioacchino.delregno,
	linux-arm-kernel, linux-mediatek, linux-renesas-soc

Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Mon, 18 Sep 2023 21:19:07 +0200 you wrote:
> Hello,
> 
> this series converts all platform drivers below drivers/net/dsa 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.
> 
> [...]

Here is the summary with links:
  - [net-next,1/9] net: dsa: b53: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/c306171d6914
  - [net-next,2/9] net: dsa: bcm_sf2: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/75f5205f1dd8
  - [net-next,3/9] net: dsa: hirschmann: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/beb8592d0416
  - [net-next,4/9] net: dsa: lantiq_gswip: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/a59f960c4d10
  - [net-next,5/9] net: dsa: mt7530: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/9764bbad3d33
  - [net-next,6/9] net: dsa: ocelot: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/68ace16ce330
  - [net-next,7/9] net: dsa: realtek: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/d48a5472b8f2
  - [net-next,8/9] net: dsa: rzn1_a5psw: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/76be075d7f99
  - [net-next,9/9] net: dsa: vitesse-vsc73xx: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/ce322d45683f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-09-20  9:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-18 19:19 [PATCH net-next 0/9] net: dsa: Convert to platform remove callback returning void Uwe Kleine-König
2023-09-18 19:19 ` [PATCH net-next 5/9] net: dsa: mt7530: " Uwe Kleine-König
2023-09-18 20:27   ` Andrew Lunn
2023-09-18 20:52   ` Florian Fainelli
2023-09-19  8:14   ` Daniel Golle
2023-09-20  9:30 ` [PATCH net-next 0/9] net: dsa: " patchwork-bot+netdevbpf

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).