From patchwork Mon Jun 13 10:37:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 9172629 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 3C66F6075D for ; Mon, 13 Jun 2016 10:39:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E92E20223 for ; Mon, 13 Jun 2016 10:39:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2363720410; Mon, 13 Jun 2016 10:39:29 +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=ham 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 A6DF520223 for ; Mon, 13 Jun 2016 10:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161214AbcFMKiZ (ORCPT ); Mon, 13 Jun 2016 06:38:25 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:34551 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965028AbcFMKiW (ORCPT ); Mon, 13 Jun 2016 06:38:22 -0400 Received: by mail-pf0-f174.google.com with SMTP id 62so45157891pfd.1 for ; Mon, 13 Jun 2016 03:38:22 -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=a3wC4ZskD+OD9NM/xMEnd9D80cGBm7iLnTJcJls8aQY=; b=bZZSKwcOEAPrtmsIRqPJqKxsbjTNvhviF8LgLLDiGkxjHgihs9OigSDcWqVgDx/VaS TM+u7k3qI9+pQH+l1LfVlDlY9o7TeieZUFpw/RtTxjv2IzgX0TDRR5WGp4vZitefQSFq 4JAu6xrTFiORvS1k7gGBKG8rpZKjTKbjMmXoM= 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=a3wC4ZskD+OD9NM/xMEnd9D80cGBm7iLnTJcJls8aQY=; b=lgX6ZDysT7U6s4TEwZcJFVYx514IsOm8HVMzVFi8FYOGK8pn+YnZVCbJny8UAbzzxu pzK/Rn6i446IaV9UFF3uLo/QRQPjYTXZBqfiKmB/aRmD6lzFn0yctidAEOgRYgojTKO6 AnZBZlRl6b9gxNjUbkGzX9g5hkGK+6mlpa5GXK2EZ5vKvT0dC2FPahku0fYExU2edd/J Np8mZdrxf4G7aWbpnmKay0kHk9b+XQ3nHS5JL1WOoPiRlgqD0yg4oumTAN5rsbVc1BkL exlQK57ljWThHmGmdZrvWCh+Lt5JpIk0+IbTY77GN4rvXJ+iBKx9l/cdxf2Gw5YGuKfg 0ilw== X-Gm-Message-State: ALyK8tKq9YdWiBgNwH2PjI5dqQwbWe/NrfI4LUUVvfDv+491jMZp/bH100lHntR51EqO8JA2 X-Received: by 10.98.103.66 with SMTP id b63mr4951452pfc.141.1465814302058; Mon, 13 Jun 2016 03:38:22 -0700 (PDT) Received: from localhost.localdomain ([116.68.103.40]) by smtp.gmail.com with ESMTPSA id h6sm24194895pac.46.2016.06.13.03.38.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 03:38:21 -0700 (PDT) From: Binoy Jayan To: Greg Kroah-Hartman Cc: Arnd Bergmann , Johnny Kim , Austin Shin , Chris Park , Tony Cho , Glen Lee , Leo Kim , devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Binoy Jayan Subject: [PATCH 4/7] staging: wilc1000: Replace semaphore sync_event with completion Date: Mon, 13 Jun 2016 16:07:36 +0530 Message-Id: <1465814259-3009-5-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1465814259-3009-1-git-send-email-binoy.jayan@linaro.org> References: <1465814259-3009-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 --- 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;