From patchwork Mon Jun 6 05:13:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69367 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1311315qgf; Sun, 5 Jun 2016 22:14:58 -0700 (PDT) X-Received: by 10.66.63.98 with SMTP id f2mr22776103pas.123.1465190098265; Sun, 05 Jun 2016 22:14:58 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oz4si24228186pac.91.2016.06.05.22.14.57; Sun, 05 Jun 2016 22:14:58 -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 S1753471AbcFFFOz (ORCPT + 31 others); Mon, 6 Jun 2016 01:14:55 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35892 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752650AbcFFFOQ (ORCPT ); Mon, 6 Jun 2016 01:14:16 -0400 Received: by mail-pa0-f53.google.com with SMTP id b5so3250641pas.3 for ; Sun, 05 Jun 2016 22:14:15 -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=qzwNB6+Umcsldf7aGLwkOZqrO7LCb1EEAFHD2R0yPnQ=; b=JKbIhFMip2jbPsNMww+42Es0KSiHo42goqvLnI48BxXWRLFy7PSB02Wq9P5kZH81/z NHlprziKpc+owbYUsCcFbS42i3YNwCJVjNO6/GCrezNDEA31IgA+rZWovm72wuTEXuWa sXsbyWlnrtinIqP1FdP8HkWiIXZy0XbofwgPs= 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=qzwNB6+Umcsldf7aGLwkOZqrO7LCb1EEAFHD2R0yPnQ=; b=FwkI7fm/dl1Yj98t6HIRS3SUZzrbzl4Z/dXzVyUwz1Zk/2j3OMK+NKuBb494UC6zkj WjWoC6bkkd5OhE/BbEgxKmVxKEXQvQxPDqyYpliFM5v0JWtf/7753fvrvGft33EccYME s4NsxoUDgTNhDxHUqJWkLCTSp2FXqacgcm9XOMvXsoIMuwCml0eaB0fSux5/6QA3crSn 5sj7VLRIcQjBouWLQBzgsZfKfjkuXiSjWOr8Er6Pv1Qv7ZF362A4+gglZZS9+NBFGMVc hHi6KjIcXy88sJCFw90I8gmFtWoUdWfZaX6i8RtsTe3B8BXzjxUgxGbMzQAWb0YX9mbJ I59Q== X-Gm-Message-State: ALyK8tLa8VbtgOP3B2Codnp4v8k/YJCXeG4VYzoBRu65Xdy5ZOREj64r8sDzw6LXVvfBzgAX X-Received: by 10.66.178.139 with SMTP id cy11mr22438050pac.157.1465190055098; Sun, 05 Jun 2016 22:14:15 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id h5sm21457443pat.0.2016.06.05.22.14.12 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Jun 2016 22:14:14 -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 v3 2/4] staging: r8188eu: Replace semaphore terminate_cmdthread_sema with completion Date: Mon, 6 Jun 2016 10:43:53 +0530 Message-Id: <1465190035-10359-3-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1465190035-10359-1-git-send-email-binoy.jayan@linaro.org> References: <1464947943-2008-1-git-send-email-binoy.jayan@linaro.org> <1465190035-10359-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 Acked-by: Larry Finger --- 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); }