diff mbox series

[1/1,SRU,H] UBUNTU: SAUCE: Revert "ethernet: alx: fix order of calls on resume"

Message ID 20210715132037.191837-2-chris.chiu@canonical.com
State New
Headers show
Series Fix this missing NIC after resume | expand

Commit Message

Chris Chiu July 15, 2021, 1:20 p.m. UTC
From: Chris Chiu <chris.chiu@canonical.com>

BugLink: https://bugs.launchpad.net/bugs/1931301

This reverts commit 59a1c7f9fbbb6d69924aefb9318b9a7a26546116.

We don't really need the upstream commit a4dcfbc4ee22 ("ethernet:
alx: fix order of calls on resume") after WoL feature support code
been added back. The order of calls on resume is already correct.

The WoL version suspend will do netif_device_detach despite of the
status of netif_running, but the netif_device_attach is not there
on resume if the netif_running return false in the previous commit.
The network interface will not be present after resume if its state
is not up and running before suspend.

Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
---
 drivers/net/ethernet/atheros/alx/main.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index 20eabdda7466..a2d16630571e 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -2011,18 +2011,17 @@  static int alx_resume(struct device *dev)
 		return -EIO;
 	}
 
-	if (!netif_running(netdev))
-		return 0;
-
-	rtnl_lock();
-	err = __alx_open(alx, true);
-	rtnl_unlock();
-	if (err)
-		return err;
+	if (netif_running(netdev)) {
+		rtnl_lock();
+		err = __alx_open(alx, true);
+		rtnl_unlock();
+		if (err)
+			return err;
+	}
 
 	netif_device_attach(netdev);
 
-	return 0;
+	return err;
 }
 #endif