Commit 3246627f authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Jakub Kicinski

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.
Acked-by: default avatarJernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Reviewed-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: default avatarMichal Kubiak <michal.kubiak@intel.com>
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 505e315b
...@@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(of, anarion_dwmac_match); ...@@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(of, anarion_dwmac_match);
static struct platform_driver anarion_dwmac_driver = { static struct platform_driver anarion_dwmac_driver = {
.probe = anarion_dwmac_probe, .probe = anarion_dwmac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "anarion-dwmac", .name = "anarion-dwmac",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -87,7 +87,7 @@ MODULE_DEVICE_TABLE(of, dwmac_generic_match); ...@@ -87,7 +87,7 @@ MODULE_DEVICE_TABLE(of, dwmac_generic_match);
static struct platform_driver dwmac_generic_driver = { static struct platform_driver dwmac_generic_driver = {
.probe = dwmac_generic_probe, .probe = dwmac_generic_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = STMMAC_RESOURCE_NAME, .name = STMMAC_RESOURCE_NAME,
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -376,7 +376,7 @@ MODULE_DEVICE_TABLE(of, imx_dwmac_match); ...@@ -376,7 +376,7 @@ MODULE_DEVICE_TABLE(of, imx_dwmac_match);
static struct platform_driver imx_dwmac_driver = { static struct platform_driver imx_dwmac_driver = {
.probe = imx_dwmac_probe, .probe = imx_dwmac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "imx-dwmac", .name = "imx-dwmac",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -386,7 +386,7 @@ MODULE_DEVICE_TABLE(of, ingenic_mac_of_matches); ...@@ -386,7 +386,7 @@ MODULE_DEVICE_TABLE(of, ingenic_mac_of_matches);
static struct platform_driver ingenic_mac_driver = { static struct platform_driver ingenic_mac_driver = {
.probe = ingenic_mac_probe, .probe = ingenic_mac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "ingenic-mac", .name = "ingenic-mac",
.pm = pm_ptr(&ingenic_mac_pm_ops), .pm = pm_ptr(&ingenic_mac_pm_ops),
......
...@@ -169,20 +169,17 @@ static int intel_eth_plat_probe(struct platform_device *pdev) ...@@ -169,20 +169,17 @@ static int intel_eth_plat_probe(struct platform_device *pdev)
return ret; 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); 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); clk_disable_unprepare(dwmac->tx_clk);
return ret;
} }
static struct platform_driver intel_eth_plat_driver = { static struct platform_driver intel_eth_plat_driver = {
.probe = intel_eth_plat_probe, .probe = intel_eth_plat_probe,
.remove = intel_eth_plat_remove, .remove_new = intel_eth_plat_remove,
.driver = { .driver = {
.name = "intel-eth-plat", .name = "intel-eth-plat",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -498,7 +498,7 @@ MODULE_DEVICE_TABLE(of, ipq806x_gmac_dwmac_match); ...@@ -498,7 +498,7 @@ MODULE_DEVICE_TABLE(of, ipq806x_gmac_dwmac_match);
static struct platform_driver ipq806x_gmac_dwmac_driver = { static struct platform_driver ipq806x_gmac_dwmac_driver = {
.probe = ipq806x_gmac_probe, .probe = ipq806x_gmac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "ipq806x-gmac-dwmac", .name = "ipq806x-gmac-dwmac",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -83,7 +83,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_dwmac_match); ...@@ -83,7 +83,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_dwmac_match);
static struct platform_driver lpc18xx_dwmac_driver = { static struct platform_driver lpc18xx_dwmac_driver = {
.probe = lpc18xx_dwmac_probe, .probe = lpc18xx_dwmac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "lpc18xx-dwmac", .name = "lpc18xx-dwmac",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -678,15 +678,12 @@ static int mediatek_dwmac_probe(struct platform_device *pdev) ...@@ -678,15 +678,12 @@ static int mediatek_dwmac_probe(struct platform_device *pdev)
return ret; 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); 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); mediatek_dwmac_clks_config(priv_plat, false);
return ret;
} }
static const struct of_device_id mediatek_dwmac_match[] = { static const struct of_device_id mediatek_dwmac_match[] = {
...@@ -701,7 +698,7 @@ MODULE_DEVICE_TABLE(of, mediatek_dwmac_match); ...@@ -701,7 +698,7 @@ MODULE_DEVICE_TABLE(of, mediatek_dwmac_match);
static struct platform_driver mediatek_dwmac_driver = { static struct platform_driver mediatek_dwmac_driver = {
.probe = mediatek_dwmac_probe, .probe = mediatek_dwmac_probe,
.remove = mediatek_dwmac_remove, .remove_new = mediatek_dwmac_remove,
.driver = { .driver = {
.name = "dwmac-mediatek", .name = "dwmac-mediatek",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -91,7 +91,7 @@ MODULE_DEVICE_TABLE(of, meson6_dwmac_match); ...@@ -91,7 +91,7 @@ MODULE_DEVICE_TABLE(of, meson6_dwmac_match);
static struct platform_driver meson6_dwmac_driver = { static struct platform_driver meson6_dwmac_driver = {
.probe = meson6_dwmac_probe, .probe = meson6_dwmac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "meson6-dwmac", .name = "meson6-dwmac",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -539,7 +539,7 @@ MODULE_DEVICE_TABLE(of, meson8b_dwmac_match); ...@@ -539,7 +539,7 @@ MODULE_DEVICE_TABLE(of, meson8b_dwmac_match);
static struct platform_driver meson8b_dwmac_driver = { static struct platform_driver meson8b_dwmac_driver = {
.probe = meson8b_dwmac_probe, .probe = meson8b_dwmac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "meson8b-dwmac", .name = "meson8b-dwmac",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -231,7 +231,7 @@ MODULE_DEVICE_TABLE(of, oxnas_dwmac_match); ...@@ -231,7 +231,7 @@ MODULE_DEVICE_TABLE(of, oxnas_dwmac_match);
static struct platform_driver oxnas_dwmac_driver = { static struct platform_driver oxnas_dwmac_driver = {
.probe = oxnas_dwmac_probe, .probe = oxnas_dwmac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "oxnas-dwmac", .name = "oxnas-dwmac",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -668,16 +668,15 @@ static int qcom_ethqos_probe(struct platform_device *pdev) ...@@ -668,16 +668,15 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
static int qcom_ethqos_remove(struct platform_device *pdev) static int qcom_ethqos_remove(struct platform_device *pdev)
{ {
struct qcom_ethqos *ethqos; struct qcom_ethqos *ethqos;
int ret;
ethqos = get_stmmac_bsp_priv(&pdev->dev); ethqos = get_stmmac_bsp_priv(&pdev->dev);
if (!ethqos) if (!ethqos)
return -ENODEV; return -ENODEV;
ret = stmmac_pltfr_remove(pdev); stmmac_pltfr_remove(pdev);
ethqos_clks_config(ethqos, false); ethqos_clks_config(ethqos, false);
return ret; return 0;
} }
static const struct of_device_id qcom_ethqos_match[] = { static const struct of_device_id qcom_ethqos_match[] = {
......
...@@ -524,7 +524,7 @@ MODULE_DEVICE_TABLE(of, socfpga_dwmac_match); ...@@ -524,7 +524,7 @@ MODULE_DEVICE_TABLE(of, socfpga_dwmac_match);
static struct platform_driver socfpga_dwmac_driver = { static struct platform_driver socfpga_dwmac_driver = {
.probe = socfpga_dwmac_probe, .probe = socfpga_dwmac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "socfpga-dwmac", .name = "socfpga-dwmac",
.pm = &socfpga_dwmac_pm_ops, .pm = &socfpga_dwmac_pm_ops,
......
...@@ -156,7 +156,7 @@ MODULE_DEVICE_TABLE(of, starfive_dwmac_match); ...@@ -156,7 +156,7 @@ MODULE_DEVICE_TABLE(of, starfive_dwmac_match);
static struct platform_driver starfive_dwmac_driver = { static struct platform_driver starfive_dwmac_driver = {
.probe = starfive_dwmac_probe, .probe = starfive_dwmac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "starfive-dwmac", .name = "starfive-dwmac",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -179,7 +179,7 @@ MODULE_DEVICE_TABLE(of, sun7i_dwmac_match); ...@@ -179,7 +179,7 @@ MODULE_DEVICE_TABLE(of, sun7i_dwmac_match);
static struct platform_driver sun7i_dwmac_driver = { static struct platform_driver sun7i_dwmac_driver = {
.probe = sun7i_gmac_probe, .probe = sun7i_gmac_probe,
.remove = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove,
.driver = { .driver = {
.name = "sun7i-dwmac", .name = "sun7i-dwmac",
.pm = &stmmac_pltfr_pm_ops, .pm = &stmmac_pltfr_pm_ops,
......
...@@ -265,9 +265,7 @@ static int visconti_eth_dwmac_remove(struct platform_device *pdev) ...@@ -265,9 +265,7 @@ static int visconti_eth_dwmac_remove(struct platform_device *pdev)
struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_priv *priv = netdev_priv(ndev);
int err; int err;
err = stmmac_pltfr_remove(pdev); stmmac_pltfr_remove(pdev);
if (err < 0)
dev_err(&pdev->dev, "failed to remove platform: %d\n", err);
err = visconti_eth_clock_remove(pdev); err = visconti_eth_clock_remove(pdev);
if (err < 0) if (err < 0)
......
...@@ -707,7 +707,7 @@ EXPORT_SYMBOL_GPL(stmmac_get_platform_resources); ...@@ -707,7 +707,7 @@ EXPORT_SYMBOL_GPL(stmmac_get_platform_resources);
* Description: this function calls the main to free the net resources * Description: this function calls the main to free the net resources
* and calls the platforms hook and release the resources (e.g. mem). * 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 net_device *ndev = platform_get_drvdata(pdev);
struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_priv *priv = netdev_priv(ndev);
...@@ -719,8 +719,6 @@ int stmmac_pltfr_remove(struct platform_device *pdev) ...@@ -719,8 +719,6 @@ int stmmac_pltfr_remove(struct platform_device *pdev)
plat->exit(pdev, plat->bsp_priv); plat->exit(pdev, plat->bsp_priv);
stmmac_remove_config_dt(pdev, plat); stmmac_remove_config_dt(pdev, plat);
return 0;
} }
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove); EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
......
...@@ -19,7 +19,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev, ...@@ -19,7 +19,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev,
int stmmac_get_platform_resources(struct platform_device *pdev, int stmmac_get_platform_resources(struct platform_device *pdev,
struct stmmac_resources *stmmac_res); 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; extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
static inline void *get_stmmac_bsp_priv(struct device *dev) static inline void *get_stmmac_bsp_priv(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment