From patchwork Wed Jun 15 05:24:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 70076 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2391145qgf; Tue, 14 Jun 2016 22:25:05 -0700 (PDT) X-Received: by 10.66.183.168 with SMTP id en8mr1792059pac.64.1465968305381; Tue, 14 Jun 2016 22:25:05 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z62si24964384pfz.205.2016.06.14.22.25.05; Tue, 14 Jun 2016 22:25:05 -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 S1752559AbcFOFYv (ORCPT + 30 others); Wed, 15 Jun 2016 01:24:51 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:34218 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752243AbcFOFYt (ORCPT ); Wed, 15 Jun 2016 01:24:49 -0400 Received: by mail-pf0-f181.google.com with SMTP id 62so5029614pfd.1 for ; Tue, 14 Jun 2016 22:24:48 -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=jl2nhNXHbp3A68FgD11BIPEiuY0c8s2yGP/QuUfgrlk=; b=j14WA6fFsWcXkt1NBp0Nz1eZFB0K5Cx5npcVGTMRss9Ty/AYYafBYKVs8r0/67+9MJ KE+XetCWT0SAdZEfJluKELS0VWC+/xbtCrnjB/VAszaRCjvZU8zV1hnQtifqNUOgLJ6J jrSQgv9ahmWsHFCHXs7XWYehsuzXFGzMct2I0= 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=jl2nhNXHbp3A68FgD11BIPEiuY0c8s2yGP/QuUfgrlk=; b=LMN3pBXMCzUoJ/qWDIn1a6bJVry0qO9tosqo6fmiegbi3JN0dEzo/qHwoQMv/jawgw NLJesIYKlqNFzHxC7MfPY7c3WHoaM4UI3ibRdY46B4slGxRLHMopfSMIc8vlpLuLzCzy TM5ajAS6fDx8YLcIQlP3QCksem7G2CIF/lKzY+ZnOEhcmiD0igiMRMOI38B1Zp18H5su O2de+bK4E40FVkI42NKOoNSGptv9ys5A/PlCKgsx1lxV8OHt8jwMRMmV9w+oDwu0dE5B VYYPr6LUc4Ol2xZ3WrDmUVIrb9kPTMozT8m07NyEg/ED0WKRGOic+eS+WdsiKceEAajG GknQ== X-Gm-Message-State: ALyK8tJw53UMcbe47tceeb7HA6P5w3CeDG8pVroOwciwiF8qDBsF/g/0VPAYICFTIiAO/Rrt X-Received: by 10.98.32.148 with SMTP id m20mr1765164pfj.77.1465968288289; Tue, 14 Jun 2016 22:24:48 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id v62sm19604447pfv.50.2016.06.14.22.24.44 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jun 2016 22:24:47 -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 v2 1/5] staging: wilc1000: Replace semaphore txq_event with completion Date: Wed, 15 Jun 2016 10:54:27 +0530 Message-Id: <1465968271-21540-2-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1465968271-21540-1-git-send-email-binoy.jayan@linaro.org> References: <1465814259-3009-1-git-send-email-binoy.jayan@linaro.org> <1465968271-21540-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 'txq_event' is used as completion, so convert it to a struct completion type. Signed-off-by: Binoy Jayan --- drivers/staging/wilc1000/linux_wlan.c | 8 ++++---- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 3 ++- drivers/staging/wilc1000/wilc_wlan.c | 8 +++++--- 3 files changed, 11 insertions(+), 8 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 4f93c11..90f906d 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -316,7 +316,7 @@ static int linux_wlan_txq_task(void *vp) complete(&wl->txq_thread_started); while (1) { - down(&wl->txq_event); + wait_for_completion(&wl->txq_event); if (wl->close) { complete(&wl->txq_thread_started); @@ -650,7 +650,7 @@ void wilc1000_wlan_deinit(struct net_device *dev) mutex_unlock(&wl->hif_cs); } if (&wl->txq_event) - up(&wl->txq_event); + wait_for_completion(&wl->txq_event); wlan_deinitialize_threads(dev); deinit_irq(dev); @@ -681,7 +681,7 @@ static int wlan_init_locks(struct net_device *dev) spin_lock_init(&wl->txq_spinlock); sema_init(&wl->txq_add_to_head_cs, 1); - sema_init(&wl->txq_event, 0); + init_completion(&wl->txq_event); sema_init(&wl->cfg_event, 0); sema_init(&wl->sync_event, 0); @@ -738,7 +738,7 @@ static void wlan_deinitialize_threads(struct net_device *dev) wl->close = 1; if (&wl->txq_event) - up(&wl->txq_event); + complete(&wl->txq_event); if (wl->txq_thread) { kthread_stop(wl->txq_thread); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 3a561df6..12d7c7b 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -42,6 +42,7 @@ #include "host_interface.h" #include "wilc_wlan.h" #include +#include #define FLOW_CONTROL_LOWER_THRESHOLD 128 #define FLOW_CONTROL_UPPER_THRESHOLD 256 @@ -178,7 +179,7 @@ struct wilc { struct semaphore cfg_event; struct semaphore sync_event; - struct semaphore txq_event; + struct completion txq_event; struct completion txq_thread_started; struct task_struct *txq_thread; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 11e16d5..1a57135 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1,3 +1,4 @@ +#include #include "wilc_wlan_if.h" #include "wilc_wlan.h" #include "wilc_wfi_netdevice.h" @@ -89,7 +90,7 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, spin_unlock_irqrestore(&wilc->txq_spinlock, flags); - up(&wilc->txq_event); + complete(&wilc->txq_event); } static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif, @@ -119,7 +120,7 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif, spin_unlock_irqrestore(&wilc->txq_spinlock, flags); up(&wilc->txq_add_to_head_cs); - up(&wilc->txq_event); + complete(&wilc->txq_event); return 0; } @@ -287,7 +288,8 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) spin_unlock_irqrestore(&wilc->txq_spinlock, wilc->txq_spinlock_flags); while (dropped > 0) { - wilc_lock_timeout(wilc, &wilc->txq_event, 1); + wait_for_completion_timeout(&wilc->txq_event, + msecs_to_jiffies(1)); dropped--; }