From patchwork Mon Mar 28 04:56:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaehyun Lim X-Patchwork-Id: 8677931 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B569DC0553 for ; Mon, 28 Mar 2016 04:56:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DFFA020251 for ; Mon, 28 Mar 2016 04:56:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E1802024C for ; Mon, 28 Mar 2016 04:56:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753539AbcC1E4X (ORCPT ); Mon, 28 Mar 2016 00:56:23 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:32804 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751643AbcC1E4V (ORCPT ); Mon, 28 Mar 2016 00:56:21 -0400 Received: by mail-pf0-f194.google.com with SMTP id x3so19167773pfb.0 for ; Sun, 27 Mar 2016 21:56:21 -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=7zqTeGizkwNxrfIHTDzfwJ6FzTi3a7XPCkwDdrOcsf4=; b=ulWT+BEFcv2RQEcyWF1cVxfLe8P7taTgbHYHbysDzoSJH6AMZcWftC5IniXxMkDmkD +h+pG9Ks+5Shy2mVJpN6K+4tDcJfQn0EWHc4qZ1tRV87lVlVEiVC4lMuocJYbLYqe6RF MA6NiobbFa6qWsSPEZksbjRjdwZ7lg/3je1qFEepQQy5fAkYWV4Jy4Cssbgwqt5h7uXv zvsubqIfSemuKK/ALqm6zmFJCpm+nMzVsCPOFhx9wzSXd5+vyv0p+Phl++V98nrLyfm9 2O6Yh2hH9tffYsdOI5vmHgGwpzx7dF9Cjq4xhSlL7KjYjzqlLS2MF5aTP7W1hk5/N8rs 42/Q== 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=7zqTeGizkwNxrfIHTDzfwJ6FzTi3a7XPCkwDdrOcsf4=; b=CP1TprDbg8P4KgsFUcUkroZqjBVJAWwQWF82B9eEJRRC/gPxxyH0FagGuIIus8BrtU JNuaNtJHAGW8JmwY3NY+MUqHswAUIeutUhe40xdA3dFqXQlpIz+kHKh9GLp/3s2NE70c lGpLkj9yszwzDNEL5hwL3ZU9a3COva+TPDFMY2jXXIi5+fTpvH9ByYfYY/ooZ7KEEyNm ol4smcrE1gSdYKcbTxikO44YoFsBT1UztRtA1vR2uWEY861GH/Qcim+ILpn7z6bk+kl3 g49AEpMzMpO2y3H+AqIePHHSkJ2ATIav7KKg0J69F7e73w44ahK5SL/qDk4K3ACAM1g0 5Qaw== X-Gm-Message-State: AD7BkJIHXVfjRlzkkgfXVEtqAsMod+j8fyHChqEzNbhFOCq1HIqHIIh5dq893s6iRM8lTQ== X-Received: by 10.98.10.133 with SMTP id 5mr39532952pfk.75.1459140980988; Sun, 27 Mar 2016 21:56:20 -0700 (PDT) Received: from localhost.localdomain ([218.233.16.2]) by smtp.gmail.com with ESMTPSA id t78sm13518897pfi.55.2016.03.27.21.56.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Mar 2016 21:56:20 -0700 (PDT) From: Chaehyun Lim To: gregkh@linuxfoundation.org Cc: johnny.kim@atmel.com, austin.shin@atmel.com, chris.park@atmel.com, tony.cho@atmel.com, glen.lee@atmel.com, leo.kim@atmel.com, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, Chaehyun Lim Subject: [PATCH 5/5] staging: wilc1000: use mutex instead of struct semaphore hSemScanReq Date: Mon, 28 Mar 2016 13:56:00 +0900 Message-Id: <1459140960-10645-5-git-send-email-chaehyun.lim@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1459140960-10645-1-git-send-email-chaehyun.lim@gmail.com> References: <1459140960-10645-1-git-send-email-chaehyun.lim@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=-7.8 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 This patch replaces struct semaphore hSemScanReq with struct mutex scan_req_lock. It is better to use mutex than semaphore. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 +++++----- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index f6aec47..358632b 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -451,7 +451,7 @@ static void CfgScanResult(enum scan_event scan_event, } else if (scan_event == SCAN_EVENT_DONE) { refresh_scan(priv, 1, false); - down(&(priv->hSemScanReq)); + mutex_lock(&priv->scan_req_lock); if (priv->pstrScanReq) { cfg80211_scan_done(priv->pstrScanReq, false); @@ -459,9 +459,9 @@ static void CfgScanResult(enum scan_event scan_event, priv->bCfgScanning = false; priv->pstrScanReq = NULL; } - up(&(priv->hSemScanReq)); + mutex_unlock(&priv->scan_req_lock); } else if (scan_event == SCAN_EVENT_ABORTED) { - down(&(priv->hSemScanReq)); + mutex_lock(&priv->scan_req_lock); if (priv->pstrScanReq) { update_scan_time(); @@ -471,7 +471,7 @@ static void CfgScanResult(enum scan_event scan_event, priv->bCfgScanning = false; priv->pstrScanReq = NULL; } - up(&(priv->hSemScanReq)); + mutex_unlock(&priv->scan_req_lock); } } } @@ -2307,7 +2307,7 @@ int wilc_init_host_int(struct net_device *net) priv->bInP2PlistenState = false; - sema_init(&(priv->hSemScanReq), 1); + mutex_init(&priv->scan_req_lock); s32Error = wilc_init(net, &priv->hif_drv); if (s32Error) netdev_err(net, "Error while initializing hostinterface\n"); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 94a41b4..3d0ca8e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -130,7 +130,7 @@ struct wilc_priv { struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA]; u8 wilc_groupkey; /* semaphores */ - struct semaphore hSemScanReq; + struct mutex scan_req_lock; /* */ bool gbAutoRateAdjusted;