Skip to content

Commit

Permalink
Merge branch 'net-platform-remove-void'
Browse files Browse the repository at this point in the history
Uwe Kleine-König says:

====================
net: ethernet: Convert to platform remove callback returning void

this series convert nearly all platform drivers below
drivers/net/ethernet 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.

There are 3 drivers I didn't convert (yet):

 drivers/net/ethernet/ti/cpsw.c
 drivers/net/ethernet/ti/cpsw_new.c
 drivers/net/ethernet/ti/am65-cpsw-nuss.c

These are a bit more complicated because they don't always return 0 in
.remove(). Unless someone is quicker than me, I'll address them in
separate patches at a later time.

See commit 5c5a768 ("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, please apply the remainder of this series anyhow.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Sep 20, 2023
2 parents 5bed8d5 + d74a5c1 commit 6f0b985
Show file tree
Hide file tree
Showing 101 changed files with 213 additions and 399 deletions.
6 changes: 2 additions & 4 deletions drivers/net/ethernet/8390/ax88796.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ static int ax_init_dev(struct net_device *dev)
return ret;
}

static int ax_remove(struct platform_device *pdev)
static void ax_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct ei_device *ei_local = netdev_priv(dev);
Expand All @@ -832,8 +832,6 @@ static int ax_remove(struct platform_device *pdev)

platform_set_drvdata(pdev, NULL);
free_netdev(dev);

return 0;
}

/*
Expand Down Expand Up @@ -1011,7 +1009,7 @@ static struct platform_driver axdrv = {
.name = "ax88796",
},
.probe = ax_probe,
.remove = ax_remove,
.remove_new = ax_remove,
.suspend = ax_suspend,
.resume = ax_resume,
};
Expand Down
5 changes: 2 additions & 3 deletions drivers/net/ethernet/8390/mcf8390.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ static int mcf8390_probe(struct platform_device *pdev)
return 0;
}

static int mcf8390_remove(struct platform_device *pdev)
static void mcf8390_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct resource *mem;
Expand All @@ -450,15 +450,14 @@ static int mcf8390_remove(struct platform_device *pdev)
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, resource_size(mem));
free_netdev(dev);
return 0;
}

static struct platform_driver mcf8390_drv = {
.driver = {
.name = "mcf8390",
},
.probe = mcf8390_probe,
.remove = mcf8390_remove,
.remove_new = mcf8390_remove,
};

module_platform_driver(mcf8390_drv);
Expand Down
5 changes: 2 additions & 3 deletions drivers/net/ethernet/8390/ne.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ static int __init ne_drv_probe(struct platform_device *pdev)
return 0;
}

static int ne_drv_remove(struct platform_device *pdev)
static void ne_drv_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);

Expand All @@ -842,7 +842,6 @@ static int ne_drv_remove(struct platform_device *pdev)
release_region(dev->base_addr, NE_IO_EXTENT);
free_netdev(dev);
}
return 0;
}

/* Remove unused devices or all if true. */
Expand Down Expand Up @@ -895,7 +894,7 @@ static int ne_drv_resume(struct platform_device *pdev)
#endif

static struct platform_driver ne_driver = {
.remove = ne_drv_remove,
.remove_new = ne_drv_remove,
.suspend = ne_drv_suspend,
.resume = ne_drv_resume,
.driver = {
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/actions/owl-emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1582,15 +1582,13 @@ static int owl_emac_probe(struct platform_device *pdev)
return 0;
}

static int owl_emac_remove(struct platform_device *pdev)
static void owl_emac_remove(struct platform_device *pdev)
{
struct owl_emac_priv *priv = platform_get_drvdata(pdev);

netif_napi_del(&priv->napi);
phy_disconnect(priv->netdev->phydev);
cancel_work_sync(&priv->mac_reset_task);

return 0;
}

static const struct of_device_id owl_emac_of_match[] = {
Expand All @@ -1609,7 +1607,7 @@ static struct platform_driver owl_emac_driver = {
.pm = &owl_emac_pm_ops,
},
.probe = owl_emac_probe,
.remove = owl_emac_remove,
.remove_new = owl_emac_remove,
};
module_platform_driver(owl_emac_driver);

Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/aeroflex/greth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ static int greth_of_probe(struct platform_device *ofdev)
return err;
}

static int greth_of_remove(struct platform_device *of_dev)
static void greth_of_remove(struct platform_device *of_dev)
{
struct net_device *ndev = platform_get_drvdata(of_dev);
struct greth_private *greth = netdev_priv(ndev);
Expand All @@ -1544,8 +1544,6 @@ static int greth_of_remove(struct platform_device *of_dev)
of_iounmap(&of_dev->resource[0], greth->regs, resource_size(&of_dev->resource[0]));

free_netdev(ndev);

return 0;
}

