[PATCH 0/8] Add helper for accessing Power Management callbacs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This series aims to add a new driver_to_pm() helper allowing for
accessing the Power Management callbacs for a particular device.

Access to the callbacs (struct dev_pm_ops) is normally done through
using the pm pointer that is embedded within the device_driver struct.

This new helper allows for the code required to reference the pm pointer
and access Power Management callbas to be simplified.  Changing the
following:

  struct device_driver *drv = dev->driver;
  if (dev->driver && dev->driver->pm && dev->driver->pm->prepare) {
      int ret = dev->driver->pm->prepare(dev);

To:

  const struct dev_pm_ops *pm = driver_to_pm(dev->driver);
  if (pm && pm->prepare) {
      int ret = pm->prepare(dev);

Or, changing the following:

     const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;

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

This series builds on top of the previous commit 6da2f2ccfd2d ("PCI/PM:
Make power management op coding style consistent") that had an aim to
make accessing the Power Managemnet callbacs more consistent.

No functional change intended.

Links:
  https://lore.kernel.org/driverdev-devel/20191014230016.240912-6-helgaas@xxxxxxxxxx/
  https://lore.kernel.org/driverdev-devel/8592302.r4xC6RIy69@kreacher/
  https://lore.kernel.org/driverdev-devel/20191016135002.GA24678@kadam/

Krzysztof Wilczyński (8):
  driver core: Add helper for accessing Power Management callbacs
  ACPI: PM: Use the new device_to_pm() helper to access struct
    dev_pm_ops
  greybus: Use the new device_to_pm() helper to access struct dev_pm_ops
  scsi: pm: Use the new device_to_pm() helper to access struct
    dev_pm_ops
  usb: phy: fsl: Use the new device_to_pm() helper to access struct
    dev_pm_ops
  PCI/PM: Use the new device_to_pm() helper to access struct dev_pm_ops
  PM: Use the new device_to_pm() helper to access struct dev_pm_ops
  net/iucv: Use the new device_to_pm() helper to access struct
    dev_pm_ops

 drivers/acpi/device_pm.c         |  5 ++-
 drivers/base/power/domain.c      | 12 ++++--
 drivers/base/power/generic_ops.c | 65 ++++++++++++++------------------
 drivers/base/power/main.c        | 48 +++++++++++++++--------
 drivers/base/power/runtime.c     |  7 ++--
 drivers/greybus/bundle.c         |  4 +-
 drivers/pci/pci-driver.c         | 32 ++++++++--------
 drivers/scsi/scsi_pm.c           |  8 ++--
 drivers/usb/phy/phy-fsl-usb.c    | 11 ++++--
 include/linux/device/driver.h    | 15 ++++++++
 net/iucv/iucv.c                  | 30 +++++++++------
 11 files changed, 138 insertions(+), 99 deletions(-)

-- 
2.26.2




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux