From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7F1ACA9EA0 for ; Fri, 25 Oct 2019 10:25:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9890820578 for ; Fri, 25 Oct 2019 10:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571999123; bh=2bhAs4HeFwnYaEqVhABr4RDHPo2tmF5nfpo1O2B0UlQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:List-ID:From; b=Ku84h4/LgEdWXcTWrdHRakDKisgsR7AF/LBBQK/CWZd0zWb19GczI805n2tsGcW/Y 3qGmOFLenlCisawyvWRsbabaPbxvA1NPnP0E1nI2F2wa1yYDWNB+4Qw6t3T1CPNH0V 4JVhQtIlR1/7+lG2m4NxtJnsBZ7AELc/0komhzUE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438823AbfJYKZX (ORCPT ); Fri, 25 Oct 2019 06:25:23 -0400 Received: from mga11.intel.com ([192.55.52.93]:42295 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438821AbfJYKZW (ORCPT ); Fri, 25 Oct 2019 06:25:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2019 03:25:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,228,1569308400"; d="scan'208";a="201773661" Received: from pipin.fi.intel.com (HELO pipin) ([10.237.72.175]) by orsmga003.jf.intel.com with ESMTP; 25 Oct 2019 03:25:18 -0700 From: Felipe Balbi To: Vicente Bergas Cc: Robin Murphy , Heiko Stuebner , Will Deacon , MarcZyngier , Catalin Marinas , Matthias Brugger , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH] usb: dwc3: Add shutdown to platform_driver In-Reply-To: References: <4d18d4f7-a00e-bd60-6361-51054eba3bca@arm.com> <20190817174140.6394-1-vicencb@gmail.com> <8d48017a-64c5-4b25-8d85-113ffcf502c9@gmail.com> <87v9uix1sv.fsf@gmail.com> <645526b8-bfed-4cc6-9500-1843c5fe0da9@gmail.com> <0edb55d4-3bad-47ac-9d29-8d994d182e67@gmail.com> <877e4wj7ly.fsf@gmail.com> Date: Fri, 25 Oct 2019 13:25:17 +0300 Message-ID: <87pnil2kc2.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org hi, Vicente Bergas writes: > On Wednesday, October 23, 2019 8:31:21 AM CEST, Felipe Balbi wrote: >> Hi, >> >> (sorry for the long delay) >> >> Vicente Bergas writes: >> >>> On Tuesday, August 27, 2019 2:16:20 PM CEST, Vicente Bergas wrote: ... >> >> I meant something like this: >> >> diff --git a/drivers/usb/dwc3/dwc3-of-simple.c >> b/drivers/usb/dwc3/dwc3-of-simple.c >> index bdac3e7d7b18..e64754be47b4 100644 >> --- a/drivers/usb/dwc3/dwc3-of-simple.c >> +++ b/drivers/usb/dwc3/dwc3-of-simple.c >> @@ -110,12 +110,9 @@ static int dwc3_of_simple_probe(struct >> platform_device *pdev) >> return ret; >> } >> >> -static int dwc3_of_simple_remove(struct platform_device *pdev) >> +static void __dwc3_of_simple_teardown(struct dwc3_of_simple *simple) >> { >> - struct dwc3_of_simple *simple = platform_get_drvdata(pdev); >> - struct device *dev = &pdev->dev; >> - >> - of_platform_depopulate(dev); >> + of_platform_depopulate(simple->dev); >> >> clk_bulk_disable_unprepare(simple->num_clocks, simple->clks); >> clk_bulk_put_all(simple->num_clocks, simple->clks); >> @@ -126,13 +123,27 @@ static int dwc3_of_simple_remove(struct >> platform_device *pdev) >> >> reset_control_put(simple->resets); >> >> - pm_runtime_disable(dev); >> - pm_runtime_put_noidle(dev); >> - pm_runtime_set_suspended(dev); >> + pm_runtime_disable(simple->dev); >> + pm_runtime_put_noidle(simple->dev); >> + pm_runtime_set_suspended(simple->dev); >> +} >> + >> +static int dwc3_of_simple_remove(struct platform_device *pdev) >> +{ >> + struct dwc3_of_simple *simple = platform_get_drvdata(pdev); >> + >> + __dwc3_of_simple_teardown(simple); >> >> return 0; >> } >> >> +static void dwc3_of_simple_shutdown(struct platform_device *pdev) >> +{ >> + struct dwc3_of_simple *simple = platform_get_drvdata(pdev); >> + >> + __dwc3_of_simple_teardown(simple); >> +} >> + >> static int __maybe_unused >> dwc3_of_simple_runtime_suspend(struct device *dev) >> { >> struct dwc3_of_simple *simple = dev_get_drvdata(dev); >> @@ -190,6 +201,7 @@ MODULE_DEVICE_TABLE(of, of_dwc3_simple_match); >> static struct platform_driver dwc3_of_simple_driver = { >> .probe = dwc3_of_simple_probe, >> .remove = dwc3_of_simple_remove, >> + .shutdown = dwc3_of_simple_shutdown, >> .driver = { >> .name = "dwc3-of-simple", >> .of_match_table = of_dwc3_simple_match, >> >> Can you make sure it works as you intended? > > Hi Felipe, > just applied your approach to v5.3.7 and it is working properly. Do you want to send it as a formal patch or shall I do it? -- balbi