From patchwork Tue Jun 21 11:45:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaehyun Lim X-Patchwork-Id: 9190359 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 184536075E for ; Tue, 21 Jun 2016 11:46:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07ECC28066 for ; Tue, 21 Jun 2016 11:46:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F04B92813A; Tue, 21 Jun 2016 11:46:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 57BCA28066 for ; Tue, 21 Jun 2016 11:46:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFK8E-0005D6-CU; Tue, 21 Jun 2016 11:46:14 +0000 Received: from mail-pa0-x244.google.com ([2607:f8b0:400e:c03::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFK8B-00053W-B4 for ath10k@lists.infradead.org; Tue, 21 Jun 2016 11:46:12 +0000 Received: by mail-pa0-x244.google.com with SMTP id ts6so1219537pac.0 for ; Tue, 21 Jun 2016 04:45: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=b/VA9EwRJPmkcKb/Q8k9PHHoQ9wEBNVvh0q/FmhhFac=; b=TRlxBcJu9MW3TAGUQFHSzwCs3G4ZYp4BbDMyEYCGro7iYb8gRmsOSD8Vp4K8fr0BTr MOZ67vwmvnJjjL3Au+Fz1dWvMR8tdw2AX/iYR7CV85NXMHf1kuz4U49PV5gRfxIeJBtR 6cpJ/CFtlUtWc86jQElBCXULIoGa36cQEWz3qbGX/adbdEk0fqMfUL7Z6YO3ZG+IKaDH RtNYk73fhGfXAO+wKY8uJLNoJp4nn052waU0nWiWs4EyjQxawWoS/Li6GRtZ4HxqWijR OEBOw65ObVos7aCDtqK4W/ogbUoRRLqdIiydOIe94yq8izrc87fDh9/KuuSDE30prDq1 UjRg== 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=b/VA9EwRJPmkcKb/Q8k9PHHoQ9wEBNVvh0q/FmhhFac=; b=LNFiVtAqvi3i0S2Rj8G6XraMrEbloL1Edol8riF7GC0dU+n6L1MkEdNl3zNchp5ryT T05C8/apuMShemw7zbwO7/5CMiY6ckID9TAmsVjy8jHVBfCxu4zc0ej8UWcKVBwfTH2g W6MADQxVxjywpXFWKf8k4pR5Vp3Ir+Y47n6f8IOGi5Yyk6PilUc530K5ZerKlK7jYVz2 oEUBLUjUz+U3euLRtWNqROMAXSiQagtX353Th8v8gfMWvgr1VCdukqzFLPavwaNvhARB k0FaUTis2Vnjum+0PBacflqQ80fOXk1YJw8KTgNJCeLShynhu5Jp0qIW0rAmSP/vtkw1 EzUQ== X-Gm-Message-State: ALyK8tI78ZoH6ZBdY3IQgb6bIRImSABlgNxw80Srmf/ABej8RxHdDsCXAfZukec45jUdvg== X-Received: by 10.66.178.49 with SMTP id cv17mr27894293pac.157.1466509550412; Tue, 21 Jun 2016 04:45:50 -0700 (PDT) Received: from localhost.localdomain ([218.233.16.2]) by smtp.gmail.com with ESMTPSA id z29sm90204398pff.0.2016.06.21.04.45.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Jun 2016 04:45:49 -0700 (PDT) From: Chaehyun Lim To: kvalo@qca.qualcomm.com Subject: [PATCH 2/2] ath6kl: replace semaphore with mutex Date: Tue, 21 Jun 2016 20:45:39 +0900 Message-Id: <20160621114539.15313-2-chaehyun.lim@gmail.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160621114539.15313-1-chaehyun.lim@gmail.com> References: <20160621114539.15313-1-chaehyun.lim@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160621_044611_407002_DBF17290 X-CRM114-Status: GOOD ( 12.35 ) 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: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, Chaehyun Lim , ath10k@lists.infradead.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP It replaces struct semaphore sem with struct mutex mutex Signed-off-by: Chaehyun Lim --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 30 +++++++++++++++--------------- drivers/net/wireless/ath/ath6kl/core.c | 2 +- drivers/net/wireless/ath/ath6kl/core.h | 2 +- drivers/net/wireless/ath/ath6kl/debug.c | 12 ++++++------ drivers/net/wireless/ath/ath6kl/init.c | 6 +++--- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index f6b5390..d4eb066 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -480,14 +480,14 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, return -EINVAL; } - if (down_interruptible(&ar->sem)) { + if (mutex_lock_interruptible(&ar->mutex)) { ath6kl_err("busy, couldn't get access\n"); return -ERESTARTSYS; } if (test_bit(DESTROY_IN_PROGRESS, &ar->flag)) { ath6kl_err("busy, destroy in progress\n"); - up(&ar->sem); + mutex_unlock(&ar->mutex); return -EBUSY; } @@ -500,14 +500,14 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, WMI_TIMEOUT); if (signal_pending(current)) { ath6kl_err("cmd queue drain timeout\n"); - up(&ar->sem); + mutex_unlock(&ar->mutex); return -EINTR; } } status = ath6kl_set_assoc_req_ies(vif, sme->ie, sme->ie_len); if (status) { - up(&ar->sem); + mutex_unlock(&ar->mutex); return status; } @@ -522,7 +522,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, vif->req_bssid, vif->ch_hint); - up(&ar->sem); + mutex_unlock(&ar->mutex); if (status) { ath6kl_err("wmi_reconnect_cmd failed\n"); return -EIO; @@ -548,7 +548,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, status = ath6kl_set_auth_type(vif, sme->auth_type); if (status) { - up(&ar->sem); + mutex_unlock(&ar->mutex); return status; } @@ -570,7 +570,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, if (sme->key_idx > WMI_MAX_KEY_INDEX) { ath6kl_err("key index %d out of bounds\n", sme->key_idx); - up(&ar->sem); + mutex_unlock(&ar->mutex); return -ENOENT; } @@ -594,7 +594,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, if (ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, ALL_BSS_FILTER, 0) != 0) { ath6kl_err("couldn't set bss filtering\n"); - up(&ar->sem); + mutex_unlock(&ar->mutex); return -EIO; } } @@ -626,7 +626,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, 0); if (status) { ath6kl_err("couldn't set listen intervel\n"); - up(&ar->sem); + mutex_unlock(&ar->mutex); return status; } } @@ -651,7 +651,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, 0, 0, sme->bg_scan_period, 0, 0, 0, 3, 0, 0, 0); - up(&ar->sem); + mutex_unlock(&ar->mutex); if (status == -EINVAL) { memset(vif->ssid, 0, sizeof(vif->ssid)); @@ -832,7 +832,7 @@ static int ath6kl_cfg80211_disconnect(struct wiphy *wiphy, return -EBUSY; } - if (down_interruptible(&ar->sem)) { + if (mutex_lock_interruptible(&ar->mutex)) { ath6kl_err("busy, couldn't get access\n"); return -ERESTARTSYS; } @@ -845,7 +845,7 @@ static int ath6kl_cfg80211_disconnect(struct wiphy *wiphy, if (!test_bit(SKIP_SCAN, &ar->flag)) memset(vif->req_bssid, 0, sizeof(vif->req_bssid)); - up(&ar->sem); + mutex_unlock(&ar->mutex); vif->sme_state = SME_DISCONNECTED; @@ -1775,7 +1775,7 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, if (memcmp(mac, vif->bssid, ETH_ALEN) != 0) return -ENOENT; - if (down_interruptible(&ar->sem)) + if (mutex_lock_interruptible(&ar->mutex)) return -EBUSY; set_bit(STATS_UPDATE_PEND, &vif->flags); @@ -1783,7 +1783,7 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, ret = ath6kl_wmi_get_stats_cmd(ar->wmi, vif->fw_vif_idx); if (ret != 0) { - up(&ar->sem); + mutex_unlock(&ar->mutex); return -EIO; } @@ -1792,7 +1792,7 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, &vif->flags), WMI_TIMEOUT); - up(&ar->sem); + mutex_unlock(&ar->mutex); if (left == 0) return -ETIMEDOUT; diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c index ebb9f16..0da253a 100644 --- a/drivers/net/wireless/ath/ath6kl/core.c +++ b/drivers/net/wireless/ath/ath6kl/core.c @@ -283,7 +283,7 @@ struct ath6kl *ath6kl_core_create(struct device *dev) spin_lock_init(&ar->list_lock); init_waitqueue_head(&ar->event_wq); - sema_init(&ar->sem, 1); + mutex_init(&ar->mutex); INIT_LIST_HEAD(&ar->amsdu_rx_buffer_queue); INIT_LIST_HEAD(&ar->vif_list); diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h index ac25f17..42848bd 100644 --- a/drivers/net/wireless/ath/ath6kl/core.h +++ b/drivers/net/wireless/ath/ath6kl/core.h @@ -722,7 +722,7 @@ struct ath6kl { */ spinlock_t lock; - struct semaphore sem; + struct mutex mutex; u8 lrssi_roam_threshold; struct ath6kl_version version; u32 target_type; diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index e2b7809..9c1e709 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c @@ -102,13 +102,13 @@ int ath6kl_read_tgt_stats(struct ath6kl *ar, struct ath6kl_vif *vif) { long left; - if (down_interruptible(&ar->sem)) + if (mutex_lock_interruptible(&ar->mutex)) return -EBUSY; set_bit(STATS_UPDATE_PEND, &vif->flags); if (ath6kl_wmi_get_stats_cmd(ar->wmi, 0)) { - up(&ar->sem); + mutex_unlock(&ar->mutex); return -EIO; } @@ -116,7 +116,7 @@ int ath6kl_read_tgt_stats(struct ath6kl *ar, struct ath6kl_vif *vif) !test_bit(STATS_UPDATE_PEND, &vif->flags), WMI_TIMEOUT); - up(&ar->sem); + mutex_unlock(&ar->mutex); if (left <= 0) return -ETIMEDOUT; @@ -1167,20 +1167,20 @@ static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf, unsigned int len, buf_len; ssize_t ret_cnt; - if (down_interruptible(&ar->sem)) + if (mutex_lock_interruptible(&ar->mutex)) return -EBUSY; set_bit(ROAM_TBL_PEND, &ar->flag); ret = ath6kl_wmi_get_roam_tbl_cmd(ar->wmi); if (ret) { - up(&ar->sem); + mutex_unlock(&ar->sem); return ret; } left = wait_event_interruptible_timeout( ar->event_wq, !test_bit(ROAM_TBL_PEND, &ar->flag), WMI_TIMEOUT); - up(&ar->sem); + mutex_unlock(&ar->mutex); if (left <= 0) return -ETIMEDOUT; diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index 58fb227..377f1fa 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c @@ -1890,8 +1890,8 @@ void ath6kl_stop_txrx(struct ath6kl *ar) set_bit(DESTROY_IN_PROGRESS, &ar->flag); - if (down_interruptible(&ar->sem)) { - ath6kl_err("down_interruptible failed\n"); + if (mutex_lock_interruptible(&ar->mutex)) { + ath6kl_err("mutex_lock_interruptible failed\n"); return; } @@ -1938,6 +1938,6 @@ void ath6kl_stop_txrx(struct ath6kl *ar) */ ath6kl_init_hw_reset(ar); - up(&ar->sem); + mutex_unlock(&ar->mutex); } EXPORT_SYMBOL(ath6kl_stop_txrx);