From patchwork Tue Feb 23 07:28:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Shafi Shajakhan X-Patchwork-Id: 8388291 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C6EBAC0553 for ; Tue, 23 Feb 2016 07:29:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E7BDD206B2 for ; Tue, 23 Feb 2016 07:29:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E31E206AA for ; Tue, 23 Feb 2016 07:29:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aY7PN-0004HJ-WA; Tue, 23 Feb 2016 07:29:22 +0000 Received: from wolverine01.qualcomm.com ([199.106.114.254]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aY7PM-0004E1-TA for ath10k@lists.infradead.org; Tue, 23 Feb 2016 07:29:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1456212560; x=1487748560; h=from:to:cc:subject:date:message-id:mime-version; bh=HFr9dtDyIML8fiKWb2OOeSh6uai8U5UYEu16URvK1/k=; b=BvqZUA5SVZeyPzAgXj8HckhqvOQHBp7bRnxr5d99Y8o4Xh1+Jb2904fY kj5nCE6nz0aE4B2JD+k4Sl9kU90iA0J7AuyAjAyiBEHgdlKeZRtFzDR34 VriUV2CjpJyzfQmmDVDAH8IdEUQqjePu/eyShJ162xAF8FFK8fv/tY9jK 0=; X-IronPort-AV: E=Sophos;i="5.22,488,1449561600"; d="scan'208";a="171051557" Received: from unknown (HELO Ironmsg04-R.qualcomm.com) ([10.53.140.108]) by wolverine01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Feb 2016 23:28:58 -0800 From: Mohammed Shafi Shajakhan X-IronPort-AV: E=McAfee;i="5700,7163,8083"; a="1143388189" Received: from nasanexm01f.na.qualcomm.com ([10.85.0.32]) by Ironmsg04-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 22 Feb 2016 23:28:53 -0800 Received: from aphydexm01b.ap.qualcomm.com (10.252.127.11) by NASANEXM01F.na.qualcomm.com (10.85.0.32) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Mon, 22 Feb 2016 23:28:53 -0800 Received: from qcmail1.qualcomm.com (10.80.80.8) by aphydexm01b.ap.qualcomm.com (10.252.127.11) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Tue, 23 Feb 2016 12:58:46 +0530 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Tue, 23 Feb 2016 12:58:37 +0530 To: Subject: [PATCH] ath10k: Fix sanity check on enabling btcoex via debugfs Date: Tue, 23 Feb 2016 12:58:36 +0530 Message-ID: <1456212516-3989-1-git-send-email-mohammed@qca.qualcomm.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01G.na.qualcomm.com (10.85.0.33) To aphydexm01b.ap.qualcomm.com (10.252.127.11) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160222_232921_035081_1166F2CE X-CRM114-Status: UNSURE ( 9.75 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -7.0 (-------) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kalle Valo , linux-wireless@vger.kernel.org, Mohammed Shafi Shajakhan Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mohammed Shafi Shajakhan First check for the device state before enabling / disabling btcoex, also return a proper error value. Enabling / disabling btcoex ideally does a f/w + ath10k_core_restart so the checks that are applicable for 'simulate_fw_crash' shall be applicable for this as well Signed-off-by: Mohammed Shafi Shajakhan --- drivers/net/wireless/ath/ath10k/debug.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 628b031..e3e29fb 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -2116,6 +2116,7 @@ static ssize_t ath10k_write_btcoex(struct file *file, struct ath10k *ar = file->private_data; char buf[32]; size_t buf_size; + int ret = 0; bool val; buf_size = min(count, (sizeof(buf) - 1)); @@ -2129,6 +2130,12 @@ static ssize_t ath10k_write_btcoex(struct file *file, mutex_lock(&ar->conf_mutex); + if (ar->state != ATH10K_STATE_ON && + ar->state != ATH10K_STATE_RESTARTED) { + ret = -ENETDOWN; + goto exit; + } + if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val)) goto exit; @@ -2137,17 +2144,15 @@ static ssize_t ath10k_write_btcoex(struct file *file, else clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); - if (ar->state != ATH10K_STATE_ON) - goto exit; - ath10k_info(ar, "restarting firmware due to btcoex change"); queue_work(ar->workqueue, &ar->restart_work); + ret = count; exit: mutex_unlock(&ar->conf_mutex); - return count; + return ret; } static ssize_t ath10k_read_btcoex(struct file *file, char __user *ubuf,