Re: [PATCH 5/7] PCI/PM: Make power management op coding style consistent

Dan Carpenter
2019-10-16T13:52:53Z

On Mon, Oct 14, 2019 at 06:00:14PM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Some of the power management ops use this style:
>
> struct device_driver *drv = dev->driver;
> if (drv && drv->pm && drv->pm->prepare(dev))
> drv->pm->prepare(dev);
>
> while others use this:
>
> const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;

I like this patch a lot, especially the direct returns. But it
occurs to me that in the future this conditional would look better as

const struct dev_pm_ops *pm = driver_to_pm(dev->driver);

or something.

regards,
dan carpenter