From patchwork Wed Oct 14 06:52:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 54886 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id AE55F23012 for ; Wed, 14 Oct 2015 06:52:59 +0000 (UTC) Received: by lbbti1 with SMTP id ti1sf20637098lbb.3 for ; Tue, 13 Oct 2015 23:52:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=nh2GlQ7fSw6PPX5JuqNcfsQAooUVDUrQkVEjWlk2g6o=; b=dlkR6dtAlIWH9Voe1KB1UVGkMQ+uJnpzENFC2E2cLkxGMaVlla/KTlcgw+kFJaEQkk kgmkitD4TaJjuscZJSMtic5Ki3E0d+JuWSGbMBOvryHl9udP7DhHovextFMZjfETi/hp 5gQg6s3HpGsGj2Vf+eDF1W5mjJ8V4OzGJYXznSZveI6vX+rioxvn7H4ueW80DfMBrey8 hkLoW0ztRzv41q9J82D8P4CJiIMw2vsoXRcwrgS4y3TJEaqBApiU98adLf/AbqmTZGbl lEx6/PfdC9ckSl+vNqwwdQqxFtkg5h6iw9qdS47uDK2S/S6Qay/7zJpNGMqOXbG5mXDx IVaQ== X-Gm-Message-State: ALoCoQmwcNM7FqaHd2labKxULXW+f6o+AaYJqc8MAGCvOhVhv6R7GMQP8eSPr+IbfVIA+7VcwbtR X-Received: by 10.194.156.193 with SMTP id wg1mr333136wjb.3.1444805578656; Tue, 13 Oct 2015 23:52:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.27.206 with SMTP id b197ls2882lfb.26.gmail; Tue, 13 Oct 2015 23:52:58 -0700 (PDT) X-Received: by 10.25.89.141 with SMTP id n135mr430533lfb.87.1444805578219; Tue, 13 Oct 2015 23:52:58 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id yj8si4603409lbb.100.2015.10.13.23.52.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Oct 2015 23:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbck17 with SMTP id ck17so39465834lbb.1 for ; Tue, 13 Oct 2015 23:52:57 -0700 (PDT) X-Received: by 10.112.151.106 with SMTP id up10mr692264lbb.106.1444805577822; Tue, 13 Oct 2015 23:52:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2535301lbq; Tue, 13 Oct 2015 23:52:56 -0700 (PDT) X-Received: by 10.68.90.195 with SMTP id by3mr2001005pbb.148.1444805576570; Tue, 13 Oct 2015 23:52:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yi1si10892425pbb.246.2015.10.13.23.52.56; Tue, 13 Oct 2015 23:52:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751533AbbJNGwz (ORCPT + 4 others); Wed, 14 Oct 2015 02:52:55 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:45126 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751320AbbJNGwy (ORCPT ); Wed, 14 Oct 2015 02:52:54 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NW7003HB743DD30@mailout3.w1.samsung.com>; Wed, 14 Oct 2015 07:52:51 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-eb-561dfbc3855a Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 96.02.04846.3CBFD165; Wed, 14 Oct 2015 07:52:51 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NW7001WR73QVE50@eusync4.samsung.com>; Wed, 14 Oct 2015 07:52:51 +0100 (BST) From: Marek Szyprowski To: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Robert Baldyga , John Youn , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH v6 1/2] usb: dwc2: remove no longer needed init_mutex Date: Wed, 14 Oct 2015 08:52:28 +0200 Message-id: <1444805549-21185-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <2B3535C5ECE8B5419E3ECBE30077290901DC38A41D@US01WEMBX2.internal.synopsys.com> References: <2B3535C5ECE8B5419E3ECBE30077290901DC38A41D@US01WEMBX2.internal.synopsys.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Nd3Dv2XDDB6/kLLYOGM9q8Xu05cY LV6/MLS4vGsOm8WM8/uYLBYta2W2WHvkLrvFg8M72R04PPq2rGL02LL/M6PH501yAcxRXDYp qTmZZalF+nYJXBmzph1nLLgiX3G+YS9zA2O/VBcjJ4eEgInE1dlfWCBsMYkL99azdTFycQgJ LGWUmHLkJxOE08Qk8WLCInaQKjYBQ4mut11sILaIQIJE3/J+sA5mgaeMEhNfnAcbJSzgKrHl 1Towm0VAVWLhyi4mEJtXwEPi1ZQ+Zoh1chL/X64Ai3MKxEi8WbiUFcQWEoiW+HbvC+sERt4F jAyrGEVTS5MLipPScw31ihNzi0vz0vWS83M3MUKC6csOxsXHrA4xCnAwKvHwZqyWDRNiTSwr rsw9xCjBwawkwqv0DCjEm5JYWZValB9fVJqTWnyIUZqDRUmcd+6u9yFCAumJJanZqakFqUUw WSYOTqkGRvPZxYx8q2bovLpwWPlM+lqeyOtJpk/vVuuGRWzKW202a+7WG1eVo1tja45Vt9p6 q0my3rO4rhv85fI7DX/PrZeuL7ndkn5sffRW3f17z5ck6PTMqWbkVJNf1PnfOajxWd/teJO7 Pip/nAxi75+8r8kb8OJj7uSGXUcn9iuk6P6I2FbnndbxSomlOCPRUIu5qDgRABDl/NYiAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , init_mutex is a leftover from the time, when s3c-hsotg driver did not implement proper pull up/down control and emulated it by enabling enabling/disabling usb phy. Proper pull up/down control has been added by commit 5b9451f8c4fbaf0549139755fb45ff2b57975b7f ("usb: dwc2: gadget: use soft-disconnect udc feature in pullup() method"), so init_muxtex can be removed now to avoid potential deadlocks with other locks. Signed-off-by: Marek Szyprowski Acked-by: John Youn Tested-by: John Youn --- drivers/usb/dwc2/core.h | 1 - drivers/usb/dwc2/gadget.c | 17 ----------------- drivers/usb/dwc2/platform.c | 1 - 3 files changed, 19 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index ebf2504..89091db 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -712,7 +712,6 @@ struct dwc2_hsotg { struct regulator_bulk_data supplies[ARRAY_SIZE(dwc2_hsotg_supply_names)]; spinlock_t lock; - struct mutex init_mutex; void *priv; int irq; struct clk *clk; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7e5670c..79d9f3b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3193,7 +3193,6 @@ static int dwc2_hsotg_udc_start(struct usb_gadget *gadget, return -EINVAL; } - mutex_lock(&hsotg->init_mutex); WARN_ON(hsotg->driver); driver->driver.bus = NULL; @@ -3220,12 +3219,9 @@ static int dwc2_hsotg_udc_start(struct usb_gadget *gadget, dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name); - mutex_unlock(&hsotg->init_mutex); - return 0; err: - mutex_unlock(&hsotg->init_mutex); hsotg->driver = NULL; return ret; } @@ -3246,8 +3242,6 @@ static int dwc2_hsotg_udc_stop(struct usb_gadget *gadget) if (!hsotg) return -ENODEV; - mutex_lock(&hsotg->init_mutex); - /* all endpoints should be shutdown */ for (ep = 1; ep < hsotg->num_of_eps; ep++) { if (hsotg->eps_in[ep]) @@ -3270,8 +3264,6 @@ static int dwc2_hsotg_udc_stop(struct usb_gadget *gadget) regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); - mutex_unlock(&hsotg->init_mutex); - return 0; } @@ -3307,7 +3299,6 @@ static int dwc2_hsotg_pullup(struct usb_gadget *gadget, int is_on) return 0; } - mutex_lock(&hsotg->init_mutex); spin_lock_irqsave(&hsotg->lock, flags); if (is_on) { hsotg->enabled = 1; @@ -3321,7 +3312,6 @@ static int dwc2_hsotg_pullup(struct usb_gadget *gadget, int is_on) hsotg->gadget.speed = USB_SPEED_UNKNOWN; spin_unlock_irqrestore(&hsotg->lock, flags); - mutex_unlock(&hsotg->init_mutex); return 0; } @@ -3832,8 +3822,6 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg) if (hsotg->lx_state != DWC2_L0) return ret; - mutex_lock(&hsotg->init_mutex); - if (hsotg->driver) { int ep; @@ -3861,8 +3849,6 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg) clk_disable(hsotg->clk); } - mutex_unlock(&hsotg->init_mutex); - return ret; } @@ -3874,8 +3860,6 @@ int dwc2_hsotg_resume(struct dwc2_hsotg *hsotg) if (hsotg->lx_state == DWC2_L2) return ret; - mutex_lock(&hsotg->init_mutex); - if (hsotg->driver) { dev_info(hsotg->dev, "resuming usb gadget %s\n", hsotg->driver->driver.name); @@ -3892,7 +3876,6 @@ int dwc2_hsotg_resume(struct dwc2_hsotg *hsotg) dwc2_hsotg_core_connect(hsotg); spin_unlock_irqrestore(&hsotg->lock, flags); } - mutex_unlock(&hsotg->init_mutex); return ret; } diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index b920e43..581e9ca 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -252,7 +252,6 @@ static int dwc2_driver_probe(struct platform_device *dev) } spin_lock_init(&hsotg->lock); - mutex_init(&hsotg->init_mutex); /* Detect config values from hardware */ retval = dwc2_get_hwparams(hsotg);