wil6210: fix interface-up check
authorHamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Tue, 8 Aug 2017 11:16:47 +0000 (14:16 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 8 Aug 2017 18:44:14 +0000 (21:44 +0300)
While wil_open is executed, any call to netif_running
would return a success. In case there are failures
within wil_open, should not treat the device as if it
is already opened in relevant functions (like FW recovery
and runtime suspend check).

Fix that by checking the device up flag instead.

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/wil6210/main.c
drivers/net/wireless/ath/wil6210/pm.c

index 8968c2c51a1b43a23f236d2c82772774e8844719..b1e281442ba3fef40406f7fc43cf9aecc6d60f2c 100644 (file)
@@ -394,10 +394,11 @@ static void wil_fw_error_worker(struct work_struct *work)
        struct wil6210_priv *wil = container_of(work, struct wil6210_priv,
                                                fw_error_worker);
        struct wireless_dev *wdev = wil->wdev;
+       struct net_device *ndev = wil_to_ndev(wil);
 
        wil_dbg_misc(wil, "fw error worker\n");
 
-       if (!netif_running(wil_to_ndev(wil))) {
+       if (!(ndev->flags & IFF_UP)) {
                wil_info(wil, "No recovery - interface is down\n");
                return;
        }
index 820ed17ae2d4fe1dcbd87eab066b6b2bbda5922a..8f5d1b447aaa2d72a51bfab141cc81b33c7278d7 100644 (file)
@@ -21,10 +21,11 @@ int wil_can_suspend(struct wil6210_priv *wil, bool is_runtime)
 {
        int rc = 0;
        struct wireless_dev *wdev = wil->wdev;
+       struct net_device *ndev = wil_to_ndev(wil);
 
        wil_dbg_pm(wil, "can_suspend: %s\n", is_runtime ? "runtime" : "system");
 
-       if (!netif_running(wil_to_ndev(wil))) {
+       if (!(ndev->flags & IFF_UP)) {
                /* can always sleep when down */
                wil_dbg_pm(wil, "Interface is down\n");
                goto out;