Skip to content

Commit 257f54c

Browse files
ffainelliZhengShunQian
authored andcommitted
net: dsa: Do not suspend/resume closed slave_dev
[ Upstream commit a94c689 ] If a DSA slave network device was previously disabled, there is no need to suspend or resume it. Fixes: 2446254 ("net: dsa: allow switch drivers to implement suspend/resume hooks") Signed-off-by: Florian Fainelli <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b540ca4 commit 257f54c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/dsa/slave.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,9 @@ int dsa_slave_suspend(struct net_device *slave_dev)
10991099
{
11001100
struct dsa_slave_priv *p = netdev_priv(slave_dev);
11011101

1102+
if (!netif_running(slave_dev))
1103+
return 0;
1104+
11021105
netif_device_detach(slave_dev);
11031106

11041107
if (p->phy) {
@@ -1116,6 +1119,9 @@ int dsa_slave_resume(struct net_device *slave_dev)
11161119
{
11171120
struct dsa_slave_priv *p = netdev_priv(slave_dev);
11181121

1122+
if (!netif_running(slave_dev))
1123+
return 0;
1124+
11191125
netif_device_attach(slave_dev);
11201126

11211127
if (p->phy) {

0 commit comments

Comments
 (0)