static const struct of_device_id greth_of_match[] = {
Expand All @@ -1566,7 +1564,7 @@ static struct platform_driver greth_of_driver = {
.of_match_table = greth_of_match,
},
.probe = greth_of_probe,
.remove = greth_of_remove,
.remove_new = greth_of_remove,
};

module_platform_driver(greth_of_driver);
Expand Down
5 changes: 2 additions & 3 deletions drivers/net/ethernet/allwinner/sun4i-emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ static int emac_probe(struct platform_device *pdev)
return ret;
}

static int emac_remove(struct platform_device *pdev)
static void emac_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct emac_board_info *db = netdev_priv(ndev);
Expand All @@ -1101,7 +1101,6 @@ static int emac_remove(struct platform_device *pdev)
free_netdev(ndev);

dev_dbg(&pdev->dev, "released and freed device\n");
return 0;
}

static int emac_suspend(struct platform_device *dev, pm_message_t state)
Expand Down Expand Up @@ -1143,7 +1142,7 @@ static struct platform_driver emac_driver = {
.of_match_table = emac_of_match,
},
.probe = emac_probe,
.remove = emac_remove,
.remove_new = emac_remove,
.suspend = emac_suspend,
.resume = emac_resume,
};
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/altera/altera_tse_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ static int altera_tse_probe(struct platform_device *pdev)

/* Remove Altera TSE MAC device
*/
static int altera_tse_remove(struct platform_device *pdev)
static void altera_tse_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct altera_tse_private *priv = netdev_priv(ndev);
Expand All @@ -1476,8 +1476,6 @@ static int altera_tse_remove(struct platform_device *pdev)
lynx_pcs_destroy(priv->pcs);

free_netdev(ndev);

return 0;
}

static const struct altera_dmaops altera_dtype_sgdma = {
Expand Down Expand Up @@ -1528,7 +1526,7 @@ MODULE_DEVICE_TABLE(of, altera_tse_ids);

static struct platform_driver altera_tse_driver = {
.probe = altera_tse_probe,
.remove = altera_tse_remove,
.remove_new = altera_tse_remove,
.suspend = NULL,
.resume = NULL,
.driver = {
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/amd/au1000_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ static int au1000_probe(struct platform_device *pdev)
return err;
}

static int au1000_remove(struct platform_device *pdev)
static void au1000_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct au1000_private *aup = netdev_priv(dev);
Expand Down Expand Up @@ -1359,13 +1359,11 @@ static int au1000_remove(struct platform_device *pdev)
release_mem_region(macen->start, resource_size(macen));

free_netdev(dev);

return 0;
}

static struct platform_driver au1000_eth_driver = {
.probe = au1000_probe,
.remove = au1000_remove,
.remove_new = au1000_remove,
.driver = {
.name = "au1000-eth",
},
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/amd/sunlance.c
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ static int sunlance_sbus_probe(struct platform_device *op)
return err;
}

static int sunlance_sbus_remove(struct platform_device *op)
static void sunlance_sbus_remove(struct platform_device *op)
{
struct lance_private *lp = platform_get_drvdata(op);
struct net_device *net_dev = lp->dev;
Expand All @@ -1497,8 +1497,6 @@ static int sunlance_sbus_remove(struct platform_device *op)
lance_free_hwresources(lp);

free_netdev(net_dev);

return 0;
}

static const struct of_device_id sunlance_sbus_match[] = {
Expand All @@ -1516,7 +1514,7 @@ static struct platform_driver sunlance_sbus_driver = {
.of_match_table = sunlance_sbus_match,
},
.probe = sunlance_sbus_probe,
.remove = sunlance_sbus_remove,
.remove_new = sunlance_sbus_remove,
};

module_platform_driver(sunlance_sbus_driver);
6 changes: 2 additions & 4 deletions drivers/net/ethernet/amd/xgbe/xgbe-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ static int xgbe_platform_probe(struct platform_device *pdev)
return ret;
}

static int xgbe_platform_remove(struct platform_device *pdev)
static void xgbe_platform_remove(struct platform_device *pdev)
{
struct xgbe_prv_data *pdata = platform_get_drvdata(pdev);

Expand All @@ -521,8 +521,6 @@ static int xgbe_platform_remove(struct platform_device *pdev)
platform_device_put(pdata->phy_platdev);

xgbe_free_pdata(pdata);

return 0;
}

