From patchwork Mon Jun 6 04:38:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69360 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1301909qgf; Sun, 5 Jun 2016 21:38:46 -0700 (PDT) X-Received: by 10.66.237.175 with SMTP id vd15mr22187115pac.139.1465187925732; Sun, 05 Jun 2016 21:38:45 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pl16si24029625pab.116.2016.06.05.21.38.45; Sun, 05 Jun 2016 21:38:45 -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 S1753113AbcFFEik (ORCPT + 31 others); Mon, 6 Jun 2016 00:38:40 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:36106 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003AbcFFEih (ORCPT ); Mon, 6 Jun 2016 00:38:37 -0400 Received: by mail-pa0-f47.google.com with SMTP id b5so2960925pas.3 for ; Sun, 05 Jun 2016 21:38:37 -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=M3ZBxtC9icQsLEIGcecnL1zxH/lUseELOP/9hHi3Jt8=; b=NDKckUCIOpiOXzDNzUQKKKbmUbYHlvmOQjbJjUUGCBriMr/fOjImnhGivi4Rf2o95j 14QXXMuPuf4sk7+EPfobiW+6Pe4V1xB8w996/7EpF90zz4xuLOst1NlOxdewow6E3Nsu YCjHoIk2TYEQPJjuCeSKyy5iMCfScrIVSEwWo= 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=M3ZBxtC9icQsLEIGcecnL1zxH/lUseELOP/9hHi3Jt8=; b=m4eONqCl94F10hlJKQ+905VVZC5xpcj8PCNWSL/chvDe0wjuYshT0XYB6xZiU7Wmgv MPOWdif+hmiFbGFSUol7skRWPglfY36nywvwBbcvHt4B8+lMeps6Ub+njEdiPmkLm85N MRD4WFiK0CcSu6VgiNR45w/yp4QTfuKHTVlDTnyzRoXyvuqVwy/j9/d5V3fRaMOYlkTb iN9T3jUfxgF5XlIvPp2WWMpYrSz9HY2OGt1Pe8zXXdQ8K008tpatPyJHQoiLTbbmF7mn ZpIefOIgfj1tBOO3BAImkG4a6SB7u438pt3exly5XF6NY/Lr78xGgqWqoUqqIGo4iMwd JtgA== X-Gm-Message-State: ALyK8tIZjhkQa+XoKjom+AbnBnJCZZWPLkTHt5DY1cr2rh137EQsB9H71R6YLVl0oFRc0T6x X-Received: by 10.66.255.7 with SMTP id am7mr22534682pad.75.1465187916981; Sun, 05 Jun 2016 21:38:36 -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.33 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Jun 2016 21:38:36 -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 1/4] irtl8188eu: Replace semaphore cmd_queue_sema with completion Date: Mon, 6 Jun 2016 10:08:04 +0530 Message-Id: <1465187887-4960-2-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 'cmd_queue_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 | 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);