From patchwork Fri Jul 17 07:13:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Fenkart X-Patchwork-Id: 6813461 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 03B079F358 for ; Fri, 17 Jul 2015 07:13:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 106B42065D for ; Fri, 17 Jul 2015 07:13:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EF9120653 for ; Fri, 17 Jul 2015 07:13:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757021AbbGQHNw (ORCPT ); Fri, 17 Jul 2015 03:13:52 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:35324 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757013AbbGQHNv (ORCPT ); Fri, 17 Jul 2015 03:13:51 -0400 Received: by wgav7 with SMTP id v7so9591330wga.2 for ; Fri, 17 Jul 2015 00:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PM4U7CrZibYRHA0lCHQ47zu/UQ5IcZjntND/apwF8HI=; b=pYkdmmfRLspssDVOIugvB4jv+xuo6hXbNDkkwNYFMlR4YWPX1hsiTD3Ft+/Cp8dtPH elwYMh+VwBZDipC/7KIv+zfooaXyHDQhgZnLOYIcNdL2xXPEjbiVX2bEZAFg9glpV2BF 9gbiM/MVRfvwZdk3myjf4gbB7R+F3PJxa+vbciEiWvQ31E4mEjPbmss+Dl6VszDUkPZE zPfV3sLowNPNK8ECA4kEsneO1hmaMQxThcse4A0YGDtXuqcGwMZYp3uyb2pwWm5RoeUu kO7FNUDvJ4nypeGoIwldX62v8qLnqB1xnCrLIu/Y8/ZH+6Zybh52KNDbxAI7BQJMqOCF HMnQ== X-Received: by 10.194.121.131 with SMTP id lk3mr25973828wjb.77.1437117230757; Fri, 17 Jul 2015 00:13:50 -0700 (PDT) Received: from localhost (ip-89-176-167-254.net.upcbroadband.cz. [89.176.167.254]) by smtp.gmail.com with ESMTPSA id u7sm7054174wif.3.2015.07.17.00.13.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2015 00:13:50 -0700 (PDT) From: Andreas Fenkart To: linux-wireless@vger.kernel.org Cc: Amitkumar Karwar , Kalle Valo , Andreas Fenkart Subject: [PATCH 4/4] mwifiex: simplify mwifiex_complete_cmd Date: Fri, 17 Jul 2015 09:13:06 +0200 Message-Id: <1437117186-25243-5-git-send-email-afenkart@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1437117186-25243-1-git-send-email-afenkart@gmail.com> References: <1437117186-25243-1-git-send-email-afenkart@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 600f5d909a54("mwifiex: cleanup ioctl wait queue and abstraction layer") introduced the wakeup_interruptible suppression in mwifiex_complete_cmd b1a47aa5e1e1("mwifiex: fix system hang issue in cmd timeout error case") then added wakup_interruptible to mwifiex_cmd_timeout_func the single place setting a status of ETIMEDOUT. Instead of doing extra work, using the standard call-chain will have the same effect: mwifiex_cancel_pending_ioctl -> mwifiex_recycle_cmd_node -> mwifiex_insert_cmd_to_free_q -> mwifiex_complete_cmd -> wake_up_interruptible The difference is that previously the condition was not set to true, but that's probably just an oversight in b1a47aa5e1e1 and shouldn't have any consequence Signed-off-by: Andreas Fenkart Acked-by: Amitkumar Karwar --- drivers/net/wireless/mwifiex/cmdevt.c | 1 - drivers/net/wireless/mwifiex/sta_ioctl.c | 4 ++-- drivers/net/wireless/mwifiex/util.c | 12 ++++-------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 6458e17..27b778d 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c @@ -976,7 +976,6 @@ mwifiex_cmd_timeout_func(unsigned long function_context) if (cmd_node->wait_q_enabled) { adapter->cmd_wait_q.status = -ETIMEDOUT; - wake_up_interruptible(&adapter->cmd_wait_q.wait); mwifiex_cancel_pending_ioctl(adapter); } } diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index d8b7d9c..a6c8a4f 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c @@ -66,8 +66,8 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, if (status <= 0) { if (status == 0) status = -ETIMEDOUT; - mwifiex_dbg(adapter, ERROR, - "cmd_wait_q terminated: %d\n", status); + mwifiex_dbg(adapter, ERROR, "cmd_wait_q terminated: %d\n", + status); mwifiex_cancel_all_pending_cmd(adapter); return status; } diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c index 790e619..b65ef5b 100644 --- a/drivers/net/wireless/mwifiex/util.c +++ b/drivers/net/wireless/mwifiex/util.c @@ -496,16 +496,12 @@ int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb) int mwifiex_complete_cmd(struct mwifiex_adapter *adapter, struct cmd_ctrl_node *cmd_node) { - mwifiex_dbg(adapter, CMD, - "cmd completed: status=%d\n", + WARN_ON(!cmd_node->wait_q_enabled); + mwifiex_dbg(adapter, CMD, "cmd completed: status=%d\n", adapter->cmd_wait_q.status); - *(cmd_node->condition) = true; - - if (adapter->cmd_wait_q.status == -ETIMEDOUT) - mwifiex_dbg(adapter, ERROR, "cmd timeout\n"); - else - wake_up_interruptible(&adapter->cmd_wait_q.wait); + *cmd_node->condition = true; + wake_up_interruptible(&adapter->cmd_wait_q.wait); return 0; }