From patchwork Mon Jun 6 04:38:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69361 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1302004qgf; Sun, 5 Jun 2016 21:39:08 -0700 (PDT) X-Received: by 10.36.141.197 with SMTP id w188mr12983567itd.65.1465187948565; Sun, 05 Jun 2016 21:39:08 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68si25807705pfe.227.2016.06.05.21.39.08; Sun, 05 Jun 2016 21:39:08 -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 S1753189AbcFFEiq (ORCPT + 31 others); Mon, 6 Jun 2016 00:38:46 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:33499 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753119AbcFFEil (ORCPT ); Mon, 6 Jun 2016 00:38:41 -0400 Received: by mail-pf0-f171.google.com with SMTP id y124so3201330pfy.0 for ; Sun, 05 Jun 2016 21:38:40 -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=32vOWpL4PINFyaRdZ5dh57VYCYyB4bER6EgfDgL71Ls=; b=GInPf4JuwEFUZjlyRYls0vu+GC/qPgnKF95YZwBeAXrgJepTGDtke21wXmFulb+uOt 01wieVLl7a+BrK28VT7U1L+z0xeJR9GxsCGe0aX6ZQDyG/qT7l9MXraSPtpKRPisGAuZ Qvcl/mTWr5A1eUURWNPLBYVsScIdTMVwckDcQ= 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=32vOWpL4PINFyaRdZ5dh57VYCYyB4bER6EgfDgL71Ls=; b=eLkV0W8xuilXKnbSO4M0SV5nEw7aNto4a7iHt+zIP1zEzy1ZYQdbsk4MDIVKXEepXA KEwLoszDSISNZJwWgOV0N8D/e8mGT0unGYK5ttJpz80ti69IzXhVfwlbtjC0XnBmOrpq IS3FQkxR9bNopbfHTDEzCB6OUAp8ubqtLfRg7ZDanSjMfRVCQUK470B3DwuDNg5AZcIi g+jrKJz5JL/QnKmdXoxSlYeqSPPtzZLI2EOIgZRExvOfwU6Shw+9L0Iic1k4gvqqnDdJ xmg9zeAQmkHi7NX/VlPgVDW6qNPTi9N/gFzkxFw37oTvcoijyDiFuwi4avFPLZOcfM5z Q+bQ== X-Gm-Message-State: ALyK8tJb7UdaREBnKGWQ8lhxxiLDG7RAdtdkh1hDI883cKDVkrRJ7tNfk1A9yj61AFL4UTkP X-Received: by 10.98.64.21 with SMTP id n21mr23216054pfa.161.1465187920191; Sun, 05 Jun 2016 21:38:40 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id d7sm13342883pfk.36.2016.06.05.21.38.37 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Jun 2016 21:38:39 -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 v2 2/4] rtl8188eu: Replace semaphore terminate_cmdthread_sema with completion Date: Mon, 6 Jun 2016 10:08:05 +0530 Message-Id: <1465187887-4960-3-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1465187887-4960-1-git-send-email-binoy.jayan@linaro.org> References: <1464947943-2008-1-git-send-email-binoy.jayan@linaro.org> <1465187887-4960-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 Reviewed-by: Arnd Bergmann --- 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); }