提交 a94c689e 编写于 作者: F Florian Fainelli 提交者: 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: NFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册