From patchwork Sat Mar 2 13:23:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 2207071 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 118E43FCF2 for ; Sat, 2 Mar 2013 13:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752602Ab3CBN2Q (ORCPT ); Sat, 2 Mar 2013 08:28:16 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:30661 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752112Ab3CBNZW (ORCPT ); Sat, 2 Mar 2013 08:25:22 -0500 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJ100LCYBY8BC90@mailout2.samsung.com>; Sat, 02 Mar 2013 22:25:20 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id DC.3C.02494.0CDF1315; Sat, 02 Mar 2013 22:25:20 +0900 (KST) X-AuditID: cbfee68d-b7f636d0000009be-e7-5131fdc052ca Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id AC.2D.03918.0CDF1315; Sat, 02 Mar 2013 22:25:20 +0900 (KST) Received: from vivekkumarg-linuxpc.sisodomain.com ([107.108.214.169]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MJ100MZ8BXX7W70@mmp2.samsung.com>; Sat, 02 Mar 2013 22:25:20 +0900 (KST) From: Vivek Gautam To: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-samsung-soc@vger.kernel.org, gregkh@linuxfoundation.org, balbi@ti.com, sarah.a.sharp@linux.intel.com, kgene.kim@samsung.com, kishon@ti.com, Doug Anderson Subject: [PATCH v2 02/10] USB: dwc3: Adjust runtime pm to allow autosuspend Date: Sat, 02 Mar 2013 18:53:03 +0530 Message-id: <1362230590-20960-3-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.6.5 In-reply-to: <1362230590-20960-1-git-send-email-gautam.vivek@samsung.com> References: <1362230590-20960-1-git-send-email-gautam.vivek@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupikeLIzCtJLcpLzFFi42JZI2JSq3vgr2Ggwb8tMhYH79dbnF12kM2i efF6NoveBVfZLC487WGzuLxrDpvF7CX9LBYzzu9jsli0rJXZovnEKWYHLo/ZDRdZPOadDPTY P3cNu0ffllWMHsdvbGfy+LxJLoAtissmJTUnsyy1SN8ugStj/8ff7AX3OCt2fp7H3MDYxtHF yMkhIWAisa/zGyuELSZx4d56ti5GLg4hgaWMEo3zb7HCFG1ovckOkZjOKHF1zmYoZwqTRNem Q0wgVWwCuhJNb3cxgtgiArISh6/8ZgYpYhb4zShxfvccsFHCAt4SH7+2sIPYLAKqEifufGMG sXkFPCQ23rnLArFOQeLN7WdgcU4BT4np1zeD9QoB1fy5dxxss4TALnaJY4uvQQ0SkPg2+RBQ MwdQQlZi0wFmiDmSEgdX3GCZwCi8gJFhFaNoakFyQXFSepGhXnFibnFpXrpecn7uJkZgPJz+ 96x3B+PtA9aHGJOBxk1klhJNzgfGU15JvKGxibmpsamZkaWlpSlpwkrivHKXZAKFBNITS1Kz U1MLUovii0pzUosPMTJxcEo1MOpPFVKqZxEyPNvxI0Bb2OFg4qs5Ar25BRePKbzV2tnB/4Kh bbrfsbdJToErXzIXbVkZNG/T/F01vwzrd8UEV/2arnzib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sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The current code in the dwc3 probe effectively disables runtime pm from ever working because it calls a get() that was never put() until device removal. Change the runtime pm code to match the standard formula and allow runtime pm to function. Signed-off-by: Vivek Gautam CC: Doug Anderson --- drivers/usb/dwc3/core.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index be0672f..85914e0 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -528,6 +528,7 @@ static int dwc3_probe(struct platform_device *pdev) goto err3; } + pm_runtime_put_sync(dev); pm_runtime_allow(dev); return 0; @@ -557,6 +558,7 @@ err1: err0: dwc3_free_event_buffers(dwc); + pm_runtime_disable(&pdev->dev); return ret; } @@ -568,7 +570,8 @@ static int dwc3_remove(struct platform_device *pdev) usb_phy_set_suspend(dwc->usb2_phy, 1); usb_phy_set_suspend(dwc->usb3_phy, 1); - pm_runtime_put(&pdev->dev); + if (!pm_runtime_suspended(&pdev->dev)) + pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); dwc3_debugfs_exit(dwc);