Commit 2f9b0d93 authored by Keerthy's avatar Keerthy Committed by David S. Miller

net: ethernet: ti: cpsw: Fix suspend/resume break

Commit bfe59032 ("net: ethernet:
ti: cpsw: use cpsw as drv data")changes
the driver data to struct cpsw_common *cpsw. This is done
only in probe/remove but the suspend/resume functions are
still left with struct net_device *ndev. Hence fix both
suspend & resume also to fetch the updated driver data.

Fixes: bfe59032 ("net: ethernet: ti: cpsw: use cpsw as drv data")
Signed-off-by: default avatarKeerthy <j-keerthy@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e54fbbdf
...@@ -2590,20 +2590,13 @@ static int cpsw_remove(struct platform_device *pdev) ...@@ -2590,20 +2590,13 @@ static int cpsw_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int cpsw_suspend(struct device *dev) static int cpsw_suspend(struct device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct cpsw_common *cpsw = dev_get_drvdata(dev);
struct cpsw_common *cpsw = ndev_to_cpsw(ndev); int i;
if (cpsw->data.dual_emac) {
int i;
for (i = 0; i < cpsw->data.slaves; i++) { for (i = 0; i < cpsw->data.slaves; i++)
if (cpsw->slaves[i].ndev)
if (netif_running(cpsw->slaves[i].ndev)) if (netif_running(cpsw->slaves[i].ndev))
cpsw_ndo_stop(cpsw->slaves[i].ndev); cpsw_ndo_stop(cpsw->slaves[i].ndev);
}
} else {
if (netif_running(ndev))
cpsw_ndo_stop(ndev);
}
/* Select sleep pin state */ /* Select sleep pin state */
pinctrl_pm_select_sleep_state(dev); pinctrl_pm_select_sleep_state(dev);
...@@ -2613,25 +2606,20 @@ static int cpsw_suspend(struct device *dev) ...@@ -2613,25 +2606,20 @@ static int cpsw_suspend(struct device *dev)
static int cpsw_resume(struct device *dev) static int cpsw_resume(struct device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct cpsw_common *cpsw = dev_get_drvdata(dev);
struct cpsw_common *cpsw = ndev_to_cpsw(ndev); int i;
/* Select default pin state */ /* Select default pin state */
pinctrl_pm_select_default_state(dev); pinctrl_pm_select_default_state(dev);
/* shut up ASSERT_RTNL() warning in netif_set_real_num_tx/rx_queues */ /* shut up ASSERT_RTNL() warning in netif_set_real_num_tx/rx_queues */
rtnl_lock(); rtnl_lock();
if (cpsw->data.dual_emac) {
int i;
for (i = 0; i < cpsw->data.slaves; i++) { for (i = 0; i < cpsw->data.slaves; i++)
if (cpsw->slaves[i].ndev)
if (netif_running(cpsw->slaves[i].ndev)) if (netif_running(cpsw->slaves[i].ndev))
cpsw_ndo_open(cpsw->slaves[i].ndev); cpsw_ndo_open(cpsw->slaves[i].ndev);
}
} else {
if (netif_running(ndev))
cpsw_ndo_open(ndev);
}
rtnl_unlock(); rtnl_unlock();
return 0; return 0;
......
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