From patchwork Fri Jun 3 09:59:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69234 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp180414qgf; Fri, 3 Jun 2016 03:04:52 -0700 (PDT) X-Received: by 10.67.22.129 with SMTP id hs1mr4204266pad.105.1464948292413; Fri, 03 Jun 2016 03:04:52 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v23si6742659pfa.20.2016.06.03.03.04.52; Fri, 03 Jun 2016 03:04:52 -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 S932524AbcFCKEm (ORCPT + 31 others); Fri, 3 Jun 2016 06:04:42 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:35979 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752467AbcFCJ7s (ORCPT ); Fri, 3 Jun 2016 05:59:48 -0400 Received: by mail-pa0-f42.google.com with SMTP id te7so10048383pab.3 for ; Fri, 03 Jun 2016 02:59:42 -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=nubIt14qov7d5qsvLOoB7zS66E/vHGmoYBEgmHAXxFg=; b=NR1E8FtlvQBk6dzMbFsExpKQ7Bj43sYdrEQWPbFdW8MTEGER0FROuBbxwwQ0MXr29q 95GImf4dIHi9Da0Sm/SB9n/wBUyYQjXcLVnlcDTmrWm0rHoET2gkG9nOt2m/qhx2Cx2x aTl8cyQs0ekV71Zg15hO+18rwFrJYLfR4T2UQ= 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=nubIt14qov7d5qsvLOoB7zS66E/vHGmoYBEgmHAXxFg=; b=HBrWHJ5bp98kuVxlLDiIjH5bLJvHXgpR5buTm3hWPRGpY4AKq51pBiZrE71AFpH2VV jDp/NXGCcbD1UTKzVztnD+prhgo8A0ERCmEdL0S/zMr6R+47Zfjo0e5TwipNyXqQL1nK gjJCv2FGBbW5WYwswHPf6SEy6kFW2568YUDFMDvmAbu8K8am/d7bDyZETKVKAwz8ueJ9 nXNWRbpt3vXZ3e7w1RVCq+5mXhz6yJKK94m4/Wa7oikbSnXELkJQoyz++bf5WCN/tCPn hj6ErM3iyNRvk1mavoFGyARxtjTs5GYKdF+1WWdDVHjmJ5H+xY2uJRi34xrmPF8fSNHs yE0w== X-Gm-Message-State: ALyK8tK+hI/gz2bnTsjL+qQdkeAIxAPA8NjWcSDeXZJvEai0sjQqIEIiezoXh9+FsqCzwt0y X-Received: by 10.67.5.134 with SMTP id cm6mr4178609pad.93.1464947982297; Fri, 03 Jun 2016 02:59:42 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id a19sm7010383pfc.57.2016.06.03.02.59.39 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Jun 2016 02:59:41 -0700 (PDT) From: Binoy Jayan To: Greg Kroah-Hartman , Larry Finger Cc: Jakub Sitnicki , Arnd Bergmann , driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, Binoy Jayan Subject: [PATCH 2/4] rtl8188eu: Replace semaphore terminate_cmdthread_sema with completion Date: Fri, 3 Jun 2016 15:29:01 +0530 Message-Id: <1464947943-2008-3-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1464947943-2008-1-git-send-email-binoy.jayan@linaro.org> References: <1464947943-2008-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 'terminate_cmdthread_sema' is used as completion, so convert it to struct completion. Signed-off-by: Binoy Jayan --- This patch depends on the following patch: irtl8188eu: Replace semaphore cmd_queue_sema with completion drivers/staging/rtl8188eu/core/rtw_cmd.c | 6 +++--- drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +- drivers/staging/rtl8188eu/os_dep/os_intfs.c | 4 ++-- 3 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/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index a2937e7..9e12588 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -28,7 +28,7 @@ No irqsave is necessary. int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { init_completion(&pcmdpriv->cmd_queue_comp); - sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0); + init_completion(&pcmdpriv->terminate_cmdthread_comp); _rtw_init_queue(&(pcmdpriv->cmd_queue)); return _SUCCESS; @@ -162,7 +162,7 @@ int rtw_cmd_thread(void *context) allow_signal(SIGTERM); pcmdpriv->cmdthd_running = true; - up(&pcmdpriv->terminate_cmdthread_sema); + complete(&pcmdpriv->terminate_cmdthread_comp); RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x rtw_cmd_thread !!!!\n")); @@ -234,7 +234,7 @@ _next: rtw_free_cmd_obj(pcmd); } - up(&pcmdpriv->terminate_cmdthread_sema); + complete(&pcmdpriv->terminate_cmdthread_comp); complete_and_exit(NULL, 0); diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h b/drivers/staging/rtl8188eu/include/rtw_cmd.h index 3532dd1..2b53f58 100644 --- a/drivers/staging/rtl8188eu/include/rtw_cmd.h +++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h @@ -40,7 +40,7 @@ struct cmd_obj { struct cmd_priv { struct completion cmd_queue_comp; - struct semaphore terminate_cmdthread_sema; + struct completion terminate_cmdthread_comp; struct __queue cmd_queue; u8 cmdthd_running; struct adapter *padapter; diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index a696d2b..c494845 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c @@ -762,7 +762,7 @@ static int rtw_start_drv_threads(struct adapter *padapter) err = PTR_ERR(padapter->cmdThread); else /* wait for cmd_thread to run */ - _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); + wait_for_completion_interruptible(&padapter->cmdpriv.terminate_cmdthread_comp); return err; } @@ -774,7 +774,7 @@ void rtw_stop_drv_threads(struct adapter *padapter) /* Below is to terminate rtw_cmd_thread & event_thread... */ complete(&padapter->cmdpriv.cmd_queue_comp); if (padapter->cmdThread) - _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); + wait_for_completion_interruptible(&padapter->cmdpriv.terminate_cmdthread_comp); }