net: stmmac: Convert to platform remove callback returning void
Subsystems (15)
v2 cover net: stmmac: Convert to platform remove callback returning void
Hello,
(implicit) v1 of this series is available at
https://lore.kernel.org/netdev/[email protected]
.
Changes since then:
- Added various Reviewed-by: and Acked-by: tags received for v1
- Removed a variable in an earlier patch to make all intermediate steps compilable, spotted by Simon Horman
- Rebased to v6.4-rc1 (which needed a slight adaption to cope for 4bd3bb7b4526 ("net: stmmac: Add glue layer for StarFive JH7110 SoC"))
Best regards
Uwe
Uwe Kleine-König (11):
net: stmmac: Make stmmac_pltfr_remove() return void
net: stmmac: dwmac-visconti: Make visconti_eth_clock_remove() return
void
net: stmmac: dwmac-qcom-ethqos: Drop an if with an always false
condition
net: stmmac: dwmac-visconti: Convert to platform remove callback
returning void
net: stmmac: dwmac-dwc-qos-eth: Convert to platform remove callback
returning void
net: stmmac: dwmac-qcom-ethqos: Convert to platform remove callback
returning void
net: stmmac: dwmac-rk: Convert to platform remove callback returning
void
net: stmmac: dwmac-sti: Convert to platform remove callback returning
void
net: stmmac: dwmac-stm32: Convert to platform remove callback
returning void
net: stmmac: dwmac-sun8i: Convert to platform remove callback
returning void
net: stmmac: dwmac-tegra: Convert to platform remove callback
returning void
.../ethernet/stmicro/stmmac/dwmac-anarion.c | 2 +- .../stmicro/stmmac/dwmac-dwc-qos-eth.c | 6 ++---- .../ethernet/stmicro/stmmac/dwmac-generic.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-ingenic.c | 2 +- .../stmicro/stmmac/dwmac-intel-plat.c | 9 +++------ .../ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-lpc18xx.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-mediatek.c | 9 +++------ .../net/ethernet/stmicro/stmmac/dwmac-meson.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-oxnas.c | 2 +- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 15 ++++----------- .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 6 ++---- .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-starfive.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-sti.c | 6 ++---- .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 6 ++---- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 6 ++---- .../net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-tegra.c | 6 ++---- .../ethernet/stmicro/stmmac/dwmac-visconti.c | 19 +++++-------------- .../ethernet/stmicro/stmmac/stmmac_platform.c | 4 +--- .../ethernet/stmicro/stmmac/stmmac_platform.h | 2 +- 24 files changed, 41 insertions(+), 77 deletions(-)
base-commit: ac9a78681b921877518763ba0e89202254349d1b
Signature · 1 line
2.39.2
PATCH v2 1/11 net: stmmac: Make stmmac_pltfr_remove() return void
The function returns zero unconditionally. Change it to return void instead which simplifies some callers as error handing becomes unnecessary.
The function is also used for some drivers as remove callback. Switch these to the .remove_new() callback. For some others no error can happen in the remove callback now, convert them to .remove_new(), too.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 9 +++------ drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c | 9 +++------ drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 5 ++--- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c | 4 +--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 +--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h | 2 +- 18 files changed, 23 insertions(+), 34 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c +1 -1
@@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(of, anarion_dwmac_match);static struct platform_driver anarion_dwmac_driver = { .probe = anarion_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="anarion-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c +1 -1
@@ -87,7 +87,7 @@ MODULE_DEVICE_TABLE(of, dwmac_generic_match);static struct platform_driver dwmac_generic_driver = { .probe = dwmac_generic_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name =STMMAC_RESOURCE_NAME , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +1 -1
@@ -376,7 +376,7 @@ MODULE_DEVICE_TABLE(of, imx_dwmac_match);static struct platform_driver imx_dwmac_driver = { .probe = imx_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="imx-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +1 -1
@@ -386,7 +386,7 @@ MODULE_DEVICE_TABLE(of, ingenic_mac_of_matches);static struct platform_driver ingenic_mac_driver = { .probe = ingenic_mac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="ingenic-mac" , .pm =pm_ptr (&ingenic_mac_pm_ops),
drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +3 -6
@@ -169,20 +169,17 @@ static int intel_eth_plat_probe(struct platform_device *pdev)return ret; } -static int intel_eth_plat_remove (struct platform_device *pdev) +static void intel_eth_plat_remove (struct platform_device *pdev) {struct intel_dwmac *dwmac =get_stmmac_bsp_priv (&pdev->dev); -int ret; - ret =stmmac_pltfr_remove (pdev); +stmmac_pltfr_remove (pdev);clk_disable_unprepare (dwmac->tx_clk); - -return ret; }static struct platform_driver intel_eth_plat_driver = { .probe = intel_eth_plat_probe, - .remove = intel_eth_plat_remove, + .remove_new = intel_eth_plat_remove, .driver = { .name ="intel-eth-plat" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +1 -1
@@ -498,7 +498,7 @@ MODULE_DEVICE_TABLE(of, ipq806x_gmac_dwmac_match);static struct platform_driver ipq806x_gmac_dwmac_driver = { .probe = ipq806x_gmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="ipq806x-gmac-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c +1 -1
@@ -83,7 +83,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_dwmac_match);static struct platform_driver lpc18xx_dwmac_driver = { .probe = lpc18xx_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="lpc18xx-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c +3 -6
@@ -678,15 +678,12 @@ static int mediatek_dwmac_probe(struct platform_device *pdev)return ret; } -static int mediatek_dwmac_remove (struct platform_device *pdev) +static void mediatek_dwmac_remove (struct platform_device *pdev) {struct mediatek_dwmac_plat_data *priv_plat =get_stmmac_bsp_priv (&pdev->dev); -int ret; - ret =stmmac_pltfr_remove (pdev); +stmmac_pltfr_remove (pdev);mediatek_dwmac_clks_config (priv_plat, false); - -return ret; }static const struct of_device_id mediatek_dwmac_match[] = {
@@ -701,7 +698,7 @@ MODULE_DEVICE_TABLE(of, mediatek_dwmac_match);static struct platform_driver mediatek_dwmac_driver = { .probe = mediatek_dwmac_probe, - .remove = mediatek_dwmac_remove, + .remove_new = mediatek_dwmac_remove, .driver = { .name ="dwmac-mediatek" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +1 -1
@@ -91,7 +91,7 @@ MODULE_DEVICE_TABLE(of, meson6_dwmac_match);static struct platform_driver meson6_dwmac_driver = { .probe = meson6_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="meson6-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +1 -1
@@ -539,7 +539,7 @@ MODULE_DEVICE_TABLE(of, meson8b_dwmac_match);static struct platform_driver meson8b_dwmac_driver = { .probe = meson8b_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="meson8b-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c +1 -1
@@ -231,7 +231,7 @@ MODULE_DEVICE_TABLE(of, oxnas_dwmac_match);static struct platform_driver oxnas_dwmac_driver = { .probe = oxnas_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="oxnas-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +2 -3
@@ -668,16 +668,15 @@ static int qcom_ethqos_probe(struct platform_device *pdev)static int qcom_ethqos_remove (struct platform_device *pdev) {struct qcom_ethqos *ethqos; -int ret; ethqos =get_stmmac_bsp_priv (&pdev->dev);if (!ethqos)return -ENODEV ; - ret =stmmac_pltfr_remove (pdev); +stmmac_pltfr_remove (pdev);ethqos_clks_config (ethqos, false); -return ret; +return 0 ; }static const struct of_device_id qcom_ethqos_match[] = {
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +1 -1
@@ -524,7 +524,7 @@ MODULE_DEVICE_TABLE(of, socfpga_dwmac_match);static struct platform_driver socfpga_dwmac_driver = { .probe = socfpga_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="socfpga-dwmac" , .pm = &socfpga_dwmac_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +1 -1
@@ -156,7 +156,7 @@ MODULE_DEVICE_TABLE(of, starfive_dwmac_match);static struct platform_driver starfive_dwmac_driver = { .probe = starfive_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="starfive-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +1 -1
@@ -179,7 +179,7 @@ MODULE_DEVICE_TABLE(of, sun7i_dwmac_match);static struct platform_driver sun7i_dwmac_driver = { .probe = sun7i_gmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="sun7i-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +1 -3
@@ -265,9 +265,7 @@ static int visconti_eth_dwmac_remove(struct platform_device *pdev)struct stmmac_priv *priv =netdev_priv (ndev);int err; - err =stmmac_pltfr_remove (pdev); -if (err <0 ) -dev_err (&pdev->dev,"failed to remove platform: %d\n" , err); +stmmac_pltfr_remove (pdev); err =visconti_eth_clock_remove (pdev);if (err <0 )
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -3
@@ -707,7 +707,7 @@ EXPORT_SYMBOL_GPL(stmmac_get_platform_resources);* Description: this function calls the main to free the net resources * and calls the platforms hook and release the resources (e.g. mem). */ -int stmmac_pltfr_remove (struct platform_device *pdev) +void stmmac_pltfr_remove (struct platform_device *pdev) {struct net_device *ndev =platform_get_drvdata (pdev);struct stmmac_priv *priv =netdev_priv (ndev);
@@ -719,8 +719,6 @@ int stmmac_pltfr_remove(struct platform_device *pdev) plat->exit (pdev, plat->bsp_priv);stmmac_remove_config_dt (pdev, plat); - -return 0 ; }EXPORT_SYMBOL_GPL (stmmac_pltfr_remove);
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +1 -1
@@ -19,7 +19,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev,int stmmac_get_platform_resources (struct platform_device *pdev,struct stmmac_resources *stmmac_res); -int stmmac_pltfr_remove (struct platform_device *pdev); +void stmmac_pltfr_remove (struct platform_device *pdev);extern const struct dev_pm_ops stmmac_pltfr_pm_ops;static inline void *get_stmmac_bsp_priv (struct device *dev)
Signature · 1 line
2.39.2
Peppe CAVALLARO
Acked-by Jernej Skrabec Reviewed-by Simon Horman Acked-by Martin Blumenstingl on v2 1/11RE: [PATCH net-next v2 01/11] net: stmmac: Make stmmac_pltfr_remove() return void
Hello
Thx for this patch train, maybe I missed the cover letter. In my opinion the proposed change is intrusive but I can accept. It could be great to enhance the platform remove functions to fail in case of an expected case occurs.
+ .remove_new = stmmac_pltfr_remove,
To be honest, I do not like to see: ".remove_new" as hook
Regards
peppe
ST Restricted
-----Original Message-----
From: Uwe Kleine-König <[email protected]>
Sent: Monday, May 8, 2023 4:26 PM
To: Peppe CAVALLARO <[email protected]>; Alexandre TORGUE - foss <[email protected]>; Jose Abreu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Vladimir Zapolskiy <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Emil Renner Berthing <[email protected]>; Samin Guo <[email protected]>; Chen-Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Matthias Brugger <[email protected]>
Cc: Fabio Estevam <[email protected]>; NXP Linux Team <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; AngeloGioacchino Del Regno <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Simon Horman <[email protected]>
Subject: [PATCH net-next v2 01/11] net: stmmac: Make stmmac_pltfr_remove() return void
The function returns zero unconditionally. Change it to return void instead which simplifies some callers as error handing becomes unnecessary.
The function is also used for some drivers as remove callback. Switch these to the .remove_new() callback. For some others no error can happen in the remove callback now, convert them to .remove_new(), too.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 9 +++------ drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c | 9 +++------ drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 5 ++--- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c | 4 +--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 +--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h | 2 +- 18 files changed, 23 insertions(+), 34 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c +1 -1
@@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(of, anarion_dwmac_match);static struct platform_driver anarion_dwmac_driver = { .probe = anarion_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="anarion-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c +1 -1
@@ -87,7 +87,7 @@ MODULE_DEVICE_TABLE(of, dwmac_generic_match);static struct platform_driver dwmac_generic_driver = { .probe = dwmac_generic_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name =STMMAC_RESOURCE_NAME , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +1 -1
@@ -376,7 +376,7 @@ MODULE_DEVICE_TABLE(of, imx_dwmac_match);static struct platform_driver imx_dwmac_driver = { .probe = imx_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="imx-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +1 -1
@@ -386,7 +386,7 @@ MODULE_DEVICE_TABLE(of, ingenic_mac_of_matches);static struct platform_driver ingenic_mac_driver = { .probe = ingenic_mac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="ingenic-mac" , .pm =pm_ptr (&ingenic_mac_pm_ops),
drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +3 -6
@@ -169,20 +169,17 @@ static int intel_eth_plat_probe(struct platform_device *pdev)return ret; } -static int intel_eth_plat_remove (struct platform_device *pdev) +static void intel_eth_plat_remove (struct platform_device *pdev) {struct intel_dwmac *dwmac =get_stmmac_bsp_priv (&pdev->dev); -int ret; - ret =stmmac_pltfr_remove (pdev); +stmmac_pltfr_remove (pdev);clk_disable_unprepare (dwmac->tx_clk); - -return ret; }static struct platform_driver intel_eth_plat_driver = { .probe = intel_eth_plat_probe, - .remove = intel_eth_plat_remove, + .remove_new = intel_eth_plat_remove, .driver = { .name ="intel-eth-plat" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +1 -1
@@ -498,7 +498,7 @@ MODULE_DEVICE_TABLE(of, ipq806x_gmac_dwmac_match);static struct platform_driver ipq806x_gmac_dwmac_driver = { .probe = ipq806x_gmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="ipq806x-gmac-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c +1 -1
@@ -83,7 +83,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_dwmac_match);static struct platform_driver lpc18xx_dwmac_driver = { .probe = lpc18xx_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="lpc18xx-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c +2 -5
@@ -678,15 +678,12 @@ static int mediatek_dwmac_probe(struct platform_device *pdev)return ret; } -static int mediatek_dwmac_remove (struct platform_device *pdev) +static void mediatek_dwmac_remove (struct platform_device *pdev) {struct mediatek_dwmac_plat_data *priv_plat =get_stmmac_bsp_priv (&pdev->dev); -int ret; - ret =stmmac_pltfr_remove (pdev); +stmmac_pltfr_remove (pdev);mediatek_dwmac_clks_config (priv_plat, false); - -return ret; } static const struct of_device_id mediatek_dwmac_match[] = { @@ -701,7 +698,7 @@ MODULE_DEVICE_TABLE(of, mediatek_dwmac_match);
static struct platform_driver mediatek_dwmac_driver = {
.probe = mediatek_dwmac_probe,
- .remove = mediatek_dwmac_remove,
+ .remove_new = mediatek_dwmac_remove,
.driver = {
.name = "dwmac-mediatek",
.pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +1 -1
@@ -91,7 +91,7 @@ MODULE_DEVICE_TABLE(of, meson6_dwmac_match);static struct platform_driver meson6_dwmac_driver = { .probe = meson6_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="meson6-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +1 -1
@@ -539,7 +539,7 @@ MODULE_DEVICE_TABLE(of, meson8b_dwmac_match);static struct platform_driver meson8b_dwmac_driver = { .probe = meson8b_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="meson8b-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c +1 -1
@@ -231,7 +231,7 @@ MODULE_DEVICE_TABLE(of, oxnas_dwmac_match);static struct platform_driver oxnas_dwmac_driver = { .probe = oxnas_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="oxnas-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +2 -3
@@ -668,16 +668,15 @@ static int qcom_ethqos_probe(struct platform_device *pdev) static int qcom_ethqos_remove(struct platform_device *pdev) {struct qcom_ethqos *ethqos; -int ret; ethqos =get_stmmac_bsp_priv (&pdev->dev);if (!ethqos)return -ENODEV ; - ret =stmmac_pltfr_remove (pdev); +stmmac_pltfr_remove (pdev);ethqos_clks_config (ethqos, false); -return ret; +return 0 ; } static const struct of_device_id qcom_ethqos_match[] = { diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 6b447d8f0bd8..6ee050300b31 100644
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +1 -1
@@ -524,7 +524,7 @@ MODULE_DEVICE_TABLE(of, socfpga_dwmac_match);static struct platform_driver socfpga_dwmac_driver = { .probe = socfpga_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="socfpga-dwmac" , .pm = &socfpga_dwmac_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +1 -1
@@ -156,7 +156,7 @@ MODULE_DEVICE_TABLE(of, starfive_dwmac_match);static struct platform_driver starfive_dwmac_driver = { .probe = starfive_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="starfive-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +1 -1
@@ -179,7 +179,7 @@ MODULE_DEVICE_TABLE(of, sun7i_dwmac_match);static struct platform_driver sun7i_dwmac_driver = { .probe = sun7i_gmac_probe, - .remove = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name ="sun7i-dwmac" , .pm = &stmmac_pltfr_pm_ops,
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +1 -3
@@ -265,9 +265,7 @@ static int visconti_eth_dwmac_remove(struct platform_device *pdev)struct stmmac_priv *priv =netdev_priv (ndev);int err; - err =stmmac_pltfr_remove (pdev); -if (err <0 ) -dev_err (&pdev->dev,"failed to remove platform: %d\n" , err); +stmmac_pltfr_remove (pdev); err =visconti_eth_clock_remove (pdev);if (err <0 )
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -1
@@ -707,7 +707,7 @@ EXPORT_SYMBOL_GPL(stmmac_get_platform_resources);* Description: this function calls the main to free the net resources * and calls the platforms hook and release the resources (e.g. mem). */ -int stmmac_pltfr_remove (struct platform_device *pdev) +void stmmac_pltfr_remove (struct platform_device *pdev) {struct net_device *ndev =platform_get_drvdata (pdev); struct stmmac_priv *priv = netdev_priv(ndev); @@ -719,8 +719,6 @@ int stmmac_pltfr_remove(struct platform_device *pdev)
plat->exit(pdev, plat->bsp_priv);
stmmac_remove_config_dt(pdev, plat);
-
- return 0;
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +1 -2
@@ -19,7 +19,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev, int stmmac_get_platform_resources(struct platform_device *pdev, struct stmmac_resources *stmmac_res); -int stmmac_pltfr_remove (struct platform_device *pdev); +void stmmac_pltfr_remove (struct platform_device *pdev);extern const struct dev_pm_ops stmmac_pltfr_pm_ops;static inline void *get_stmmac_bsp_priv (struct device *dev) --
2.39.2
Re: [PATCH net-next v2 01/11] net: stmmac: Make stmmac_pltfr_remove() return void
Hello,
Quoted 4 lines · Peppe CAVALLARO
Thx for this patch train, maybe I missed the cover letter. In my opinion the proposed change is intrusive but I can accept. It could be great to enhance the platform remove functions to fail in case of an expected case occurs.
Not sure I understand what you want. platform_remove() (i.e. the caller of the remove callback) emits a warning if .remove() returns an value != 0.
In the Linux driver model remove functions are not supposed to fail. The most usual case for a driver unbind (aka remove) is that the device in question disappeared (think hotplug). There is no value in failing, what should happen if the driver fails? There is no chance to reenter .remove() as some resources might already be freed.
Quoted 3 lines
(quoted diff) +1
-0+ .remove_new = stmmac_pltfr_remove,To be honest, I do not like to see: ".remove_new" as hook
.remove_new() is not here to say. Once all drivers are converted, .remove() is changed to get the same semantics as .remove_new() has now and then after all drivers are converted back to .remove() .remove_new() will be dropped. See 5c5a7680e67ba6fbbb5f4d79fa41485450c1985c for some more details.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Re: [PATCH net-next v2 01/11] net: stmmac: Make stmmac_pltfr_remove() return void
In reply to Uwe Kleine-KönigQuoted 12 lines · Uwe Kleine-König
The function returns zero unconditionally. Change it to return void instead which simplifies some callers as error handing becomes unnecessary.
The function is also used for some drivers as remove callback. Switch these to the .remove_new() callback. For some others no error can happen in the remove callback now, convert them to .remove_new(), too.
Acked-by Jernej Skrabec <[email protected]>Reviewed-by Simon Horman <[email protected]>Signed-off-by Uwe Kleine-König <[email protected]>
Quoted 11 lines
--- drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 9 +++------ drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c | 9 +++------ drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +-
For these two Amlogic Meson drivers:
PATCH v2 2/11 net: stmmac: dwmac-visconti: Make visconti_eth_clock_remove() return void
In reply to Uwe Kleine-KönigThe function returns zero unconditionally. Change it to return void instead which simplifies one caller as error handing becomes unnecessary.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +3 -8
@@ -198,7 +198,7 @@ static int visconti_eth_clock_probe(struct platform_device *pdev,return 0 ; } -static int visconti_eth_clock_remove (struct platform_device *pdev) +static void visconti_eth_clock_remove (struct platform_device *pdev) {struct visconti_eth *dwmac =get_stmmac_bsp_priv (&pdev->dev);struct net_device *ndev =platform_get_drvdata (pdev);
@@ -206,8 +206,6 @@ static int visconti_eth_clock_remove(struct platform_device *pdev)clk_disable_unprepare (dwmac->phy_ref_clk);clk_disable_unprepare (priv->plat->stmmac_clk); - -return 0 ; }static int visconti_eth_dwmac_probe (struct platform_device *pdev)
@@ -263,17 +261,14 @@ static int visconti_eth_dwmac_remove(struct platform_device *pdev) {struct net_device *ndev =platform_get_drvdata (pdev);struct stmmac_priv *priv =netdev_priv (ndev); -int err;stmmac_pltfr_remove (pdev); - err =visconti_eth_clock_remove (pdev); -if (err <0 ) -dev_err (&pdev->dev,"failed to remove clock: %d\n" , err); +visconti_eth_clock_remove (pdev);stmmac_remove_config_dt (pdev, priv->plat); -return err; +return 0 ; }static const struct of_device_id visconti_eth_dwmac_match[] = {
Signature · 1 line
2.39.2
Re: [PATCH net-next v2 02/11] net: stmmac: dwmac-visconti: Make visconti_eth_clock_remove() return void
Quoted 5 lines · Uwe Kleine-König
The function returns zero unconditionally. Change it to return void instead which simplifies one caller as error handing becomes unnecessary.
Signed-off-by Uwe Kleine-König <[email protected]>
RE: [PATCH net-next v2 02/11] net: stmmac: dwmac-visconti: Make visconti_eth_clock_remove() return void
In reply to Uwe Kleine-KönigHi Uwe,
Quoted 15 lines
-----Original Message-----
From: Uwe Kleine-König <[email protected]>
Sent: Monday, May 8, 2023 11:26 PM
To: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; iwamatsu nobuhiro(岩松 信洋 ○DITC□DIT○OST) <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH net-next v2 02/11] net: stmmac: dwmac-visconti: Makevisconti_eth_clock_remove()return void
Quoted 4 lines
The function returns zero unconditionally. Change it to return void instead which simplifies one caller as error handing becomes unnecessary.
Signed-off-by Uwe Kleine-König <[email protected]>
Best regards,
Nobuhiro
PATCH v2 3/11 net: stmmac: dwmac-qcom-ethqos: Drop an if with an always false condition
In reply to Uwe Kleine-KönigThe remove callback is only ever called after .probe() returned successfully. After that get_stmmac_bsp_priv() always return non-NULL.
Side note: The early exit would also be a bug because the return value of qcom_ethqos_remove() is ignored by the device core and the device is unbound unconditionally. So exiting early resulted in a dangerous resource leak as all devm allocated resources (some memory and the register mappings) are freed but the network device stays around. Using the network device afterwards probably oopses.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +1 -5
@@ -667,11 +667,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)static int qcom_ethqos_remove (struct platform_device *pdev) { -struct qcom_ethqos *ethqos; - - ethqos =get_stmmac_bsp_priv (&pdev->dev); -if (!ethqos) -return -ENODEV ; +struct qcom_ethqos *ethqos =get_stmmac_bsp_priv (&pdev->dev);stmmac_pltfr_remove (pdev);ethqos_clks_config (ethqos, false);
Signature · 1 line
2.39.2
Re: [PATCH net-next v2 03/11] net: stmmac: dwmac-qcom-ethqos: Drop an if with an always false condition
Quoted 2 lines · Uwe Kleine-König
The remove callback is only ever called after .probe() returned successfully. After that
get_stmmac_bsp_priv()always return non-NULL.
Nitpick: "always returns" or "will always return".
Quoted 8 lines
Side note: The early exit would also be a bug because the return value of
qcom_ethqos_remove()is ignored by the device core and the device is unbound unconditionally. So exiting early resulted in a dangerous resource leak as all devm allocated resources (some memory and the register mappings) are freed but the network device stays around. Using the network device afterwards probably oopses.
Quoted 6 lines
Reviewed-by Simon Horman <[email protected]>Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
Thanks,
Michal
PATCH v2 4/11 net: stmmac: dwmac-visconti: 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 (mostly) ignored 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.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +2 -4
@@ -257,7 +257,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev)return ret; } -static int visconti_eth_dwmac_remove (struct platform_device *pdev) +static void visconti_eth_dwmac_remove (struct platform_device *pdev) {struct net_device *ndev =platform_get_drvdata (pdev);struct stmmac_priv *priv =netdev_priv (ndev);
@@ -267,8 +267,6 @@ static int visconti_eth_dwmac_remove(struct platform_device *pdev)visconti_eth_clock_remove (pdev);stmmac_remove_config_dt (pdev, priv->plat); - -return 0 ; }static const struct of_device_id visconti_eth_dwmac_match[] = {
@@ -279,7 +277,7 @@ MODULE_DEVICE_TABLE(of, visconti_eth_dwmac_match);static struct platform_driver visconti_eth_dwmac_driver = { .probe = visconti_eth_dwmac_probe, - .remove = visconti_eth_dwmac_remove, + .remove_new = visconti_eth_dwmac_remove, .driver = { .name ="visconti-eth-dwmac" , .of_match_table = visconti_eth_dwmac_match,
Signature · 1 line
2.39.2
RE: [PATCH net-next v2 04/11] net: stmmac: dwmac-visconti: Convert to platform remove callback returning void
Hi Uwe,
Quoted 23 lines
-----Original Message-----
From: Uwe Kleine-König <[email protected]>
Sent: Monday, May 8, 2023 11:27 PM
To: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; iwamatsu nobuhiro(岩松 信洋 ○DITC□DIT○
OST) <[email protected]>; Maxime Coquelin <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Simon Horman <[email protected]>
Subject: [PATCH net-next v2 04/11] net: stmmac: dwmac-visconti: Convert to platform remove callback returning voidThe .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 (mostly) ignored 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.
Quoted 6 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Reviewed-by Simon Horman <[email protected]>Signed-off-by Uwe Kleine-König <[email protected]>---
Best regards,
Nobuhiro
PATCH v2 5/11 net: stmmac: dwmac-dwc-qos-eth: 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 (mostly) ignored 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.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +2 -4
@@ -464,7 +464,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)return ret; } -static int dwc_eth_dwmac_remove (struct platform_device *pdev) +static void dwc_eth_dwmac_remove (struct platform_device *pdev) {struct net_device *ndev =platform_get_drvdata (pdev);struct stmmac_priv *priv =netdev_priv (ndev);
@@ -477,8 +477,6 @@ static int dwc_eth_dwmac_remove(struct platform_device *pdev) data->remove (pdev);stmmac_remove_config_dt (pdev, priv->plat); - -return 0 ; }static const struct of_device_id dwc_eth_dwmac_match[] = {
@@ -490,7 +488,7 @@ MODULE_DEVICE_TABLE(of, dwc_eth_dwmac_match);static struct platform_driver dwc_eth_dwmac_driver = { .probe = dwc_eth_dwmac_probe, - .remove = dwc_eth_dwmac_remove, + .remove_new = dwc_eth_dwmac_remove, .driver = { .name ="dwc-eth-dwmac" , .pm = &stmmac_pltfr_pm_ops,
Signature · 1 line
2.39.2
PATCH v2 6/11 net: stmmac: dwmac-qcom-ethqos: 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 (mostly) ignored 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.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +2 -4
@@ -665,14 +665,12 @@ static int qcom_ethqos_probe(struct platform_device *pdev)return ret; } -static int qcom_ethqos_remove (struct platform_device *pdev) +static void qcom_ethqos_remove (struct platform_device *pdev) {struct qcom_ethqos *ethqos =get_stmmac_bsp_priv (&pdev->dev);stmmac_pltfr_remove (pdev);ethqos_clks_config (ethqos, false); - -return 0 ; }static const struct of_device_id qcom_ethqos_match[] = {
@@ -685,7 +683,7 @@ MODULE_DEVICE_TABLE(of, qcom_ethqos_match);static struct platform_driver qcom_ethqos_driver = { .probe = qcom_ethqos_probe, - .remove = qcom_ethqos_remove, + .remove_new = qcom_ethqos_remove, .driver = { .name ="qcom-ethqos" , .pm = &stmmac_pltfr_pm_ops,
Signature · 1 line
2.39.2
Re: [PATCH net-next v2 06/11] net: stmmac: dwmac-qcom-ethqos: Convert to platform remove callback returning void
Hi Uwe,
Quoted 4 lines · Uwe Kleine-König
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 (mostly) ignored
^^^ mostly, here seems confusing. Only if the return value is ignored marking the function
as 'void' makes sense IMO.
Quoted 44 lines
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.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Reviewed-by Simon Horman <[email protected]>Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +2
-5@@ -665,14 +665,12 @@ static int qcom_ethqos_probe(struct platform_device *pdev)return ret; } -static int qcom_ethqos_remove (struct platform_device *pdev) +static void qcom_ethqos_remove (struct platform_device *pdev) {struct qcom_ethqos *ethqos =get_stmmac_bsp_priv (&pdev->dev);stmmac_pltfr_remove (pdev);ethqos_clks_config (ethqos, false); - -return 0 ; }static const struct of_device_id qcom_ethqos_match[] = {@@ -685,7 +683,7 @@ MODULE_DEVICE_TABLE(of, qcom_ethqos_match);static struct platform_driver qcom_ethqos_driver = { .probe = qcom_ethqos_probe, - .remove = qcom_ethqos_remove, + .remove_new = qcom_ethqos_remove, .driver = { .name ="qcom-ethqos" , .pm = &stmmac_pltfr_pm_ops, --
Quoted 1 line
2.39.2
Also a small note (maybe a TBD) indicating that 'remove_new' will be eventually replaced with 'remove' would make reading this easier. Rest seems fine, so:
Thanks.
Re: [PATCH net-next v2 06/11] net: stmmac: dwmac-qcom-ethqos: Convert to platform remove callback returning void
Hello Bhupesh,
Quoted 10 lines · Bhupesh Sharma
Quoted 4 lines · Uwe Kleine-König
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 (mostly) ignored
^^^ mostly, here seems confusing. Only if the return value is ignored marking the function
as 'void' makes sense IMO.
FTR: It's only mostly ignored because a message is emitted:
dev_warn(_dev, "remove callback returned a non-zero value. This will be ignored.\n");
(see platform_remove() in drivers/base/platform.c).
Quoted 2 lines
Also a small note (maybe a TBD) indicating that '
remove_new' will be eventually replaced with 'remove' would make reading this easier.
I adapted the commit message for future similar submissions. Thanks for the feedback.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
PATCH v2 7/11 net: stmmac: dwmac-rk: 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 (mostly) ignored 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.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +2 -4
@@ -1863,15 +1863,13 @@ static int rk_gmac_probe(struct platform_device *pdev)return ret; } -static int rk_gmac_remove (struct platform_device *pdev) +static void rk_gmac_remove (struct platform_device *pdev) {struct rk_priv_data *bsp_priv =get_stmmac_bsp_priv (&pdev->dev);stmmac_dvr_remove (&pdev->dev);rk_gmac_powerdown (bsp_priv); - -return 0 ; }#ifdef CONFIG_PM_SLEEP
@@ -1925,7 +1923,7 @@ MODULE_DEVICE_TABLE(of, rk_gmac_dwmac_match);static struct platform_driver rk_gmac_dwmac_driver = { .probe = rk_gmac_probe, - .remove = rk_gmac_remove, + .remove_new = rk_gmac_remove, .driver = { .name ="rk_gmac-dwmac" , .pm = &rk_gmac_pm_ops,
Signature · 1 line
2.39.2
PATCH v2 8/11 net: stmmac: dwmac-sti: 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 (mostly) ignored 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.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +2 -4
@@ -317,15 +317,13 @@ static int sti_dwmac_probe(struct platform_device *pdev)return ret; } -static int sti_dwmac_remove (struct platform_device *pdev) +static void sti_dwmac_remove (struct platform_device *pdev) {struct sti_dwmac *dwmac =get_stmmac_bsp_priv (&pdev->dev);stmmac_dvr_remove (&pdev->dev);clk_disable_unprepare (dwmac->clk); - -return 0 ; }#ifdef CONFIG_PM_SLEEP
@@ -365,7 +363,7 @@ MODULE_DEVICE_TABLE(of, sti_dwmac_match);static struct platform_driver sti_dwmac_driver = { .probe = sti_dwmac_probe, - .remove = sti_dwmac_remove, + .remove_new = sti_dwmac_remove, .driver = { .name ="sti-dwmac" , .pm = &sti_dwmac_pm_ops,
Signature · 1 line
2.39.2
PATCH v2 9/11 net: stmmac: dwmac-stm32: 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 (mostly) ignored 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.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +2 -4
@@ -417,7 +417,7 @@ static int stm32_dwmac_probe(struct platform_device *pdev)return ret; } -static int stm32_dwmac_remove (struct platform_device *pdev) +static void stm32_dwmac_remove (struct platform_device *pdev) {struct net_device *ndev =platform_get_drvdata (pdev);struct stmmac_priv *priv =netdev_priv (ndev);
@@ -431,8 +431,6 @@ static int stm32_dwmac_remove(struct platform_device *pdev)dev_pm_clear_wake_irq (&pdev->dev);device_init_wakeup (&pdev->dev, false); } - -return 0 ; }static int stm32mp1_suspend (struct stm32_dwmac *dwmac)
@@ -528,7 +526,7 @@ MODULE_DEVICE_TABLE(of, stm32_dwmac_match);static struct platform_driver stm32_dwmac_driver = { .probe = stm32_dwmac_probe, - .remove = stm32_dwmac_remove, + .remove_new = stm32_dwmac_remove, .driver = { .name ="stm32-dwmac" , .pm = &stm32_dwmac_pm_ops,
Signature · 1 line
2.39.2
PATCH v2 10/11 net: stmmac: dwmac-sun8i: 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 (mostly) ignored 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.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +2 -4
@@ -1294,7 +1294,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)return ret; } -static int sun8i_dwmac_remove (struct platform_device *pdev) +static void sun8i_dwmac_remove (struct platform_device *pdev) {struct net_device *ndev =platform_get_drvdata (pdev);struct stmmac_priv *priv =netdev_priv (ndev);
@@ -1309,8 +1309,6 @@ static int sun8i_dwmac_remove(struct platform_device *pdev)stmmac_pltfr_remove (pdev);sun8i_dwmac_unset_syscon (gmac); - -return 0 ; }static void sun8i_dwmac_shutdown (struct platform_device *pdev)
@@ -1341,7 +1339,7 @@ MODULE_DEVICE_TABLE(of, sun8i_dwmac_match);static struct platform_driver sun8i_dwmac_driver = { .probe = sun8i_dwmac_probe, - .remove = sun8i_dwmac_remove, + .remove_new = sun8i_dwmac_remove, .shutdown = sun8i_dwmac_shutdown, .driver = { .name ="dwmac-sun8i" ,
Signature · 1 line
2.39.2
PATCH v2 11/11 net: stmmac: dwmac-tegra: 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 (mostly) ignored 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.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c +2 -4
@@ -353,15 +353,13 @@ static int tegra_mgbe_probe(struct platform_device *pdev)return err; } -static int tegra_mgbe_remove (struct platform_device *pdev) +static void tegra_mgbe_remove (struct platform_device *pdev) {struct tegra_mgbe *mgbe =get_stmmac_bsp_priv (&pdev->dev);clk_bulk_disable_unprepare (ARRAY_SIZE (mgbe_clks), mgbe->clks);stmmac_pltfr_remove (pdev); - -return 0 ; }static const struct of_device_id tegra_mgbe_match[] = {
@@ -374,7 +372,7 @@ static SIMPLE_DEV_PM_OPS(tegra_mgbe_pm_ops, tegra_mgbe_suspend, tegra_mgbe_resumstatic struct platform_driver tegra_mgbe_driver = { .probe = tegra_mgbe_probe, - .remove = tegra_mgbe_remove, + .remove_new = tegra_mgbe_remove, .driver = { .name ="tegra-mgbe" , .pm = &tegra_mgbe_pm_ops,
Signature · 1 line
2.39.2
Quoted 8 lines · Uwe Kleine-König
Hello,
(implicit) v1 of this series is available at
https://lore.kernel.org/netdev/[email protected]
.Changes since then:
Quoted 9 lines
- Added various Reviewed-by: and Acked-by: tags received for v1
- Removed a variable in an earlier patch to make all intermediate steps compilable, spotted by Simon Horman
- Rebased to v6.4-rc1 (which needed a slight adaption to cope for4bd3bb7b4526("net: stmmac: Add glue layer for StarFive JH7110 SoC"))Best regards
Uwe
For the series:
(Just a very minor nitpick in the commit message of patch 3).
Quoted 4 lines
Signature · 1 line
2.39.2
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Mon, 8 May 2023 16:26:26 +0200 you wrote:
Hello,
(implicit) v1 of this series is available at
https://lore.kernel.org/netdev/[email protected]
.Changes since then:
[...]
Here is the summary with links:
- [net-next,v2,01/11] net: stmmac: Make stmmac_pltfr_remove() return void
https://git.kernel.org/netdev/net-next/c/3246627f11c5 - [net-next,v2,02/11] net: stmmac: dwmac-visconti: Make visconti_eth_clock_remove() return void https://git.kernel.org/netdev/net-next/c/b9bc44fe068d - [net-next,v2,03/11] net: stmmac: dwmac-qcom-ethqos: Drop an if with an always false condition https://git.kernel.org/netdev/net-next/c/c5f3ffe35cc9 - [net-next,v2,04/11] net: stmmac: dwmac-visconti: Convert to platform remove callback returning void https://git.kernel.org/netdev/net-next/c/f4d05c419761 - [net-next,v2,05/11] net: stmmac: dwmac-dwc-qos-eth: Convert to platform remove callback returning void https://git.kernel.org/netdev/net-next/c/360cd89064b6 - [net-next,v2,06/11] net: stmmac: dwmac-qcom-ethqos: Convert to platform remove callback returning void https://git.kernel.org/netdev/net-next/c/5580b559a80a - [net-next,v2,07/11] net: stmmac: dwmac-rk: Convert to platform remove callback returning void https://git.kernel.org/netdev/net-next/c/903cc461c901 - [net-next,v2,08/11] net: stmmac: dwmac-sti: Convert to platform remove callback returning void https://git.kernel.org/netdev/net-next/c/b394982a10d9 - [net-next,v2,09/11] net: stmmac: dwmac-stm32: Convert to platform remove callback returning void https://git.kernel.org/netdev/net-next/c/fec3f552140e - [net-next,v2,10/11] net: stmmac: dwmac-sun8i: Convert to platform remove callback returning void https://git.kernel.org/netdev/net-next/c/cc708d4ed7b3 - [net-next,v2,11/11] net: stmmac: dwmac-tegra: Convert to platform remove callback returning void https://git.kernel.org/netdev/net-next/c/a86f8601c8f0
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html