From patchwork Fri Jun 3 09:59:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69231 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp178023qgf; Fri, 3 Jun 2016 02:59:51 -0700 (PDT) X-Received: by 10.66.152.111 with SMTP id ux15mr4208264pab.43.1464947991216; Fri, 03 Jun 2016 02:59:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m64si6672837pfb.124.2016.06.03.02.59.50; Fri, 03 Jun 2016 02:59:51 -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 S1752783AbcFCJ7m (ORCPT + 31 others); Fri, 3 Jun 2016 05:59:42 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35618 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752467AbcFCJ7k (ORCPT ); Fri, 3 Jun 2016 05:59:40 -0400 Received: by mail-pa0-f53.google.com with SMTP id xk1so13415811pac.2 for ; Fri, 03 Jun 2016 02:59:39 -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=1N+fGoa+IEZIjsCABHqHF80v7EOSMizpijJrjJGF9FA=; b=io0nssJl5MZQiuboUVepway5U288VG4YkhYn6UOiUP4+76Ip2/GZLj8hiP9d1Y9eY6 HfjTfnREAv6y/6CCSV4F5CYEL+pRk0t046iZzl5Q9q5RELtmdENneFYMHzefRo+5eZX/ fzCRSS00E0EG5XZsDcUsv7noeuYz0cg0vuplE= 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=1N+fGoa+IEZIjsCABHqHF80v7EOSMizpijJrjJGF9FA=; b=DCJJ2HO5ayXTqU3k1wvgsfNW75TxiOxR4TM/JLAenkOSD34v0p3abpDSC+U/CqGz5t rbnWjJ7rAoyn27Wzr9jtu6zRlaRslzEmNvfIjmjLqoPgvhiT+HLppPHlOdrupHuTYU+Q CnV4JDBmYHvkuhxQP/iChj0ed8X6Y4zK6xx6U5n6F2FVxKTYEtQX+TQ2ljPtZY0jPdTR wPqwYDiIj/Hgzgn2WxaJiQzwK7NG804w4pipNE31EJVRCXWcjEuwSBU2eybBIO5u3Hcm g4rnzgGMyXejnFK9j8gbLwTet37SumT2Rl35Amy/HtaKdzQ0Dwf2xrR0L32fAau3ngRd u7KA== X-Gm-Message-State: ALyK8tKygf0/xffPM4hmpjn6I63m7iu/MFBO8oWLNe93SsTxzC167Jk/k2zxRFvPjgce605O X-Received: by 10.67.22.129 with SMTP id hs1mr4174168pad.105.1464947979177; Fri, 03 Jun 2016 02:59:39 -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.36 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Jun 2016 02:59:38 -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 1/4] irtl8188eu: Replace semaphore cmd_queue_sema with completion Date: Fri, 3 Jun 2016 15:29:00 +0530 Message-Id: <1464947943-2008-2-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 'cmd_queue_sema' is used as completion, so convert it to struct completion. Signed-off-by: Binoy Jayan --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 6 +++--- drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +- drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 +- 3 files changed, 5 insertions(+), 5 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 7748523..a2937e7 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -27,7 +27,7 @@ No irqsave is necessary. int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { - sema_init(&(pcmdpriv->cmd_queue_sema), 0); + init_completion(&pcmdpriv->cmd_queue_comp); sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0); _rtw_init_queue(&(pcmdpriv->cmd_queue)); @@ -122,7 +122,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) res = _rtw_enqueue_cmd(&pcmdpriv->cmd_queue, cmd_obj); if (res == _SUCCESS) - up(&pcmdpriv->cmd_queue_sema); + complete(&pcmdpriv->cmd_queue_comp); exit: @@ -167,7 +167,7 @@ int rtw_cmd_thread(void *context) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x rtw_cmd_thread !!!!\n")); while (1) { - if (_rtw_down_sema(&pcmdpriv->cmd_queue_sema) == _FAIL) + if (wait_for_completion_interruptible(&pcmdpriv->cmd_queue_comp)) break; if (padapter->bDriverStopped || diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h b/drivers/staging/rtl8188eu/include/rtw_cmd.h index 08ca592..3532dd1 100644 --- a/drivers/staging/rtl8188eu/include/rtw_cmd.h +++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h @@ -39,7 +39,7 @@ struct cmd_obj { }; struct cmd_priv { - struct semaphore cmd_queue_sema; + struct completion cmd_queue_comp; struct semaphore terminate_cmdthread_sema; struct __queue cmd_queue; u8 cmdthd_running; diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index ae2caff..a696d2b 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c @@ -772,7 +772,7 @@ void rtw_stop_drv_threads(struct adapter *padapter) RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_stop_drv_threads\n")); /* Below is to terminate rtw_cmd_thread & event_thread... */ - up(&padapter->cmdpriv.cmd_queue_sema); + complete(&padapter->cmdpriv.cmd_queue_comp); if (padapter->cmdThread) _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema);