lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 26 May 2020 10:38:56 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Krzysztof Wilczyński <kw@...ux.com>
Cc:     Dan Carpenter <dan.carpenter@...cle.com>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>, Kevin Hilman <khilman@...nel.org>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Pavel Machek <pavel@....cz>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Johan Hovold <johan@...nel.org>, Alex Elder <elder@...nel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Felipe Balbi <balbi@...nel.org>,
        Julian Wiedmann <jwi@...ux.ibm.com>,
        Karsten Graul <kgraul@...ux.ibm.com>,
        Ursula Braun <ubraun@...ux.ibm.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        John Stultz <john.stultz@...aro.org>,
        "David S. Miller" <davem@...emloft.net>,
        greybus-dev@...ts.linaro.org, netdev <netdev@...r.kernel.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux PCI <linux-pci@...r.kernel.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        linux-s390@...r.kernel.org,
        "open list:TARGET SUBSYSTEM" <linux-scsi@...r.kernel.org>,
        "open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:" 
        <linux-usb@...r.kernel.org>
Subject: Re: [PATCH 5/8] usb: phy: fsl: Use the new device_to_pm() helper to
 access struct dev_pm_ops

On Mon, May 25, 2020 at 8:26 PM Krzysztof Wilczyński <kw@...ux.com> 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ński <kw@...ux.com>
> ---
>  drivers/usb/phy/phy-fsl-usb.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
> index b451f4695f3f..3b9ad5db8380 100644
> --- a/drivers/usb/phy/phy-fsl-usb.c
> +++ b/drivers/usb/phy/phy-fsl-usb.c
> @@ -460,6 +460,7 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on)
>         struct device *dev;
>         struct fsl_otg *otg_dev =
>                 container_of(otg->usb_phy, struct fsl_otg, phy);
> +       const struct dev_pm_ops *pm;
>         u32 retval = 0;
>
>         if (!otg->host)
> @@ -479,8 +480,9 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on)
>                 else {
>                         otg_reset_controller();
>                         VDBG("host on......\n");
> -                       if (dev->driver->pm && dev->driver->pm->resume) {
> -                               retval = dev->driver->pm->resume(dev);
> +                       pm = driver_to_pm(dev->driver);
> +                       if (pm && pm->resume) {
> +                               retval = pm->resume(dev);

And why is the new version better this time?

>                                 if (fsm->id) {
>                                         /* default-b */
>                                         fsl_otg_drv_vbus(fsm, 1);
> @@ -504,8 +506,9 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on)
>                 else {
>                         VDBG("host off......\n");
>                         if (dev && dev->driver) {
> -                               if (dev->driver->pm && dev->driver->pm->suspend)
> -                                       retval = dev->driver->pm->suspend(dev);
> +                               pm = driver_to_pm(dev->driver);
> +                               if (pm && pm->suspend)
> +                                       retval = pm->suspend(dev);
>                                 if (fsm->id)
>                                         /* default-b */
>                                         fsl_otg_drv_vbus(fsm, 0);
> --
> 2.26.2
>

Powered by blists - more mailing lists