1
0
Fork 0

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: 2446254915 ("net: dsa: allow switch drivers to implement suspend/resume hooks")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
zero-colors
Florian Fainelli 2018-07-31 17:12:52 -07:00 committed by David S. Miller
parent bc5b6c0b62
commit a94c689e6c
1 changed files with 6 additions and 0 deletions

View File

@ -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();
@ -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();