From patchwork Tue Mar 8 01:04:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaehyun Lim X-Patchwork-Id: 8528091 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 45FB9C0553 for ; Tue, 8 Mar 2016 01:04:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2DBDA2015A for ; Tue, 8 Mar 2016 01:04:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 09CCC200DC for ; Tue, 8 Mar 2016 01:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753469AbcCHBEr (ORCPT ); Mon, 7 Mar 2016 20:04:47 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:34362 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753132AbcCHBEp (ORCPT ); Mon, 7 Mar 2016 20:04:45 -0500 Received: by mail-pa0-f54.google.com with SMTP id fy10so371161pac.1 for ; Mon, 07 Mar 2016 17:04:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=d32YZZsYrIJ9r1l4oYEE2/ZQWXNbzlWowrMMlp2fWYs=; b=SKn6yFB+0BuMHI/D+NsmvX3Wiy2XWxkzKzZgNL6CjWmWQfatlEDxE9XFwjWZQ2CqvD 5wDpF/srPJvgtpJ7qSNNk0WlX9w47zZ9eqEFp8nZO+mS1gU85/hX3WGDESN9kA/AXnBg Eu1SKDDL/UhFBRfi26p4kKwSG/HrKylghDtd2Fa+haMZh1H5FAVFL2vBmLT19w9YXsDL YV2Kv8It/+ZwEZNoklYctg7GySwgEx/w6jXvS5JvukhC/gcx59hM54j1pApW0TCM5hN7 zCg6e9WP+CcRgio6woP639nBZAPtogGcBBZXRF7GnTZKwm7GZDUkUZcrQ+SypsiW9PRL CvBQ== 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; bh=d32YZZsYrIJ9r1l4oYEE2/ZQWXNbzlWowrMMlp2fWYs=; b=TMdz1rwZ+uh3fJ+evjnn/StcDUpxImgmcrFYPkXzghJX8WjbZu6MS1QePk2wTWb9u7 qErqGgdxgzof33SLV7sXffdgB6WUeHjQoPC1wpzZklY91hSkM3XWe83SACSE6A/VM0dD l0j7jvV1UR/xtay4SfTneHLKh9Uk7B87EDMBMlDF/cC0iaSkK5ynMjYeuW4OvMx26LuA WvyxlrZ8cAPzdSn7fF53i6rtavG/kiN5TPpR3zevRMg6O+0UyGF+UZ7l8wcF1KBuXbu7 +mUmiVnSkr7m29pGRcPCC9PVct8tNBddli0U9RKJcYI2yAp+pQouOlL90VItZFrhHj3P qlBg== X-Gm-Message-State: AD7BkJKs3t8FZ8sZGmtl3Sk0uMXXIVRY7RMjX2V/8dsA9pwC47+HBZDbqjlgtksJtQu0Ig== X-Received: by 10.66.217.230 with SMTP id pb6mr38020300pac.63.1457399084777; Mon, 07 Mar 2016 17:04:44 -0800 (PST) Received: from localhost.localdomain ([218.233.16.2]) by smtp.gmail.com with ESMTPSA id ud8sm285879pac.11.2016.03.07.17.04.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Mar 2016 17:04:43 -0800 (PST) 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] staging: wilc1000: use mutex instead of semaphore sem_cfg_values Date: Tue, 8 Mar 2016 10:04:32 +0900 Message-Id: <1457399072-5646-1-git-send-email-chaehyun.lim@gmail.com> X-Mailer: git-send-email 2.7.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.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 sem_cfg_values with struct mutex cfg_values_lock. It is better to use mutex than semaphore. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 10 +++++----- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 854b674..0a922c7 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -443,7 +443,7 @@ static s32 handle_cfg_param(struct wilc_vif *vif, struct host_if_drv *hif_drv = vif->hif_drv; int i = 0; - down(&hif_drv->sem_cfg_values); + mutex_lock(&hif_drv->cfg_values_lock); if (cfg_param_attr->flag & BSS_TYPE) { if (cfg_param_attr->bss_type < 6) { @@ -725,7 +725,7 @@ static s32 handle_cfg_param(struct wilc_vif *vif, netdev_err(vif->ndev, "Error in setting CFG params\n"); ERRORHANDLER: - up(&hif_drv->sem_cfg_values); + mutex_unlock(&hif_drv->cfg_values_lock); return result; } @@ -3434,8 +3434,8 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) setup_timer(&hif_drv->connect_timer, TimerCB_Connect, 0); setup_timer(&hif_drv->remain_on_ch_timer, ListenTimerCB, 0); - sema_init(&hif_drv->sem_cfg_values, 1); - down(&hif_drv->sem_cfg_values); + mutex_init(&hif_drv->cfg_values_lock); + mutex_lock(&hif_drv->cfg_values_lock); hif_drv->hif_state = HOST_IF_IDLE; hif_drv->cfg_values.site_survey_enabled = SITE_SURVEY_OFF; @@ -3446,7 +3446,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) hif_drv->p2p_timeout = 0; - up(&hif_drv->sem_cfg_values); + mutex_unlock(&hif_drv->cfg_values_lock); clients_count++; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 795c18c..01f3222 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -274,7 +274,7 @@ struct host_if_drv { u8 assoc_bssid[ETH_ALEN]; struct cfg_param_attr cfg_values; - struct semaphore sem_cfg_values; + struct mutex cfg_values_lock; struct semaphore sem_test_key_block; struct semaphore sem_test_disconn_block; struct semaphore sem_get_rssi;