Skip to content

Commit

Permalink
net: dsa: Do not suspend/resume closed slave_dev
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ffainelli authored and davem330 committed Aug 1, 2018
1 parent bc5b6c0 commit a94c689
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,9 @@ int dsa_slave_suspend(struct net_device *slave_dev)
{
struct dsa_port *dp = dsa_slave_to_port(slave_dev);

if (!netif_running(slave_dev))
return 0;

netif_device_detach(slave_dev);

rtnl_lock();
Expand All @@ -1261,6 +1264,9 @@ int dsa_slave_resume(struct net_device *slave_dev)
{
struct dsa_port *dp = dsa_slave_to_port(slave_dev);

if (!netif_running(slave_dev))
return 0;

netif_device_attach(slave_dev);

rtnl_lock();
Expand Down

0 comments on commit a94c689

Please sign in to comment.