diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2018-07-31 17:12:52 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-08-06 16:23:03 +0200 |
commit | ab9a0f80bce707fa4f8b4d63ad1f3b2a89079caa (patch) | |
tree | 62779e60e9d2698aec7b675405ffa0b4192a29b4 /net/dsa | |
parent | d59dcdf13ee5b27a54940a05474230bda3a50edb (diff) |
net: dsa: Do not suspend/resume closed slave_dev
[ Upstream commit a94c689e6c9e72e722f28339e12dff191ee5a265 ]
If a DSA slave network device was previously disabled, there is no need
to suspend or resume it.
Fixes: 2446254915a7 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 5000e6f20f4a..339d9c678d3e 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1199,6 +1199,9 @@ int dsa_slave_suspend(struct net_device *slave_dev) { struct dsa_slave_priv *p = netdev_priv(slave_dev); + if (!netif_running(slave_dev)) + return 0; + netif_device_detach(slave_dev); if (p->phy) { @@ -1216,6 +1219,9 @@ int dsa_slave_resume(struct net_device *slave_dev) { struct dsa_slave_priv *p = netdev_priv(slave_dev); + if (!netif_running(slave_dev)) + return 0; + netif_device_attach(slave_dev); if (p->phy) { |