From patchwork Thu Aug 3 19:08:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 9879743 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 B779560360 for ; Thu, 3 Aug 2017 19:09:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A84B828962 for ; Thu, 3 Aug 2017 19:09:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D37E28966; Thu, 3 Aug 2017 19:09:18 +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 448DD28967 for ; Thu, 3 Aug 2017 19:09:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751977AbdHCTIn (ORCPT ); Thu, 3 Aug 2017 15:08:43 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:49050 "EHLO alexa-out-lv-02.qualcomm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751961AbdHCTIl (ORCPT ); Thu, 3 Aug 2017 15:08:41 -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=1501787321; x=1533323321; h=cc:from:to:subject:date:message-id:in-reply-to: references; bh=wJTQofrytYpHZlMqImQoQHqUc9N5gb59MJ9dsfb09xs=; b=E+CWYr/mtQKyTxBbNhOup+o5v//WjZKdrzeyNqqrScDfM76Nh+DxY1Ly 7+t0QX7WOkRGwCbj/B9u9Qch6rzRrUJ4aW+IZVaaREEMp03W8VPbgMvAZ d/lvTf2n9yQe/5SIDYzBMNGJyItvv1glszfpTWXXFgIlWQNHgB8r29XzU Q=; X-IronPort-AV: E=Sophos;i="5.41,317,1498546800"; d="scan'208";a="2484440" Received: from ironmsg03-r-new.qualcomm.com (HELO Ironmsg03-R.qualcomm.com) ([10.53.140.107]) by alexa-out-lv-02.qualcomm.com with ESMTP; 03 Aug 2017 12:08:41 -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="1417424287" X-MGA-submission: =?us-ascii?q?MDGHax5ylRpW2dpjxEiOqxuacxHl2KNpZ5qIVX?= =?us-ascii?q?Rfvy2ufFLlbpkiw6dCSrP/Xm2+ycoWfvXMOlI9tS6dQsIJ2ofJw3Z1Ml?= =?us-ascii?q?tZNmeo/64V7Uh19/zKG+0cZNvHhkELOE5ZVYUSa00QXpBq+6dvz/BmUC?= =?us-ascii?q?Zl?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by Ironmsg03-R.qualcomm.com with ESMTP; 03 Aug 2017 12:08:39 -0700 From: Maya Erez To: Kalle Valo Subject: [PATCH v4 07/10] wil6210: fix interface-up check Date: Thu, 3 Aug 2017 22:08:19 +0300 Message-Id: <1501787302-22885-8-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501787302-22885-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1501787302-22885-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;