From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753449AbcHJS3I (ORCPT ); Wed, 10 Aug 2016 14:29:08 -0400 Received: from mga11.intel.com ([192.55.52.93]:15496 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753408AbcHJS3E (ORCPT ); Wed, 10 Aug 2016 14:29:04 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,499,1464678000"; d="asc'?scan'208";a="153543592" From: Felipe Balbi To: robert.foss@collabora.com, mathias.nyman@intel.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Julius Werner , Andrew Bresticker Cc: Robert Foss Subject: Re: [PACTH v5 1/2] usb: xhci: plat: Enable runtime PM In-Reply-To: <1470760731-26598-2-git-send-email-robert.foss@collabora.com> References: <1470760731-26598-1-git-send-email-robert.foss@collabora.com> <1470760731-26598-2-git-send-email-robert.foss@collabora.com> User-Agent: Notmuch/0.22.1+63~g994277e (https://notmuchmail.org) Emacs/25.1.1 (x86_64-pc-linux-gnu) Date: Wed, 10 Aug 2016 12:46:30 +0300 Message-ID: <87twet9csp.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, robert.foss@collabora.com writes: > From: Robert Foss > > Enable runtime PM for the xhci-plat device so that the parent device > may implement runtime PM. > > Signed-off-by: Robert Foss > > Tested-by: Robert Foss > --- > drivers/usb/host/xhci-plat.c | 29 +++++++++++++++++++++++++++-- > 1 file changed, 27 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c > index ed56bf9..7d3d111 100644 > --- a/drivers/usb/host/xhci-plat.c > +++ b/drivers/usb/host/xhci-plat.c > @@ -246,6 +246,9 @@ static int xhci_plat_probe(struct platform_device *pd= ev) > if (ret) > goto dealloc_usb2_hcd; >=20=20 > + pm_runtime_set_active(&pdev->dev); > + pm_runtime_enable(&pdev->dev); > + > return 0; >=20=20 >=20=20 > @@ -274,6 +277,8 @@ static int xhci_plat_remove(struct platform_device *d= ev) > struct xhci_hcd *xhci =3D hcd_to_xhci(hcd); > struct clk *clk =3D xhci->clk; >=20=20 > + pm_runtime_disable(&dev->dev); > + > usb_remove_hcd(xhci->shared_hcd); > usb_phy_shutdown(hcd->usb_phy); >=20=20 > @@ -292,6 +297,13 @@ static int xhci_plat_suspend(struct device *dev) > { > struct usb_hcd *hcd =3D dev_get_drvdata(dev); > struct xhci_hcd *xhci =3D hcd_to_xhci(hcd); > + int ret; > + > + ret =3D pm_runtime_get_sync(dev); > + if (ret < 0) { > + atomic_dec(&dev->power.usage_count); almost :-) You don't access power.usage_count directly :-) A pm_runtime_put() should do it, but perhaps there's a better version for this case. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXqvf2AAoJEIaOsuA1yqREmeYP/j0jLCVgQ76th7dpOZNCeJOD QQT+XAbj+b0ZBktCLvjhPMiaD23LIDgHYiPPVRDLLpeu/q46WvOnip5MBJAMfs5I XywkNKm829TaeMcjkCooKz7jiYIbgwQUHWUA3hfkx9ohJdSCcY9FA4z61lKeUswz WEtrwXUV+RII05FLAATGH2HGqkHGHoAkEwAKHONhYzvcv7+/eIgz53+hS1u1T5WR T9IxK15fzvruxMmru37GmbaGJdAxCP4TsSEVNWK8Bl1J532xrRQW5o3evpnN5PT3 f29bHlm86sOCToUIPiMMeRN2m4garL8Cog018JWdaip8sCX8I+wahYn9lpjZ/5hS altT/DmB6HnAIqkeajX9oOnCebYExszFJRPwN59IoDIDPfYFayyfl9ly8TE01FOH G4s2C2Ejnvgwqt/W6/1C8YlWFxmgt1MhfDZ6EPHjUygowmpMLa53es4fDJhInzov KK3O4mbE6bF80VV7kNHFjNDQxMFXMvkWKLIuayLfVFF+shHUmaxnqF0u0PYdxQoI RcvVPaNMn6horLU4dDSP9aTOpDslFVo5GHqYxubgKSmJBhWmgyK6aY1Dd1Fr+MBp FXeug/+Ehukk3i3UO4bL3uBraJ+1v/D32xxGOiYhzv/Yyu3cf8s33hkkI2lwS9EZ ZGSBtGSXXjnObFiODqof =FlRp -----END PGP SIGNATURE----- --=-=-=--