From patchwork Thu Jun 2 04:24:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69118 Delivered-To: patch@linaro.org Received: by 10.140.23.41 with SMTP id 38csp134686qgo; Wed, 1 Jun 2016 21:25:06 -0700 (PDT) X-Received: by 10.66.183.69 with SMTP id ek5mr2589132pac.153.1464841505946; Wed, 01 Jun 2016 21:25:05 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id un5si47583439pab.174.2016.06.01.21.25.05; Wed, 01 Jun 2016 21:25:05 -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 S1751293AbcFBEYl (ORCPT + 30 others); Thu, 2 Jun 2016 00:24:41 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:32893 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751165AbcFBEYf (ORCPT ); Thu, 2 Jun 2016 00:24:35 -0400 Received: by mail-pf0-f170.google.com with SMTP id b124so26225335pfb.0 for ; Wed, 01 Jun 2016 21:24:36 -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=9SGT242xKqJSXK+Wrj9oGv+kjENfSVu4iwP7VRrg/fs=; b=QqKWOBAcN4RkWPfdp3m3CPeiCFH11Wes2uD8rEThy+44gRtxiJMuTgLIX/554omt5y ejG8feCUFry46iokobCgxsMU/t4+PV7RbsKBBTh3lZzqSS03RjJbPCMyH6+BxTjccMMV lyS3/QjzTYWGpUd2GTbX4D33yfaVtYKcQ/VLc= 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=9SGT242xKqJSXK+Wrj9oGv+kjENfSVu4iwP7VRrg/fs=; b=X3fmR6kLo6NUITFZaAj+JWuyZykU+W9LFnze8W76Fyh65y50Wk7djloXKa0l1b3AXp DwR7irX5ZbJcOKJrYWvGzxLt2VaVNStfYs/RAua6GrYI3rGwoKgmLGwHIn+IaPuSzHaR 26qpG+35EHjNh9gPyBk4698Z51bqIxIL47H2YsqY3giHVW7SbDEnaFNlrKwqEfvAdSvc V/adhZhYCLMC7uZ/NV5gFSv9OFO59ii8vJdxBbR4obuVVgUevqSK51liEB3Aem6JSUn1 8qxT+anFfnMZe3cEIv21iK7m6vm+qATuuKMrLqmdnS8TjBWgEPQyGVOi6j0Cf54BRbH2 7wAQ== X-Gm-Message-State: ALyK8tKeV48EEWOr4PqU6koAEbL9NsLictKW4MOxyPf2OAVm0HPDvRBN2cdc7rrZkW6KqXoi X-Received: by 10.98.75.146 with SMTP id d18mr745987pfj.4.1464841475475; Wed, 01 Jun 2016 21:24:35 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id s86sm36652609pfi.69.2016.06.01.21.24.32 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Jun 2016 21:24:35 -0700 (PDT) From: Binoy Jayan To: Greg Kroah-Hartman , Larry Finger , Florian Schilhabel Cc: Arnd Bergmann , driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, Binoy Jayan Subject: [PATCH v2 3/4] rtl8712: intf_priv: Replace semaphore lock with completion Date: Thu, 2 Jun 2016 09:54:09 +0530 Message-Id: <1464841450-24772-4-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1464841450-24772-1-git-send-email-binoy.jayan@linaro.org> References: <1464841450-24772-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 'lock' in 'intf_priv' is used as completion, so convert it to a struct completion type. Signed-off-by: Binoy Jayan --- This patch depends on the following patch: rtl8712: Replace semaphore terminate_cmdthread_sema with completion drivers/staging/rtl8712/osdep_intf.h | 2 +- drivers/staging/rtl8712/usb_ops_linux.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project diff --git a/drivers/staging/rtl8712/osdep_intf.h b/drivers/staging/rtl8712/osdep_intf.h index aa0ec74..5d37e1f 100644 --- a/drivers/staging/rtl8712/osdep_intf.h +++ b/drivers/staging/rtl8712/osdep_intf.h @@ -36,7 +36,7 @@ struct intf_priv { /* when in USB, IO is through interrupt in/out endpoints */ struct usb_device *udev; struct urb *piorw_urb; - struct semaphore io_retevt; + struct completion io_retevt_comp; }; int r871x_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c index 454cdf6..fc3f263 100644 --- a/drivers/staging/rtl8712/usb_ops_linux.c +++ b/drivers/staging/rtl8712/usb_ops_linux.c @@ -50,7 +50,7 @@ uint r8712_usb_init_intf_priv(struct intf_priv *pintfpriv) pintfpriv->piorw_urb = usb_alloc_urb(0, GFP_ATOMIC); if (!pintfpriv->piorw_urb) return _FAIL; - sema_init(&(pintfpriv->io_retevt), 0); + init_completion(&pintfpriv->io_retevt_comp); return _SUCCESS; } @@ -163,7 +163,7 @@ static void usb_write_mem_complete(struct urb *purb) else padapter->bSurpriseRemoved = true; } - up(&pintfpriv->io_retevt); + complete(&pintfpriv->io_retevt_comp); } void r8712_usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) @@ -187,7 +187,7 @@ void r8712_usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) wmem, cnt, usb_write_mem_complete, pio_queue); usb_submit_urb(piorw_urb, GFP_ATOMIC); - _down_sema(&pintfpriv->io_retevt); + wait_for_completion_interruptible(&pintfpriv->io_retevt_comp); } static void r8712_usb_read_port_complete(struct urb *purb)