From patchwork Wed Mar 23 12:28:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaehyun Lim X-Patchwork-Id: 8649581 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 13388C0553 for ; Wed, 23 Mar 2016 12:28:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2FEF7203B1 for ; Wed, 23 Mar 2016 12:28:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5274D203B0 for ; Wed, 23 Mar 2016 12:28:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755024AbcCWM2w (ORCPT ); Wed, 23 Mar 2016 08:28:52 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35584 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754156AbcCWM2v (ORCPT ); Wed, 23 Mar 2016 08:28:51 -0400 Received: by mail-pf0-f196.google.com with SMTP id u190so3185464pfb.2 for ; Wed, 23 Mar 2016 05:28: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=plN3tET2u4ITf0GB1YJZxM2YGWdSsP4/sAKdx/Ekta0=; b=b2c0adSLvLbL5rfeJRTP46wOoH2Do15WjrCW8qsqTSRMjhpd0Tf9RBM6QVmXPSQ3GG Bm/Bo7TehBhERZfmSsV8NlwZDp+Ca7i9IpC2QDbowVAoXxklsoari7qHn1AABe6Fq6WO 3F6JkjaxnhDlcebmRliACOd+ry/BmcACiaBDCT1xPgILal9v6znvq6ci+kQFP60E3MGX df1vJbh1rRjsS1XJ+3g3Q8XMs1v8FOMSz1du1YD+QioMrPTkblMp+OKgmAHi8k6u1wIw dOZMTiyDR/jkYXqEkSzVREIZvmuYjrTXcneKoRRkhl8ONlIMmpXOwbTGNtRQvLMVR/LH yo7g== 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=plN3tET2u4ITf0GB1YJZxM2YGWdSsP4/sAKdx/Ekta0=; b=lJ9dkqvI8Ro9IxGSARZabSXkLntkHcGxJxvr3E3CIqyi+9FAEFXXnYMa17k08t/ghs a+8y64PvlL+C8GDRuPdjLKDWZuKcBsB2tcj56gSu1vb83WNz+8UAm1HT7hMEIvHQTBFa x0FPXS13iOr4AnkjfvZ7f3nYjOk7s6wLdFnOBB55fURMw3bExNSjRWAb0FUsSMlV0Uc1 LG8SiKqGn8YJFzWNIBLej1sGOLPtwcbDlgXJww+wu2hP40vyxLifS0F/e4YC0tQ8Savm zevWY9eW1DhPcOf1umOJ+s4LcgLxax5nPLAjapkuzLg9ZpySAB5afVfVvYBGQ7o1n8lt 4wGQ== X-Gm-Message-State: AD7BkJK+fV2e5wImoGeCi3Ry8+PTx2yE4EGlKuJ8I1t05UaAeWTya3PMEEWs+gGtWjJeng== X-Received: by 10.98.79.203 with SMTP id f72mr3867683pfj.102.1458736130245; Wed, 23 Mar 2016 05:28:50 -0700 (PDT) Received: from localhost.localdomain ([218.233.16.2]) by smtp.gmail.com with ESMTPSA id l81sm4132231pfj.21.2016.03.23.05.28.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Mar 2016 05:28:49 -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 2/2] staging: wilc1000: use completion instead of struct semaphore hif_sema_driver Date: Wed, 23 Mar 2016 21:28:34 +0900 Message-Id: <1458736114-7018-2-git-send-email-chaehyun.lim@gmail.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1458736114-7018-1-git-send-email-chaehyun.lim@gmail.com> References: <1458736114-7018-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=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 struct semaphore hif_sema_driver is used to signal completion of host interface message. This patch replaces struct semaphore hif_sema_driver with struct completion hif_driver_comp. It is better to use completion than semaphore for this case. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3d17972..29d4d8a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -232,7 +232,7 @@ static u8 P2P_LISTEN_STATE; static struct task_struct *hif_thread_handler; static struct message_queue hif_msg_q; static struct completion hif_thread_comp; -static struct semaphore hif_sema_driver; +static struct completion hif_driver_comp; static struct completion hif_wait_response; static struct mutex hif_deinit_lock; static struct timer_list periodic_rssi; @@ -321,7 +321,7 @@ static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif, hif_drv_handler->handler); if (!hif_drv_handler->handler) - up(&hif_sema_driver); + complete(&hif_driver_comp); if (result) { netdev_err(vif->ndev, "Failed to set driver handler\n"); @@ -346,7 +346,7 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif, wilc_get_vif_idx(vif)); if ((hif_op_mode->mode) == IDLE_MODE) - up(&hif_sema_driver); + complete(&hif_driver_comp); if (result) { netdev_err(vif->ndev, "Failed to set driver handler\n"); @@ -3401,7 +3401,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) if (clients_count == 0) { init_completion(&hif_thread_comp); - sema_init(&hif_sema_driver, 0); + init_completion(&hif_driver_comp); mutex_init(&hif_deinit_lock); } @@ -3480,7 +3480,7 @@ int wilc_deinit(struct wilc_vif *vif) del_timer_sync(&hif_drv->remain_on_ch_timer); wilc_set_wfi_drv_handler(vif, 0, 0); - down(&hif_sema_driver); + wait_for_completion(&hif_driver_comp); if (hif_drv->usr_scan_req.scan_result) { hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL,