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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 37AAFC433E0 for ; Tue, 26 May 2020 09:45:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C0B62070A for ; Tue, 26 May 2020 09:45:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731815AbgEZJpW (ORCPT ); Tue, 26 May 2020 05:45:22 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:55976 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728686AbgEZJpW (ORCPT ); Tue, 26 May 2020 05:45:22 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 791CE1C02C0; Tue, 26 May 2020 11:45:19 +0200 (CEST) Date: Tue, 26 May 2020 11:45:18 +0200 From: Pavel Machek To: "Rafael J. Wysocki" Cc: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Dan Carpenter , "Rafael J. Wysocki" , Len Brown , Kevin Hilman , Ulf Hansson , Greg Kroah-Hartman , Johan Hovold , Alex Elder , Bjorn Helgaas , "James E.J. Bottomley" , "Martin K. Petersen" , Felipe Balbi , Julian Wiedmann , Karsten Graul , Ursula Braun , Jakub Kicinski , Bjorn Andersson , John Stultz , "David S. Miller" , greybus-dev@lists.linaro.org, netdev , ACPI Devel Maling List , Linux PCI , Linux PM , linux-s390@vger.kernel.org, "open list:TARGET SUBSYSTEM" , "open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:" Subject: Re: [PATCH 2/8] ACPI: PM: Use the new device_to_pm() helper to access struct dev_pm_ops Message-ID: <20200526094518.GA4600@amd> References: <20200525182608.1823735-1-kw@linux.com> <20200525182608.1823735-3-kw@linux.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bg08WKrSYDhXBjb5" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue 2020-05-26 10:37:36, Rafael J. Wysocki wrote: > On Mon, May 25, 2020 at 8:26 PM Krzysztof Wilczy=C5=84ski = wrote: > > > > Use the new device_to_pm() helper to access Power Management callbacs > > (struct dev_pm_ops) for a particular device (struct device_driver). > > > > No functional change intended. > > > > Signed-off-by: Krzysztof Wilczy=C5=84ski > > --- > > drivers/acpi/device_pm.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c > > index 5832bc10aca8..b98a32c48fbe 100644 > > --- a/drivers/acpi/device_pm.c > > +++ b/drivers/acpi/device_pm.c > > @@ -1022,9 +1022,10 @@ static bool acpi_dev_needs_resume(struct device = *dev, struct acpi_device *adev) > > int acpi_subsys_prepare(struct device *dev) > > { > > struct acpi_device *adev =3D ACPI_COMPANION(dev); > > + const struct dev_pm_ops *pm =3D driver_to_pm(dev->driver); >=20 > I don't really see a reason for this change. >=20 > What's wrong with the check below? Duplicated code. Yes, compiler can sort it out, but... new version looks better to me. Best regards, pavel > > > > - if (dev->driver && dev->driver->pm && dev->driver->pm->prepare)= { > > - int ret =3D dev->driver->pm->prepare(dev); > > + if (pm && pm->prepare) { > > + int ret =3D pm->prepare(dev); --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --bg08WKrSYDhXBjb5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl7M5S0ACgkQMOfwapXb+vJLqgCcCbDmh7NooqBM+qslb58avjsp 78cAn1mUUlj/BAfzgJELHWPID2a0mmvg =+Cmh -----END PGP SIGNATURE----- --bg08WKrSYDhXBjb5--