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@xxxxxxxxx> > --- > 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 _______________________________________________ greybus-dev mailing list greybus-dev@xxxxxxxxxxxxxxxx https://lists.linaro.org/mailman/listinfo/greybus-dev