From patchwork Thu Jun 2 04:57:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69124 Delivered-To: patch@linaro.org Received: by 10.140.23.41 with SMTP id 38csp143337qgo; Wed, 1 Jun 2016 21:59:11 -0700 (PDT) X-Received: by 10.98.72.27 with SMTP id v27mr837430pfa.143.1464843551456; Wed, 01 Jun 2016 21:59:11 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 81si55741621pfc.142.2016.06.01.21.59.11; Wed, 01 Jun 2016 21:59:11 -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 S1752030AbcFBE7B (ORCPT + 30 others); Thu, 2 Jun 2016 00:59:01 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:34456 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751741AbcFBE6g (ORCPT ); Thu, 2 Jun 2016 00:58:36 -0400 Received: by mail-pa0-f53.google.com with SMTP id bz2so2680187pad.1 for ; Wed, 01 Jun 2016 21:58:36 -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=b4Psr3CRFqWUhZ6lbCqXAortKnFbyTW4Cdhzp7Qqoeo=; b=WbWpFf+YRlf/T6c3Zj1HPPecCAm87DHvXxNyFDa1kYU7d7FmDv6S8bz7QokWZ/b5rJ ZAIoGb7EkJYe53jShsZ/IiOYwkIKL9sozW/ZFCekFxwriXfz7UY0eb0ovlKwm4bHazJ1 T95zqX9ymXcD+ek+EABGdj8movX9mEg0yF/nY= 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=b4Psr3CRFqWUhZ6lbCqXAortKnFbyTW4Cdhzp7Qqoeo=; b=bDwF+lUlfP47i7Onrfz/TUTDMcvp8GZQXxLHzAGtIMP26c/kUDbnL9cFfMCHC/sJxx GRYfo0uP8662L7IjPWzp34G71sd9tVSKX/8mTtQ6YCRPaPLj8uHwx1BLb3pAwK4TR3AP vZpAKLa0HgYovGw+RvPnqqbbXcujn5a2dYfap4PB02ti0ra0i+jQU17D8cqVb+rFx0xh +8pXPxDnQSwqoAV/vKzPfZo1Sxx+h29TDeB+aBT4a/dnX8DRhyHCFgbh6cqNgQmvnY2n a82bIb6zuTmHMpcaK47iY846GfyXbRG0eIZSRjUTEXuWzdztY1RUdGDIucYGh8IDi2ZT O6eQ== X-Gm-Message-State: ALyK8tIZXAVuuQZEGMUebEd2AAmaVnRPsvBSIdM8jaIvJodsCryWDDqytt5DH7p5g96w/kLZ X-Received: by 10.66.132.72 with SMTP id os8mr2767354pab.63.1464843516344; Wed, 01 Jun 2016 21:58:36 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id o64sm17622964pfb.76.2016.06.01.21.58.33 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Jun 2016 21:58:35 -0700 (PDT) From: Binoy Jayan To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Binoy Jayan Subject: [PATCH 3/4] rtl8192u: Replace semaphore scan_sem with mutex Date: Thu, 2 Jun 2016 10:27:54 +0530 Message-Id: <1464843475-4870-4-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1464843475-4870-1-git-send-email-binoy.jayan@linaro.org> References: <1464843475-4870-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 'scan_sem' in rtl8192u is a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- This patch depends on the following patch: rtl8192u: ieee80211_device: Replace semaphore wx_sem with mutex drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 +- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 18 +++++++++--------- 2 files changed, 10 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/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index ef9ae22..09e9499 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -1800,7 +1800,7 @@ struct ieee80211_device { short proto_started; struct mutex wx_mutex; - struct semaphore scan_sem; + struct mutex scan_mutex; spinlock_t mgmt_tx_lock; spinlock_t beacon_lock; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index c983e49..e8e83f5 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -427,7 +427,7 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) short ch = 0; u8 channel_map[MAX_CHANNEL_NUMBER+1]; memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); - down(&ieee->scan_sem); + mutex_lock(&ieee->scan_mutex); while(1) { @@ -475,13 +475,13 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) out: if(ieee->state < IEEE80211_LINKED){ ieee->actscanning = false; - up(&ieee->scan_sem); + mutex_unlock(&ieee->scan_mutex); } else{ ieee->sync_scan_hurryup = 0; if(IS_DOT11D_ENABLE(ieee)) DOT11D_ScanComplete(ieee); - up(&ieee->scan_sem); + mutex_unlock(&ieee->scan_mutex); } } EXPORT_SYMBOL(ieee80211_softmac_scan_syncro); @@ -495,7 +495,7 @@ static void ieee80211_softmac_scan_wq(struct work_struct *work) memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); if(!ieee->ieee_up) return; - down(&ieee->scan_sem); + mutex_lock(&ieee->scan_mutex); do{ ieee->current_network.channel = (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; @@ -517,7 +517,7 @@ static void ieee80211_softmac_scan_wq(struct work_struct *work) schedule_delayed_work(&ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); - up(&ieee->scan_sem); + mutex_unlock(&ieee->scan_mutex); return; out: if(IS_DOT11D_ENABLE(ieee)) @@ -525,7 +525,7 @@ out: ieee->actscanning = false; watchdog = 0; ieee->scanning = 0; - up(&ieee->scan_sem); + mutex_unlock(&ieee->scan_mutex); } @@ -579,7 +579,7 @@ static void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) //ieee->sync_scan_hurryup = 1; - down(&ieee->scan_sem); + mutex_lock(&ieee->scan_mutex); // spin_lock_irqsave(&ieee->lock, flags); if (ieee->scanning == 1) { @@ -589,7 +589,7 @@ static void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) } // spin_unlock_irqrestore(&ieee->lock, flags); - up(&ieee->scan_sem); + mutex_unlock(&ieee->scan_mutex); } void ieee80211_stop_scan(struct ieee80211_device *ieee) @@ -2729,7 +2729,7 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) mutex_init(&ieee->wx_mutex); - sema_init(&ieee->scan_sem, 1); + mutex_init(&ieee->scan_mutex); spin_lock_init(&ieee->mgmt_tx_lock); spin_lock_init(&ieee->beacon_lock);