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: 54520 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id DD03E22FC5 for ; Tue, 6 Oct 2015 08:56:42 +0000 (UTC) Received: by lbbti1 with SMTP id ti1sf45592586lbb.3 for ; Tue, 06 Oct 2015 01:56:41 -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=rokbFd5QSFvE3I4PAj7N8qa5SDtXGEGTJ5+7jPEm92g=; b=WxqkBHVED17Usovi/1cBY8pv3tD5n8Q4nu52YseveU7nCa6502st5ArxxLl6lmuwsx IRyQyz02sJs9wf+OSEIUhTE+c+hJoEV9TUImoiBgVwvugTEZdDiWhk+rIpHp794bCSuQ MrZ0O4er0vtg+b5c2NTjPrDEh0i3Y/IKRQ42Rh7SuFCElS0dp4p3UWBfEywfdVSjiDue 6RMewuvfpDqjn+4+BZTds8By5w9zBlxzqF5DjoPt0k6O+7xgopk8oQ48ePn0LLXTK3Rd ePBcQuUVuT0m8/Dh2mGxH0LAMK6PwT/7aGSI+UPOdI9BV9PCi/4lxWadG4Kw10p8LY0z ZtOQ== X-Gm-Message-State: ALoCoQkdxqFc+fQMlDu93jAo7o9r2uk3T+u6RwpHF5Z4cEqujto+qVYngaCSeQJ6wjPl01iUQb/G X-Received: by 10.112.54.197 with SMTP id l5mr6040802lbp.21.1444121801844; Tue, 06 Oct 2015 01:56:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.38.206 with SMTP id m197ls550242lfm.55.gmail; Tue, 06 Oct 2015 01:56:41 -0700 (PDT) X-Received: by 10.25.18.160 with SMTP id 32mr9258025lfs.0.1444121801677; Tue, 06 Oct 2015 01:56:41 -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 sr10si20133958lbb.118.2015.10.06.01.56.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Oct 2015 01:56:41 -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 lbcao8 with SMTP id ao8so72181561lbc.3 for ; Tue, 06 Oct 2015 01:56:41 -0700 (PDT) X-Received: by 10.112.156.167 with SMTP id wf7mr13786314lbb.88.1444121801485; Tue, 06 Oct 2015 01:56:41 -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 w3csp1718730lbq; Tue, 6 Oct 2015 01:56:40 -0700 (PDT) X-Received: by 10.67.23.165 with SMTP id ib5mr45106249pad.26.1444121800410; Tue, 06 Oct 2015 01:56:40 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zz1si47256036pac.235.2015.10.06.01.56.38; Tue, 06 Oct 2015 01:56:40 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617AbbJFI4f (ORCPT + 30 others); Tue, 6 Oct 2015 04:56:35 -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-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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 --- 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);