From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422695AbcFMKi0 (ORCPT ); Mon, 13 Jun 2016 06:38:26 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:36044 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965443AbcFMKiW (ORCPT ); Mon, 13 Jun 2016 06:38:22 -0400 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.7.4