diff options
author | 2020-06-22 16:26:02 -0700 | |
---|---|---|
committer | 2020-06-22 16:26:02 -0700 | |
commit | 3b87cfefab40604306e5fe6eb4b8c5ec99a865d3 (patch) | |
tree | e7a475880dc0f1d807032498b6688e9b91763b88 /net | |
parent | Merge branch 'prepare-dwmac-meson8b-for-G12A-specific-initialization' (diff) | |
parent | r8169: improve rtl8169_runtime_resume (diff) | |
download | wireguard-linux-3b87cfefab40604306e5fe6eb4b8c5ec99a865d3.tar.xz wireguard-linux-3b87cfefab40604306e5fe6eb4b8c5ec99a865d3.zip |
Merge branch 'r8169-mark-device-as-detached-in-PCI-D3-and-improve-locking'
Heiner Kallweit says:
====================
r8169: mark device as detached in PCI D3 and improve locking
Mark the netdevice as detached whenever parent is in PCI D3hot and not
accessible. This mainly applies to runtime-suspend state.
In addition take RTNL lock in suspend calls, this allows to remove
the driver-specific mutex and improve PM callbacks in general.
====================
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index cea7fc1716ca..c5ec4d50acd1 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -143,6 +143,7 @@ #include <linux/net_namespace.h> #include <linux/indirect_call_wrapper.h> #include <net/devlink.h> +#include <linux/pm_runtime.h> #include "net-sysfs.h" @@ -1492,8 +1493,13 @@ static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack) ASSERT_RTNL(); - if (!netif_device_present(dev)) - return -ENODEV; + if (!netif_device_present(dev)) { + /* may be detached because parent is runtime-suspended */ + if (dev->dev.parent) + pm_runtime_resume(dev->dev.parent); + if (!netif_device_present(dev)) + return -ENODEV; + } /* Block netpoll from trying to do any rx path servicing. * If we don't do this there is a chance ndo_poll_controller |