From patchwork Wed Jun 15 05:30:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 70078 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2392962qgf; Tue, 14 Jun 2016 22:31:17 -0700 (PDT) X-Received: by 10.66.218.195 with SMTP id pi3mr1763051pac.83.1465968676740; Tue, 14 Jun 2016 22:31:16 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g70si25672629pfb.119.2016.06.14.22.31.16; Tue, 14 Jun 2016 22:31:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752726AbcFOFbE (ORCPT + 30 others); Wed, 15 Jun 2016 01:31:04 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:34189 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752082AbcFOFbA (ORCPT ); Wed, 15 Jun 2016 01:31:00 -0400 Received: by mail-pf0-f178.google.com with SMTP id 62so5085515pfd.1 for ; Tue, 14 Jun 2016 22:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AQ+Owy2/51aEWQAX2VzTHhW0JX6uUtmnUkLZrrV5qEA=; b=J9IK08xC93fLQNWp4g+iS0yvu/yzWWP8gPhKsWQxpn8ZLNKlqY5PpMF6KkDK2rqbGl Zw+bjBI+2/mITLVGlYFU0u6bkWhxM8mk0yW+wKZDwEDOwRL3Qd3m3Z8jtBWmZlGc6kv4 cy1vvpjR+afucetU06GBYmy/EoMti5OvOtPTo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AQ+Owy2/51aEWQAX2VzTHhW0JX6uUtmnUkLZrrV5qEA=; b=GGav994Z1eFMXFeJ8K0//w+o7DRsMlmtCodGiEsd6e/bezWipJySUShsLKlsyA+YDs MDdxIr8L8X9MBCR13GWzSKgci+fVL1IQNBeJySV9cpp/A8kJRMjQmrKNq9XwbZgwDOCg gBEUS/mexG3P6ZTH3GTG6b0kqIOvkKEW3umeT2ytXUww2plV2BZ8ZyY/gHRc5QD4MYuV b1ZYy77j1ZuIYpw6mjPR8gkgOtj7GXma0Kmazapd+uu9iuZnzBcmd3Xx5yI8E8siPXG3 fNs9BYUddNQbESuNdMKEufZUbDAFsR0RORgSYqEj1lN9AOpykpTqFUUUE878P2m19l5+ KhaA== X-Gm-Message-State: ALyK8tKbR9L4inaXB7My7ebzSu5gp1+mOqZ9HTUizn74l3g97qbzsLA9ELZ/n61j7vv1Wx3j X-Received: by 10.98.66.208 with SMTP id h77mr1886187pfd.30.1465968659307; Tue, 14 Jun 2016 22:30:59 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id 81sm28286566pfo.74.2016.06.14.22.30.55 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jun 2016 22:30:58 -0700 (PDT) From: Binoy Jayan To: Greg Kroah-Hartman Cc: Johnny Kim , Austin Shin , Chris Park , Tony Cho , Glen Lee , Leo Kim , Arnd Bergmann , linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Binoy Jayan Subject: [PATCH v3 2/5] staging: wilc1000: Replace semaphore txq_add_to_head_cs with mutex Date: Wed, 15 Jun 2016 11:00:35 +0530 Message-Id: <1465968638-22129-3-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1465968638-22129-1-git-send-email-binoy.jayan@linaro.org> References: <1465814259-3009-1-git-send-email-binoy.jayan@linaro.org> <1465968638-22129-1-git-send-email-binoy.jayan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The semaphore 'txq_add_to_head_cs' is a simple mutex, so it should be written as one. Semaphores are going away in the future. Also, removing the timeout scenario as the error handling code does not propagate the timeout properly. Signed-off-by: Binoy Jayan Reviewed-by: Arnd Bergmann --- drivers/staging/wilc1000/linux_wlan.c | 4 ++-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 3 ++- drivers/staging/wilc1000/wilc_wlan.c | 11 ++++------- 3 files changed, 8 insertions(+), 10 deletions(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 90f906d..a933551 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -20,7 +20,7 @@ #include #include #include - +#include #include #include @@ -679,7 +679,7 @@ static int wlan_init_locks(struct net_device *dev) mutex_init(&wl->rxq_cs); spin_lock_init(&wl->txq_spinlock); - sema_init(&wl->txq_add_to_head_cs, 1); + mutex_init(&wl->txq_add_to_head_cs); init_completion(&wl->txq_event); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 12d7c7b..239cd43 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -43,6 +43,7 @@ #include "wilc_wlan.h" #include #include +#include #define FLOW_CONTROL_LOWER_THRESHOLD 128 #define FLOW_CONTROL_UPPER_THRESHOLD 256 @@ -171,7 +172,7 @@ struct wilc { struct wilc_vif *vif[NUM_CONCURRENT_IFC]; u8 open_ifcs; - struct semaphore txq_add_to_head_cs; + struct mutex txq_add_to_head_cs; spinlock_t txq_spinlock; struct mutex rxq_cs; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 1a57135..9afbe8d 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -99,9 +99,7 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif, unsigned long flags; struct wilc *wilc = vif->wilc; - if (wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs, - CFG_PKTS_TIMEOUT)) - return -1; + mutex_lock(&wilc->txq_add_to_head_cs); spin_lock_irqsave(&wilc->txq_spinlock, flags); @@ -119,7 +117,7 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif, wilc->txq_entries += 1; spin_unlock_irqrestore(&wilc->txq_spinlock, flags); - up(&wilc->txq_add_to_head_cs); + mutex_unlock(&wilc->txq_add_to_head_cs); complete(&wilc->txq_event); return 0; @@ -573,8 +571,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) if (wilc->quit) break; - wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs, - CFG_PKTS_TIMEOUT); + mutex_lock(&wilc->txq_add_to_head_cs); wilc_wlan_txq_filter_dup_tcp_ack(dev); tqe = wilc_wlan_txq_get_first(wilc); i = 0; @@ -755,7 +752,7 @@ _end_: if (ret != 1) break; } while (0); - up(&wilc->txq_add_to_head_cs); + mutex_unlock(&wilc->txq_add_to_head_cs); wilc->txq_exit = 1; *txq_count = wilc->txq_entries;