From patchwork Thu Oct 16 12:58:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 5091761 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 35305C11AD for ; Thu, 16 Oct 2014 12:58:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FC5820154 for ; Thu, 16 Oct 2014 12:58:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E4002016C for ; Thu, 16 Oct 2014 12:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751872AbaJPM6n (ORCPT ); Thu, 16 Oct 2014 08:58:43 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:57455 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752442AbaJPM6b (ORCPT ); Thu, 16 Oct 2014 08:58:31 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDJ00HS4G6B6G80@mailout1.w1.samsung.com>; Thu, 16 Oct 2014 14:01:23 +0100 (BST) X-AuditID: cbfec7f4-b7f156d0000063c7-c8-543fc0f47af1 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 20.75.25543.4F0CF345; Thu, 16 Oct 2014 13:58:28 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NDJ00F34G17BB00@eusync2.samsung.com>; Thu, 16 Oct 2014 13:58:28 +0100 (BST) From: Marek Szyprowski To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Kyungmin Park , Robert Baldyga , Paul Zimmerman , Krzysztof Kozlowski Subject: [PATCH 8/9] usb: dwc2/gadget: fix calls to phy control functions in suspend/resume code Date: Thu, 16 Oct 2014 14:58:04 +0200 Message-id: <1413464285-24172-9-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1413464285-24172-1-git-send-email-m.szyprowski@samsung.com> References: <1413464285-24172-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNJMWRmVeSWpSXmKPExsVy+t/xK7pfDtiHGHx9oWDx+oWhxdmmN+wW M87vY7JYtKyV2WLtkbvsFtunTGeyeHB4J7sDu0ffllWMHlv2f2b0+LxJLoA5issmJTUnsyy1 SN8ugStj6b19LAU7uCtaF0c2MN7k7GLk5JAQMJE4tuoPM4QtJnHh3nq2LkYuDiGBpYwSa+b+ ZIVw+pgktp7byQJSxSZgKNH1tosNxBYRcJBYsvQOWAezwB1GifX7PzGBJIQFkiQuLzrBCGKz CKhKNC34B2bzCnhI/FzbwgKxTk7i/8sVYPWcAp4SuzavBDtDCKjm/NXpjBMYeRcwMqxiFE0t TS4oTkrPNdQrTswtLs1L10vOz93ECAmgLzsYFx+zOsQowMGoxMOrEWwfIsSaWFZcmXuIUYKD WUmEd9EkoBBvSmJlVWpRfnxRaU5q8SFGJg5OqQbGNJGDzt5yonEWm1JLu089W2S79sGDv1/E 7woesJXxjf2Qu+gR59uzb7bJMoRVVM770mT0NO4Pb86aWz5Pcs4ITphm+TY27f4Ce8XAEs4p RTvclszRTDrMsbquP+TUk9+h6Vccr66YfpHP9bPt+Xe/PO/3Bx+ccL3BduI0s5eb/Gb92q36 o+1ZuBJLcUaioRZzUXEiAPmIxl3+AQAA 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 This patch moves calls to phy enable/disable out of spinlock protected blocks in device suspend/resume to fix incorrect caller context. Phy related functions must not be called from atomic context. Signed-off-by: Marek Szyprowski --- drivers/usb/dwc2/gadget.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index cdf417a7ae63..052b1a857291 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3656,11 +3656,13 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) hsotg->driver->driver.name); spin_lock_irqsave(&hsotg->lock, flags); + s3c_hsotg_core_disconnect(hsotg); s3c_hsotg_disconnect(hsotg); - s3c_hsotg_phy_disable(hsotg); hsotg->gadget.speed = USB_SPEED_UNKNOWN; spin_unlock_irqrestore(&hsotg->lock, flags); + s3c_hsotg_phy_disable(hsotg); + if (hsotg->driver) { int ep; for (ep = 0; ep < hsotg->num_of_eps; ep++) @@ -3689,9 +3691,10 @@ static int s3c_hsotg_resume(struct platform_device *pdev) hsotg->supplies); } - spin_lock_irqsave(&hsotg->lock, flags); s3c_hsotg_phy_enable(hsotg); - s3c_hsotg_core_init_disconnect(hsotg); + + spin_lock_irqsave(&hsotg->lock, flags); + s3c_hsotg_core_init_disconnected(hsotg); s3c_hsotg_core_connect(hsotg); spin_unlock_irqrestore(&hsotg->lock, flags);