From patchwork Thu Aug 3 13:25:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 9879105 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 703FC603B4 for ; Thu, 3 Aug 2017 13:26:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 637882885F for ; Thu, 3 Aug 2017 13:26:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 585D0288E4; Thu, 3 Aug 2017 13:26: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 048062885F for ; Thu, 3 Aug 2017 13:26:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751942AbdHCNZ7 (ORCPT ); Thu, 3 Aug 2017 09:25:59 -0400 Received: from sabertooth02.qualcomm.com ([65.197.215.38]:45841 "EHLO sabertooth02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751900AbdHCNZ4 (ORCPT ); Thu, 3 Aug 2017 09:25:56 -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=1501766756; x=1533302756; h=cc:from:to:subject:date:message-id:in-reply-to: references; bh=wJTQofrytYpHZlMqImQoQHqUc9N5gb59MJ9dsfb09xs=; b=QGB/+5RsUG1VLB3FBf6EWLhln8fQMQE+EHYGsD7d0vd1KTWrMf1Pjrgv zgNh9uWkh3flpF2zs/bJAiceDoy/ZqrFB8qIc+ove1xA7i6nbXaIMr/db sZlYGoqtVKGDmNlfnyraHuQGI53ZrC45mrEmsIXSBI25Cqi0B1FThDNRS c=; X-IronPort-AV: E=Sophos;i="5.41,316,1498546800"; d="scan'208";a="112982871" Received: from unknown (HELO ironmsg02-R.qualcomm.com) ([10.53.140.106]) by sabertooth02.qualcomm.com with ESMTP; 03 Aug 2017 06:25:56 -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="1010143098" X-MGA-submission: =?us-ascii?q?MDE1atGbOCX290NCSiJtKe6dOgXGP5hg7SlESY?= =?us-ascii?q?E3ik+Qjl9fm7UWBERJfBXPDxehOGYwbBgpfmyHytpmEqaevvBAPjHgGe?= =?us-ascii?q?LT+jcHaCcFCFhn3paOqECr9/S9MktpXp6JwLhImHWeMbFIxSd5jl4y/I?= =?us-ascii?q?Wk?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by ironmsg02-R.qualcomm.com with ESMTP; 03 Aug 2017 06:25:55 -0700 From: Maya Erez To: Kalle Valo Subject: [PATCH v3 7/9] wil6210: fix interface-up check Date: Thu, 3 Aug 2017 16:25:37 +0300 Message-Id: <1501766739-31996-8-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501766739-31996-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1501766739-31996-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;