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
[ 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 <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>
  • Loading branch information
Florian Fainelli authored and Greg Kroah-Hartman committed Aug 6, 2018
1 parent df30bfc commit b5fef54
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 @@ -1099,6 +1099,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) {
Expand All @@ -1116,6 +1119,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) {
Expand Down

0 comments on commit b5fef54

Please sign in to comment.