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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200526063521.GC2578492@kroah.com>
Date:   Tue, 26 May 2020 08:35:21 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.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>, 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@...r.kernel.org,
        linux-acpi@...r.kernel.org, linux-pci@...r.kernel.org,
        linux-pm@...r.kernel.org, linux-s390@...r.kernel.org,
        linux-scsi@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH 8/8] net/iucv: Use the new device_to_pm() helper to
 access struct dev_pm_ops

On Mon, May 25, 2020 at 06:26:08PM +0000, Krzysztof Wilczyński 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>
> ---
>  net/iucv/iucv.c | 30 ++++++++++++++++++------------
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
> index 9a2d023842fe..1a3029ab7c1f 100644
> --- a/net/iucv/iucv.c
> +++ b/net/iucv/iucv.c
> @@ -1836,23 +1836,23 @@ static void iucv_external_interrupt(struct ext_code ext_code,
>  
>  static int iucv_pm_prepare(struct device *dev)
>  {
> -	int rc = 0;
> +	const struct dev_pm_ops *pm = driver_to_pm(dev->driver);
>  
>  #ifdef CONFIG_PM_DEBUG
>  	printk(KERN_INFO "iucv_pm_prepare\n");
>  #endif
> -	if (dev->driver && dev->driver->pm && dev->driver->pm->prepare)
> -		rc = dev->driver->pm->prepare(dev);
> -	return rc;
> +	return pm && pm->prepare ? pm->prepare(dev) : 0;

No need for ? : here either, just use if () please.

It's "interesting" how using your new helper doesn't actually make the
code smaller.  Perhaps it isn't a good helper function?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