diff mbox series

[net-next,54/54] net: ethernet: xscale: Convert to platform remove callback returning void

Message ID 20230918204227.1316886-55-u.kleine-koenig@pengutronix.de (mailing list archive)
State Accepted
Commit d74a5c154b6fab303023e46e7cc1b14c3f3cabd9
Delegated to: Netdev Maintainers
Headers show
Series net: ethernet: Convert to platform remove callback returning void | expand

Checks

Context Check Description
netdev/series_format fail Series longer than 15 patches (and no cover letter)
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Uwe Kleine-König Sept. 18, 2023, 8:42 p.m. UTC
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/ethernet/xscale/ixp4xx_eth.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Krzysztof Hałasa Sept. 20, 2023, 7:52 a.m. UTC | #1
Hello Uwe, Linus,

Uwe Kleine-König <u.kleine-koenig@pengutronix.de> writes:

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

This makes perfect sense of course.

BTW, Linus, this is a separate entry in MAINTAINERS (INTEL IXP4XX QMGR,
NPE, ETHERNET and HSS SUPPORT). Perhaps you'd want it as well?
While I still have access to IXP425 and IXP435 hw, I haven't (literally)
touched them in years, so I guess there is very little reason (or rather
none at all) for me to linger as a maintainer of anything related to
IPX4xx anymore. If you wish, I can prepare a MAINTAINERS patch, or
something.

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Krzysztof Hałasa <khalasa@piap.pl>

> ---
>  drivers/net/ethernet/xscale/ixp4xx_eth.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
Linus Walleij Sept. 20, 2023, 9:20 a.m. UTC | #2
On Wed, Sep 20, 2023 at 9:52 AM Krzysztof Hałasa <khalasa@piap.pl> wrote:

> BTW, Linus, this is a separate entry in MAINTAINERS (INTEL IXP4XX QMGR,
> NPE, ETHERNET and HSS SUPPORT). Perhaps you'd want it as well?

Indeed I guess I should move it all under the IXP4xx platform
simply.

Also Deepak is still listed as maintainer of the RNG
which is inside the NPE, I think he has basically retired
from maintenance as well because I think he mentioned that
he got rid of his IXP4xx hardware.

> While I still have access to IXP425 and IXP435 hw,

Are they supported by the DTS files I created?

> I haven't (literally)
> touched them in years, so I guess there is very little reason (or rather
> none at all) for me to linger as a maintainer of anything related to
> IPX4xx anymore. If you wish, I can prepare a MAINTAINERS patch, or
> something.

Could you group the network and the RNG (which is just below it
in MAINTAINERS) under the architecture (where you are BTW
still listed).

The devices mostly "just work" now though so if you touch them
I bet they will come online nicely. This fork of OpenWrt has all
that's needed to bring up devices:
https://github.com/linusw/openwrt/commits/ixp4xx-v6.1

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 3b0c5f177447..b242aa61d8ab 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1533,7 +1533,7 @@  static int ixp4xx_eth_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int ixp4xx_eth_remove(struct platform_device *pdev)
+static void ixp4xx_eth_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct phy_device *phydev = ndev->phydev;
@@ -1544,7 +1544,6 @@  static int ixp4xx_eth_remove(struct platform_device *pdev)
 	ixp4xx_mdio_remove();
 	npe_port_tab[NPE_ID(port->id)] = NULL;
 	npe_release(port->npe);
-	return 0;
 }
 
 static const struct of_device_id ixp4xx_eth_of_match[] = {
@@ -1560,7 +1559,7 @@  static struct platform_driver ixp4xx_eth_driver = {
 		.of_match_table = of_match_ptr(ixp4xx_eth_of_match),
 	},
 	.probe		= ixp4xx_eth_probe,
-	.remove		= ixp4xx_eth_remove,
+	.remove_new	= ixp4xx_eth_remove,
 };
 module_platform_driver(ixp4xx_eth_driver);