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: 69863 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1472561qgf; Mon, 13 Jun 2016 03:38:44 -0700 (PDT) X-Received: by 10.107.131.98 with SMTP id f95mr21633793iod.136.1465814324120; Mon, 13 Jun 2016 03:38:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1si17288593pan.105.2016.06.13.03.38.43; Mon, 13 Jun 2016 03:38:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422698AbcFMKi0 (ORCPT + 30 others); 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 Received: by mail-pf0-f176.google.com with SMTP id t190so45124780pfb.3 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=D+MrShdVJ3cIYBiLJTyJwA3n8qXPBxB6j/lFZb3MFvnNp/+H99ilkRfDjGXb96crVQ Ss2aTO9y5n+HCwBF19gyuzKhu/FHlpsxQeAhcgLggkfNvCBRbMu1A8kCiNEZvGwWeD0L CV4AgErvQMiuhXezkVe0PeAJwc+Wp2nhhoR/Eqc1K1jjb+i/snY7bkziqjZfq7lKr9Xx Yz3VpkGgJ71IxH1tpOI1rZKwWR/cy7HrpUtmj38VSzH2wRG/qdgiskjm5x5pXpZySinq spFXBKYsDInSCdBUTKHELWAJxx9So0wwPZfiaOqZhgbkKeML8yWnWGt1RtsTFvdxQxOu MNKw== X-Gm-Message-State: ALyK8tJ4EXZZ22YPQDQ8vOasTNikuHo9LEC6bEaKeDqVijn4eshgcXLrLL9CFjye7YJRi20P 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-kernel-owner@vger.kernel.org Precedence: bulk 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(-) -- 2.7.4 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;