Commit a94c689e authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: dsa: Do not suspend/resume closed slave_dev

If a DSA slave network device was previously disabled, there is no need
to suspend or resume it.

Fixes: 24462549 ("net: dsa: allow switch drivers to implement suspend/resume hooks")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bc5b6c0b
...@@ -1248,6 +1248,9 @@ int dsa_slave_suspend(struct net_device *slave_dev) ...@@ -1248,6 +1248,9 @@ int dsa_slave_suspend(struct net_device *slave_dev)
{ {
struct dsa_port *dp = dsa_slave_to_port(slave_dev); struct dsa_port *dp = dsa_slave_to_port(slave_dev);
if (!netif_running(slave_dev))
return 0;
netif_device_detach(slave_dev); netif_device_detach(slave_dev);
rtnl_lock(); rtnl_lock();
...@@ -1261,6 +1264,9 @@ int dsa_slave_resume(struct net_device *slave_dev) ...@@ -1261,6 +1264,9 @@ int dsa_slave_resume(struct net_device *slave_dev)
{ {
struct dsa_port *dp = dsa_slave_to_port(slave_dev); struct dsa_port *dp = dsa_slave_to_port(slave_dev);
if (!netif_running(slave_dev))
return 0;
netif_device_attach(slave_dev); netif_device_attach(slave_dev);
rtnl_lock(); rtnl_lock();
......
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