From patchwork Thu Jun 2 10:53:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69144 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp48855qgf; Thu, 2 Jun 2016 03:53:44 -0700 (PDT) X-Received: by 10.66.14.73 with SMTP id n9mr4249013pac.112.1464864824236; Thu, 02 Jun 2016 03:53:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 66si57628011pfn.73.2016.06.02.03.53.43; Thu, 02 Jun 2016 03:53:44 -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 S932446AbcFBKx3 (ORCPT + 30 others); Thu, 2 Jun 2016 06:53:29 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:36120 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753157AbcFBKx1 (ORCPT ); Thu, 2 Jun 2016 06:53:27 -0400 Received: by mail-pa0-f47.google.com with SMTP id te7so1686236pab.3 for ; Thu, 02 Jun 2016 03:53:27 -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=cuwzXJuIpSpa1SZX46jwRrxVNSMQ+XD1KezGTxDzPCqSOhhx3CRLY+bp5luQC3X5T0 zgKmekwuSQRQV9DGswAASa6Yv4dW69/kVDnILqXfwyIG987D/DFatOdUtfSd6nzv1wiV z0tOmdPqvTsRJcR47crne0YJ1Z+mX/E78zn7E= 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=CxW4LsrjINRnVqpQEKj7NHmlIEJINhCoF4QVtUv157sPxSrdssiaNvCcH/KDUYge4/ 1egLv01UYGyhXsUQJnmTPFp5OpDnNCNLf+nu4ffXTMYOfGp3CFvN1VHs8YSTyC4HN1n1 psg0w/BULufEglDGeOXfGLSCc/XrtaPXkJxymOXSOrF4zsWHt3fNLyTcssz+Yb3R6trM rafPi5syqVX4XN/1oI13NdSGIac4k9gzkcWuOXh166ct9hO65lBvh+90BT5Zz/gmM9dg 8ByfWP7PM7UMdusoqyHpENn7j7RgjrqrfdEnimWJ1Bl/8t6bMHWLgyuXHpvEGdoryYDK 6DNA== X-Gm-Message-State: ALyK8tIIrQjtwELKGl2ZsYzbmsKFlWF1WmgdRCTC6JiMoW5mHlfIcEc5e85aKgUo32ZX2DEq X-Received: by 10.66.222.202 with SMTP id qo10mr4423129pac.141.1464864806542; Thu, 02 Jun 2016 03:53:26 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id x71sm29190142pfj.43.2016.06.02.03.53.24 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Jun 2016 03:53:25 -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 v2 3/4] rtl8192u: Replace semaphore scan_sem with mutex Date: Thu, 2 Jun 2016 16:23:01 +0530 Message-Id: <1464864782-424-4-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1464864782-424-1-git-send-email-binoy.jayan@linaro.org> References: <1464843475-4870-1-git-send-email-binoy.jayan@linaro.org> <1464864782-424-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);