Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753469AbdDDLgm (ORCPT ); Tue, 4 Apr 2017 07:36:42 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:31622 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752137AbdDDLgk (ORCPT ); Tue, 4 Apr 2017 07:36:40 -0400 X-IronPort-AV: E=Sophos;i="5.36,275,1486393200"; d="scan'208";a="238681021" From: Yoshihiro Shimoda To: "kishon@ti.com" CC: "linux-kernel@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" Subject: RE: [PATCH v3] phy: rcar-gen3-usb2: fix implementation for runtime PM Thread-Topic: [PATCH v3] phy: rcar-gen3-usb2: fix implementation for runtime PM Thread-Index: AQHSnFMb/1icRmBG902CwWIdxUELXaG1NmzQ Date: Tue, 4 Apr 2017 11:36:34 +0000 Message-ID: References: <1489448261-4477-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> In-Reply-To: <1489448261-4477-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: ti.com; dkim=none (message not signed) header.d=none;ti.com; dmarc=none action=none header.from=renesas.com; x-originating-ip: [211.11.155.141] x-microsoft-exchange-diagnostics: 1;PS1PR06MB1690;7:5t7MXG6WIJNnCljs1U5BJO/9Eu96elG/ZLMlM66CI3fiWuM//QHmsSXsRqOms6txjHdM9rjM0RT3fa6oPwrb6237414RTkhy2d24fxn23bKF5eyvbMgAVJSw94Wk/cWTrUCKlMi8YuXSibozPV3Xn8q8+BafpTeOIjtiMFDz5K3lLV9IlMHrN8GKhkDZSF/YS1z84/jomPej93PYgPxHeQoSpqDZWP0fc8bVJkLPNMHwckhhs2Jbvo/1GpL7fU7MM4Xq/Q7qtekI8ILOyRYpXrsT3iPLSzCH/4z4k42iUEnkGwKfMDuFoKUQlz141IwVqKP7HBNpJe9X4kTB9rcXvg==;20:7awWCbsI2i/7w6asdUB4EQZawoXvofR+hk8HY8dGujT/6ZWawGP6q7y4MrqbIMe67XX2sYwM4ri4JO53UajS4V8TmRRtffEMd7BZ0w9oNtkBz6DALG2TtytSNX9NMWld2nZG47ndxlhF5L1W6KS6yLdQ4eaO/Sb6hNqG6PMfpLQ= x-ms-office365-filtering-correlation-id: 8366481a-6c4e-40de-70d8-08d47b4ed910 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:PS1PR06MB1690; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(6072148);SRVR:PS1PR06MB1690;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1690; x-forefront-prvs: 0267E514F9 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39410400002)(39400400002)(39450400003)(39850400002)(39860400002)(39840400002)(23433003)(377454003)(3660700001)(189998001)(7736002)(8936002)(66066001)(86362001)(38730400002)(2501003)(230783001)(74316002)(2900100001)(305945005)(3846002)(6116002)(102836003)(5640700003)(3280700002)(54906002)(53936002)(6436002)(5250100002)(33656002)(99286003)(6246003)(7696004)(229853002)(5660300001)(8676002)(1730700003)(9686003)(6506006)(2906002)(81166006)(2950100002)(54356999)(6916009)(2351001)(50986999)(25786009)(4326008)(55016002);DIR:OUT;SFP:1102;SCL:1;SRVR:PS1PR06MB1690;H:PS1PR06MB1692.apcprd06.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2017 11:36:34.2268 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1690 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v34Bak0L010846 Content-Length: 3487 Lines: 114 Hi Kishon, > From: Yoshihiro Shimoda, Sent: Tuesday, March 14, 2017 8:38 AM > > This patch fixes an issue that this driver doesn't take care of the runtime > PM. This code assumed that devm_phy_create() called pm_runtime_enable(dev), > but it misunderstood the dev_phy_create()'s specification. > This driver should call its own pm_runtime_enable() before dev_phy_create(). > > Fixes: f3b5a8d9b50d ("phy: rcar-gen3-usb2: Add R-Car Gen3 USB2 PHY driver") > Signed-off-by: Yoshihiro Shimoda > --- > Changes from v2: > - revise the commit log (s/pm_runtime_pm/pm_runtime_enable) > > Changes from v1: > - revise the commit log (s/the own/its own/) > - simplify return code in probe(). I'm afraid but would you review this patch? Best regards, Yoshihiro Shimoda > drivers/phy/phy-rcar-gen3-usb2.c | 31 ++++++++++++++++++++++++------- > 1 file changed, 24 insertions(+), 7 deletions(-) > > diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c > index afb4d04..54c3429 100644 > --- a/drivers/phy/phy-rcar-gen3-usb2.c > +++ b/drivers/phy/phy-rcar-gen3-usb2.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -395,7 +396,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) > struct rcar_gen3_chan *channel; > struct phy_provider *provider; > struct resource *res; > - int irq; > + int irq, ret = 0; > > if (!dev->of_node) { > dev_err(dev, "This driver needs device tree\n"); > @@ -434,17 +435,24 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) > } > } > > - /* devm_phy_create() will call pm_runtime_enable(dev); */ > + /* > + * devm_phy_create() will call pm_runtime_enable(&phy->dev); > + * And then, phy-core will manage runtime pm for this device. > + */ > + pm_runtime_enable(dev); > channel->phy = devm_phy_create(dev, NULL, &rcar_gen3_phy_usb2_ops); > if (IS_ERR(channel->phy)) { > dev_err(dev, "Failed to create USB2 PHY\n"); > - return PTR_ERR(channel->phy); > + ret = PTR_ERR(channel->phy); > + goto error; > } > > channel->vbus = devm_regulator_get_optional(dev, "vbus"); > if (IS_ERR(channel->vbus)) { > - if (PTR_ERR(channel->vbus) == -EPROBE_DEFER) > - return PTR_ERR(channel->vbus); > + if (PTR_ERR(channel->vbus) == -EPROBE_DEFER) { > + ret = PTR_ERR(channel->vbus); > + goto error; > + } > channel->vbus = NULL; > } > > @@ -454,15 +462,22 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) > provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); > if (IS_ERR(provider)) { > dev_err(dev, "Failed to register PHY provider\n"); > + ret = PTR_ERR(provider); > + goto error; > } else if (channel->has_otg) { > int ret; > > ret = device_create_file(dev, &dev_attr_role); > if (ret < 0) > - return ret; > + goto error; > } > > - return PTR_ERR_OR_ZERO(provider); > + return 0; > + > +error: > + pm_runtime_disable(dev); > + > + return ret; > } > > static int rcar_gen3_phy_usb2_remove(struct platform_device *pdev) > @@ -472,6 +487,8 @@ static int rcar_gen3_phy_usb2_remove(struct platform_device *pdev) > if (channel->has_otg) > device_remove_file(&pdev->dev, &dev_attr_role); > > + pm_runtime_disable(&pdev->dev); > + > return 0; > }; > > -- > 1.9.1