From patchwork Mon Jun 13 10:37:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69860 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1472439qgf; Mon, 13 Jun 2016 03:38:23 -0700 (PDT) X-Received: by 10.66.73.193 with SMTP id n1mr20788526pav.70.1465814303651; Mon, 13 Jun 2016 03:38:23 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si17270895pay.32.2016.06.13.03.38.23; Mon, 13 Jun 2016 03:38:23 -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 S965409AbcFMKiL (ORCPT + 30 others); Mon, 13 Jun 2016 06:38:11 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:32895 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965028AbcFMKiH (ORCPT ); Mon, 13 Jun 2016 06:38:07 -0400 Received: by mail-pa0-f49.google.com with SMTP id b13so22370905pat.0 for ; Mon, 13 Jun 2016 03:38:06 -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=iwBsCe/+2w3rJdanj5FqQnX5MCBO223i3S3rqNhwpjw=; b=hkUGqY4UjgCeQY1fiQYRpMaHLl408uVL4jMpxtKgIUkR+vvBElWeZkES+hqODOnDmT XuDVlCaA57G/4yuoRRu/SquwfB6kro4X6kOI03VYVTWHBQ/aV5EiQEBG7O81k3TDdx4U Z2ry72lA/4EYAT8XwPhzRMWYxFv2GJ9G2ICak= 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=iwBsCe/+2w3rJdanj5FqQnX5MCBO223i3S3rqNhwpjw=; b=dXQTG7gmqLgIUjy8cpidPQ3deiuax+HCAfkIk8kzlGjOzF8oyP03f41bNScggHfn4V hfFzOR9bfz+3M3ar6JJJtgpRqFLToWuNLdvpJ99QTr7Ld+OKiU0fhfJKXqOXuCMG3KrV ePyif4s4yX1K38HwOdnmdvpIHbgjWyUrADjhNMrRRSU6kr7JoPEI2n38Bwsx/QcIhyM2 CuoXD/bs434b0l3fBCZhczp9TpZeCfE7em2zXX3o8M1ehA6HOGZS8lktMQCjBbz/ZzJT +ML9lRlNfjm+BicnQUZ+k67m9eZqw5zNk2Z9kVfqMhH6j/QX+8m6X3g/Dq9GdNSeFgNw b0Dw== X-Gm-Message-State: ALyK8tIomwPWV9xqDFBm9RIvUrvSYQX5iEiLBF2mAtrr8z9N2Xjc/CCHAZZy5aKyLLg2gHEl X-Received: by 10.66.154.74 with SMTP id vm10mr21250851pab.158.1465814286317; Mon, 13 Jun 2016 03:38:06 -0700 (PDT) Received: from localhost.localdomain ([116.68.103.40]) by smtp.gmail.com with ESMTPSA id h6sm24194895pac.46.2016.06.13.03.38.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 03:38:05 -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 1/7] staging: wilc1000: Replace semaphore txq_event with completion Date: Mon, 13 Jun 2016 16:07:33 +0530 Message-Id: <1465814259-3009-2-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 '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(-) -- 2.7.4 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--; }