Commit bfe59032 authored by Ivan Khoronzhuk's avatar Ivan Khoronzhuk Committed by David S. Miller

net: ethernet: ti: cpsw: use cpsw as drv data

No need to set ndev for drvdata when mainly cpsw reference is needed,
so correct this legacy decision.
Reviewed-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: default avatarIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eea9e3a4
...@@ -2265,8 +2265,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, ...@@ -2265,8 +2265,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
static void cpsw_remove_dt(struct platform_device *pdev) static void cpsw_remove_dt(struct platform_device *pdev)
{ {
struct net_device *ndev = platform_get_drvdata(pdev); struct cpsw_common *cpsw = platform_get_drvdata(pdev);
struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
struct cpsw_platform_data *data = &cpsw->data; struct cpsw_platform_data *data = &cpsw->data;
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct device_node *slave_node; struct device_node *slave_node;
...@@ -2477,7 +2476,7 @@ static int cpsw_probe(struct platform_device *pdev) ...@@ -2477,7 +2476,7 @@ static int cpsw_probe(struct platform_device *pdev)
goto clean_cpts; goto clean_cpts;
} }
platform_set_drvdata(pdev, ndev); platform_set_drvdata(pdev, cpsw);
priv = netdev_priv(ndev); priv = netdev_priv(ndev);
priv->cpsw = cpsw; priv->cpsw = cpsw;
priv->ndev = ndev; priv->ndev = ndev;
...@@ -2570,9 +2569,8 @@ static int cpsw_probe(struct platform_device *pdev) ...@@ -2570,9 +2569,8 @@ static int cpsw_probe(struct platform_device *pdev)
static int cpsw_remove(struct platform_device *pdev) static int cpsw_remove(struct platform_device *pdev)
{ {
struct net_device *ndev = platform_get_drvdata(pdev); struct cpsw_common *cpsw = platform_get_drvdata(pdev);
struct cpsw_common *cpsw = ndev_to_cpsw(ndev); int i, ret;
int ret;
ret = pm_runtime_get_sync(&pdev->dev); ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0) { if (ret < 0) {
...@@ -2580,9 +2578,9 @@ static int cpsw_remove(struct platform_device *pdev) ...@@ -2580,9 +2578,9 @@ static int cpsw_remove(struct platform_device *pdev)
return ret; return ret;
} }
if (cpsw->data.dual_emac) for (i = 0; i < cpsw->data.slaves; i++)
unregister_netdev(cpsw->slaves[1].ndev); if (cpsw->slaves[i].ndev)
unregister_netdev(ndev); unregister_netdev(cpsw->slaves[i].ndev);
cpts_release(cpsw->cpts); cpts_release(cpsw->cpts);
cpdma_ctlr_destroy(cpsw->dma); cpdma_ctlr_destroy(cpsw->dma);
......
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