net: stmmac: Make stmmac_pltfr_remove() return void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 8 May 2023 14:26:27 +0000 (16:26 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 10 May 2023 02:56:31 +0000 (19:56 -0700)
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 <jernej.skrabec@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
18 files changed:
drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h

index 9354bf4..58a7f08 100644 (file)
@@ -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,
index ef8f3a9..ef10239 100644 (file)
@@ -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,
index 7c228bd..b9378a6 100644 (file)
@@ -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,
index 378b4dd..8063ba1 100644 (file)
@@ -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),
index 06d287f..a5e639a 100644 (file)
@@ -169,20 +169,17 @@ err_remove_config_dt:
        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,
index e888c8a..e39406d 100644 (file)
@@ -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,
index 9d77c64..18e84ba 100644 (file)
@@ -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,
index 9ae31e3..73c1dfa 100644 (file)
@@ -678,15 +678,12 @@ err_remove_config_dt:
        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,
index 16fb66a..7aa5e6b 100644 (file)
@@ -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,
index f6754e3..92b1604 100644 (file)
@@ -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,
index 62a69a9..4295402 100644 (file)
@@ -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,
index 16a8c36..494c222 100644 (file)
@@ -668,16 +668,15 @@ err_mem:
 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[] = {
index 6b447d8..6ee0503 100644 (file)
@@ -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,
index 4f51a78..d3a39d2 100644 (file)
@@ -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,
index fc3b0ac..50963e9 100644 (file)
@@ -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,
index c3f10a9..d43da71 100644 (file)
@@ -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)
index eb0b289..3c6b55b 100644 (file)
@@ -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);
 
index 3fff3f5..f7e4579 100644 (file)
@@ -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)