From patchwork Tue Oct 6 08:55:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 7333761 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A727DBEEA4 for ; Tue, 6 Oct 2015 08:58:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BB5392064B for ; Tue, 6 Oct 2015 08:58:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 507442064E for ; Tue, 6 Oct 2015 08:58:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752152AbbJFI4d (ORCPT ); Tue, 6 Oct 2015 04:56:33 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:61104 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751479AbbJFI4b (ORCPT ); Tue, 6 Oct 2015 04:56:31 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NVS00AGNJI41C50@mailout1.w1.samsung.com>; Tue, 06 Oct 2015 09:56:28 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-6e-56138cbc5409 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 1F.CF.05269.CBC83165; Tue, 6 Oct 2015 09:56:28 +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 <0NVS0081GJI0HD70@eusync4.samsung.com>; Tue, 06 Oct 2015 09:56:28 +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 v5 1/2] usb: dwc2: remove no longer needed init_mutex Date: Tue, 06 Oct 2015 10:55:48 +0200 Message-id: <1444121749-22494-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <874mi4gale.fsf@saruman.tx.rr.com> References: <874mi4gale.fsf@saruman.tx.rr.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Nd09PcJhBu/PSlpsnLGe1WL36UuM Fq9fGFpc3jWHzWLG+X1MFouWtTJbrD1yl93iweGd7A4cHn1bVjF6bNn/mdHj8ya5AOYoLpuU 1JzMstQifbsEroz+09+ZC37KVfRff8fYwLhPsouRk0NCwERi/uGHrBC2mMSFe+vZuhi5OIQE ljJKPHu8gB3CaWKSeHh5CiNIFZuAoUTX2y42EFtEIEGib3k/WAezwFNGiYkvzrOAJIQFXCVO vL0P1sAioCrxdWETWAOvgIfE7b51LBDr5CT+v1zBBGJzCuhLNF3fAHaGkICexIbfi1kmMPIu YGRYxSiaWppcUJyUnmukV5yYW1yal66XnJ+7iRESTF93MC49ZnWIUYCDUYmHV+KmUJgQa2JZ cWXuIUYJDmYlEd6fXMJhQrwpiZVVqUX58UWlOanFhxilOViUxHln7nofIiSQnliSmp2aWpBa BJNl4uCUamCM+P43YavA4TbTbzpRnHt3z5i8+M5Gc86nbyt7w741+zdZPG53F7Xslq+ZW7yh /wqDVVpj+aQ4Xt5ldSwTAzSsWcNnd+tMjFnj1tzyR/p+lsrh9SsW3Nl1wyYmdPuRhxfEj6Ul np4fqWKjmn1g9jb/yzpFSUZb3vTymHDFh1ysW+Mi2tYWWKbEUpyRaKjFXFScCAAcqTGfIgIA AA== 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 --- 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);