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: 70080 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2392992qgf; Tue, 14 Jun 2016 22:31:21 -0700 (PDT) X-Received: by 10.107.185.67 with SMTP id j64mr38165014iof.32.1465968677640; Tue, 14 Jun 2016 22:31:17 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g70si25672629pfb.119.2016.06.14.22.31.17; Tue, 14 Jun 2016 22:31:17 -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 S1752901AbcFOFbL (ORCPT + 30 others); Wed, 15 Jun 2016 01:31:11 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:34215 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752840AbcFOFbJ (ORCPT ); Wed, 15 Jun 2016 01:31:09 -0400 Received: by mail-pf0-f181.google.com with SMTP id 62so5086903pfd.1 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=ToZYXqMO+yjABk2U34TsH+Z5jGd4W+JQSNoVibu/XXz1sVKdzSojycLr0tMMI1TuuP M0xBjgzPhBxwab6JSY6HYBT3t4Lfc2gr6fj8Fe3YLv9xdIoR3NrIg9hmhlMRVMPy6/07 pYPDmH8rb1Qhw0abs3O5kq4BH8T+mDl9xVrda4H0L6UR91tgcS1s7xlrSfUA/re7DH/y tblolq4WPlSsy64FZRMsWTAfvF4ahqgm8IToskrTL1ybCHQgE4+3HPwwUXhwwZk6l/i+ rTuYpmKEGfynn2uNf54Y+ch/NbPBSsNm3YoiKn0W9NTjcrROtMvJ4B5VlXXMsbv+6QSy HBhw== X-Gm-Message-State: ALyK8tJodafi1iePWzMN5UQlKzoZRWwnPD8KWkyyUKTBKNvzrsIZbzwvpKD1ABQpz89kaohl 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-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 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(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project 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;