Skip to content

Commit

Permalink
net: ethernet: ti: cpsw: use cpsw as drv data
Browse files Browse the repository at this point in the history
No need to set ndev for drvdata when mainly cpsw reference is needed,
so correct this legacy decision.

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ivan Khoronzhuk authored and David S. Miller committed Jun 15, 2019
1 parent eea9e3a commit bfe5903
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions drivers/net/ethernet/ti/cpsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2265,8 +2265,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,

static void cpsw_remove_dt(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
struct cpsw_common *cpsw = platform_get_drvdata(pdev);
struct cpsw_platform_data *data = &cpsw->data;
struct device_node *node = pdev->dev.of_node;
struct device_node *slave_node;
Expand Down Expand Up @@ -2477,7 +2476,7 @@ static int cpsw_probe(struct platform_device *pdev)
goto clean_cpts;
}

platform_set_drvdata(pdev, ndev);
platform_set_drvdata(pdev, cpsw);
priv = netdev_priv(ndev);
priv->cpsw = cpsw;
priv->ndev = ndev;
Expand Down Expand Up @@ -2570,19 +2569,18 @@ static int cpsw_probe(struct platform_device *pdev)

static int cpsw_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
int ret;
struct cpsw_common *cpsw = platform_get_drvdata(pdev);
int i, ret;

ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0) {
pm_runtime_put_noidle(&pdev->dev);
return ret;
}

if (cpsw->data.dual_emac)
unregister_netdev(cpsw->slaves[1].ndev);
unregister_netdev(ndev);
for (i = 0; i < cpsw->data.slaves; i++)
if (cpsw->slaves[i].ndev)
unregister_netdev(cpsw->slaves[i].ndev);

cpts_release(cpsw->cpts);
cpdma_ctlr_destroy(cpsw->dma);
Expand Down

0 comments on commit bfe5903

Please sign in to comment.