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: 7390801 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1DD0D9F1B9 for ; Wed, 14 Oct 2015 06:52:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 202D3206E8 for ; Wed, 14 Oct 2015 06:52:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D1EB205BE for ; Wed, 14 Oct 2015 06:52:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751533AbbJNGwz (ORCPT ); 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: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);