From patchwork Wed Jun 15 05:30:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 9177553 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 BB4326021C for ; Wed, 15 Jun 2016 05:31:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A94E028303 for ; Wed, 15 Jun 2016 05:31:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D06228356; Wed, 15 Jun 2016 05:31:42 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51B4628303 for ; Wed, 15 Jun 2016 05:31:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752869AbcFOFbK (ORCPT ); Wed, 15 Jun 2016 01:31:10 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:33768 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752736AbcFOFbJ (ORCPT ); Wed, 15 Jun 2016 01:31:09 -0400 Received: by mail-pf0-f182.google.com with SMTP id i123so1316099pfg.0 for ; Tue, 14 Jun 2016 22:31:08 -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=qnZV9tUrFgkap6M+LdLs0EDYEk6QGSZifOMgtkbn1sM=; b=aIVzXen8PHvJKZIpjuGP9qY71GYnRs4WAF9uZKs4n4VsBSz7W1JWcz/hx0fxFvJ+vZ BCl/bHs+9dmPlmhSa1VOqPDqUUAXEL6rMxsY/h84qV9xxj9K6jiIQ1h/P9ZAYIyWQZK8 fXyAvRFZ9Wg76neEt0CQvclIoiaoVlfuehy9k= 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=qnZV9tUrFgkap6M+LdLs0EDYEk6QGSZifOMgtkbn1sM=; b=NLi3iSVnSOtk2B/hIKqfJlHoBWeUjzNwJD17foyKuabMCI8kIjGwel9/XfUOdfF7wX PIViC5a+ynTh6s1oMtK2+yAFbuB/b/kyP6kc6B/GFnZHevBBmMqZKml+3UjdKm2ai4Od dVCxGPsMRIQVUMYwU9tzx4DDqRLrkGUOCCqoiNQkNAJW7HtSXITL1wUh2LFGzN6Rx1OS KWLhEgqgGVYcjN2m07SR8pPvvniTVM/Lmt/UawgZhMju1HZ0JEdHNRtW+LYNDRDUO/JM 35iZvEfDsFK1+1/rbby8QicPKgSPhUYu6euw14N5lkHmov9cDVGkVlaY8q/Mw+HH6wRQ K+SA== X-Gm-Message-State: ALyK8tLGWt+cQP1vdBbIUV6oBm0hdBMnmbD7kD7dLWXhnszf3cFn+rZkO1TaOryHHf17C/Rx X-Received: by 10.98.64.21 with SMTP id n21mr1806823pfa.161.1465968668383; Tue, 14 Jun 2016 22:31:08 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id 81sm28286566pfo.74.2016.06.14.22.31.04 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jun 2016 22:31:07 -0700 (PDT) From: Binoy Jayan To: Greg Kroah-Hartman Cc: Johnny Kim , Austin Shin , Chris Park , Tony Cho , Glen Lee , Leo Kim , Arnd Bergmann , linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Binoy Jayan Subject: [PATCH v3 4/5] staging: wilc1000: Replace semaphore sync_event with completion Date: Wed, 15 Jun 2016 11:00:37 +0530 Message-Id: <1465968638-22129-5-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1465968638-22129-1-git-send-email-binoy.jayan@linaro.org> References: <1465814259-3009-1-git-send-email-binoy.jayan@linaro.org> <1465968638-22129-1-git-send-email-binoy.jayan@linaro.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The semaphore 'sync_event' is used as completion, so convert it to a struct completion type. Also, return -ETIME if the return value of wait_for_completion_timeout is 0. Signed-off-by: Binoy Jayan Reviewed-by: Arnd Bergmann --- drivers/staging/wilc1000/linux_wlan.c | 10 +++++----- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 81a469a..39fe350 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -241,7 +241,7 @@ void wilc_mac_indicate(struct wilc *wilc, int flag) (unsigned char *)&status, 4); if (wilc->mac_status == WILC_MAC_STATUS_INIT) { wilc->mac_status = status; - up(&wilc->sync_event); + complete(&wilc->sync_event); } else { wilc->mac_status = status; } @@ -386,9 +386,9 @@ static int linux_wlan_start_firmware(struct net_device *dev) if (ret < 0) return ret; - ret = wilc_lock_timeout(wilc, &wilc->sync_event, 5000); - if (ret) - return ret; + if (!wait_for_completion_timeout(&wilc->sync_event, + msecs_to_jiffies(5000))) + return -ETIME; return 0; } @@ -684,7 +684,7 @@ static int wlan_init_locks(struct net_device *dev) init_completion(&wl->txq_event); init_completion(&wl->cfg_event); - sema_init(&wl->sync_event, 0); + init_completion(&wl->sync_event); init_completion(&wl->txq_thread_started); return 0; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 5fbc07c..5cc6a82 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -179,7 +179,7 @@ struct wilc { struct mutex hif_cs; struct completion cfg_event; - struct semaphore sync_event; + struct completion sync_event; struct completion txq_event; struct completion txq_thread_started;