From patchwork Mon Jul 31 16:32:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 9872459 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 AF98C60365 for ; Mon, 31 Jul 2017 16:32:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99B1728508 for ; Mon, 31 Jul 2017 16:32:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DF4C2842E; Mon, 31 Jul 2017 16:32:55 +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 0C28228470 for ; Mon, 31 Jul 2017 16:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752579AbdGaQcy (ORCPT ); Mon, 31 Jul 2017 12:32:54 -0400 Received: from sabertooth02.qualcomm.com ([65.197.215.38]:37826 "EHLO sabertooth02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752555AbdGaQcv (ORCPT ); Mon, 31 Jul 2017 12:32:51 -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=1501518771; x=1533054771; h=cc:from:to:subject:date:message-id:in-reply-to: references; bh=Q731X9lKhfd/oleJk7DGK3WkAfYQc2xE3XSw5LrZDzg=; b=gy+zZ8UC5oxpw/g60t9F6dYMDNTQgjd2BrDu7QuxTDhDtfvuWtfy8lSF E5ZQiM41msyHofNMRwLZZBHu6NToJfIc0C5fKg+iaJ67HEcyZlgLhn/uh QI8/UEN3gqRbWj/7AuYH3exBelQ6Ws/65EqqsDGiMwN1ojlgj4c6BJg8e Y=; X-IronPort-AV: E=Sophos;i="5.41,304,1498546800"; d="scan'208";a="112898162" Received: from unknown (HELO ironmsg02-L.qualcomm.com) ([10.53.140.109]) by sabertooth02.qualcomm.com with ESMTP; 31 Jul 2017 09:32:51 -0700 Cc: Hamad Kadmany , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez X-IronPort-AV: E=McAfee;i="5900,7806,8608"; a="974365147" X-MGA-submission: =?us-ascii?q?MDFQQ0CymF/jgCGgXcnHfvzWA+oP7guI1d8JmV?= =?us-ascii?q?b+ToK3aCwlE1irMyP2ilXyKvvzqnX778nA8F2QvR8YWaQmH8srKsi9qx?= =?us-ascii?q?QLxhuon8pNAvs1V6pR6l+/d8/1XD3zITOcNxo9MxXIZ4aWTdykTmSA+r?= =?us-ascii?q?e1?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by ironmsg02-L.qualcomm.com with ESMTP; 31 Jul 2017 09:32:49 -0700 From: Maya Erez To: Kalle Valo Subject: [PATCH 08/10] wil6210: fix interface-up check Date: Mon, 31 Jul 2017 19:32:31 +0300 Message-Id: <1501518753-6339-9-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501518753-6339-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1501518753-6339-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 | 4 +++- 2 files changed, 5 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 4a18f8e..4f61dc1 100644 --- a/drivers/net/wireless/ath/wil6210/pm.c +++ b/drivers/net/wireless/ath/wil6210/pm.c @@ -24,6 +24,7 @@ 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); bool wmi_only = test_bit(WMI_FW_CAPABILITY_WMI_ONLY, wil->fw_capabilities); @@ -35,7 +36,8 @@ int wil_can_suspend(struct wil6210_priv *wil, bool is_runtime) rc = -EPERM; goto out; } - 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;