From patchwork Wed Aug 2 21:00:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 9877763 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1FD0D60360 for ; Wed, 2 Aug 2017 21:01:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 126DC2882F for ; Wed, 2 Aug 2017 21:01:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 078BA28831; Wed, 2 Aug 2017 21:01:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F43B2882F for ; Wed, 2 Aug 2017 21:01:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752902AbdHBVBL (ORCPT ); Wed, 2 Aug 2017 17:01:11 -0400 Received: from sabertooth01.qualcomm.com ([65.197.215.72]:35554 "EHLO sabertooth01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752616AbdHBVBJ (ORCPT ); Wed, 2 Aug 2017 17:01:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1501707669; x=1533243669; h=cc:from:to:subject:date:message-id:in-reply-to: references; bh=wJTQofrytYpHZlMqImQoQHqUc9N5gb59MJ9dsfb09xs=; b=MkTQirL5uQtT8zHL+di7PZi3PlwcRaEjpe412Bk8AxteCo194IOeljkr y2oMhmNP3lOkLWi8IpItO4zrJuPpXDTH2c40snHWyOXa030FK7MVjaTSf i/rAlmQncBDw92NKkU7tx5McmaW98+08vvcYFatOppFJzwfjhih1EQfWz g=; X-IronPort-AV: E=Sophos;i="5.41,313,1498546800"; d="scan'208";a="111952947" Received: from unknown (HELO ironmsg02-R.qualcomm.com) ([10.53.140.106]) by sabertooth01.qualcomm.com with ESMTP; 02 Aug 2017 14:01:09 -0700 Cc: Hamad Kadmany , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez X-IronPort-AV: E=McAfee;i="5900,7806,8610"; a="1009681592" X-MGA-submission: =?us-ascii?q?MDH7Cxhp/+4F2RerQmTc1C3CKBNQv3belHF9P6?= =?us-ascii?q?TCvxbLRGTZH+sWRwMDD4hCeTKA6VszmrlPSfl/ZAtNSNLaE0EePSC+HF?= =?us-ascii?q?bqrxB9f6BshvixxcIGNnSomfkn9CoX7kA7AfvDkUCGJFf5bPzE4F2bq9?= =?us-ascii?q?ot?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by ironmsg02-R.qualcomm.com with ESMTP; 02 Aug 2017 14:01:07 -0700 From: Maya Erez To: Kalle Valo Subject: [PATCH v2 7/9] wil6210: fix interface-up check Date: Thu, 3 Aug 2017 00:00:47 +0300 Message-Id: <1501707649-9665-8-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501707649-9665-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1501707649-9665-1-git-send-email-qca_merez@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hamad Kadmany 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 Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/main.c | 3 ++- drivers/net/wireless/ath/wil6210/pm.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index 8968c2c..b1e2814 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c @@ -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; } diff --git a/drivers/net/wireless/ath/wil6210/pm.c b/drivers/net/wireless/ath/wil6210/pm.c index 820ed17..8f5d1b44 100644 --- a/drivers/net/wireless/ath/wil6210/pm.c +++ b/drivers/net/wireless/ath/wil6210/pm.c @@ -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;