#ifdef CONFIG_PM_SLEEP
Expand Down Expand Up @@ -615,7 +613,7 @@ static struct platform_driver xgbe_driver = {
.pm = &xgbe_platform_pm_ops,
},
.probe = xgbe_platform_probe,
.remove = xgbe_platform_remove,
.remove_new = xgbe_platform_remove,
};

int xgbe_platform_init(void)
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/apm/xgene-v2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ static int xge_probe(struct platform_device *pdev)
return ret;
}

static int xge_remove(struct platform_device *pdev)
static void xge_remove(struct platform_device *pdev)
{
struct xge_pdata *pdata;
struct net_device *ndev;
Expand All @@ -706,8 +706,6 @@ static int xge_remove(struct platform_device *pdev)
xge_mdio_remove(ndev);
unregister_netdev(ndev);
free_netdev(ndev);

return 0;
}

static void xge_shutdown(struct platform_device *pdev)
Expand Down Expand Up @@ -736,7 +734,7 @@ static struct platform_driver xge_driver = {
.acpi_match_table = ACPI_PTR(xge_acpi_match),
},
.probe = xge_probe,
.remove = xge_remove,
.remove_new = xge_remove,
.shutdown = xge_shutdown,
};
module_platform_driver(xge_driver);
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/apm/xgene/xgene_enet_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
return ret;
}

static int xgene_enet_remove(struct platform_device *pdev)
static void xgene_enet_remove(struct platform_device *pdev)
{
struct xgene_enet_pdata *pdata;
struct net_device *ndev;
Expand All @@ -2149,8 +2149,6 @@ static int xgene_enet_remove(struct platform_device *pdev)
xgene_enet_delete_desc_rings(pdata);
pdata->port_ops->shutdown(pdata);
free_netdev(ndev);

return 0;
}

static void xgene_enet_shutdown(struct platform_device *pdev)
Expand All @@ -2174,7 +2172,7 @@ static struct platform_driver xgene_enet_driver = {
.acpi_match_table = ACPI_PTR(xgene_enet_acpi_match),
},
.probe = xgene_enet_probe,
.remove = xgene_enet_remove,
.remove_new = xgene_enet_remove,
.shutdown = xgene_enet_shutdown,
};

Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/apple/macmace.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Macintosh MACE ethernet driver");
MODULE_ALIAS("platform:macmace");

static int mac_mace_device_remove(struct platform_device *pdev)
static void mac_mace_device_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct mace_data *mp = netdev_priv(dev);
Expand All @@ -755,13 +755,11 @@ static int mac_mace_device_remove(struct platform_device *pdev)
mp->tx_ring, mp->tx_ring_phys);

free_netdev(dev);

return 0;
}

static struct platform_driver mac_mace_driver = {
.probe = mace_probe,
.remove = mac_mace_device_remove,
.remove_new = mac_mace_device_remove,
.driver = {
.name = mac_mace_string,
},
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/arc/emac_arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@ static int emac_arc_probe(struct platform_device *pdev)
return err;
}

static int emac_arc_remove(struct platform_device *pdev)
static void emac_arc_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);

arc_emac_remove(ndev);
free_netdev(ndev);

return 0;
}

static const struct of_device_id emac_arc_dt_ids[] = {
Expand All @@ -76,7 +74,7 @@ MODULE_DEVICE_TABLE(of, emac_arc_dt_ids);

static struct platform_driver emac_arc_driver = {
.probe = emac_arc_probe,
.remove = emac_arc_remove,
.remove_new = emac_arc_remove,
.driver = {
.name = DRV_NAME,
.of_match_table = emac_arc_dt_ids,
Expand Down
5 changes: 2 additions & 3 deletions drivers/net/ethernet/arc/emac_rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static int emac_rockchip_probe(struct platform_device *pdev)
return err;
}

static int emac_rockchip_remove(struct platform_device *pdev)
static void emac_rockchip_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct rockchip_priv_data *priv = netdev_priv(ndev);
Expand All @@ -260,12 +260,11 @@ static int emac_rockchip_remove(struct platform_device *pdev)
clk_disable_unprepare(priv->macclk);

free_netdev(ndev);
return 0;
}

static struct platform_driver emac_rockchip_driver = {
.probe = emac_rockchip_probe,
.remove = emac_rockchip_remove,
.remove_new = emac_rockchip_remove,
.driver = {
.name = DRV_NAME,
.of_match_table = emac_rockchip_dt_ids,
Expand Down
Loading

0 comments on commit 6f0b985

Please sign in to comment.