Skip to content

Add helper for accessing Power Management callbacs

Krzysztof Wilczyński linux-acpi linux-pci linux-pm linux-s390 linux-scsi linux-usb netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8driver core: Add helper for accessing Power Management callbacsinclude/linux/device/driver.h+15 -03 replies
2/8ACPI: PM: Use the new device_to_pm() helper to access struct dev_pm_opsdrivers/acpi/device_pm.c+3 -23 replies
3/8greybus: Use the new device_to_pm() helper to access struct dev_pm_opsdrivers/greybus/bundle.c+2 -21 reply
4/8scsi: pm: Use the new device_to_pm() helper to access struct dev_pm_opsdrivers/scsi/scsi_pm.c+4 -40 replies
5/8usb: phy: fsl: Use the new device_to_pm() helper to access struct dev_pm_opsdrivers/usb/phy/phy-fsl-usb.c+7 -41 reply
6/8PCI/PM: Use the new device_to_pm() helper to access struct dev_pm_opsdrivers/pci/pci-driver.c+16 -160 replies
7/8PM: Use the new device_to_pm() helper to access struct dev_pm_opsdrivers/base/power/domain.c drivers/base/power/generic_ops.c drivers/base/power/main.c +1 more+73 -591 reply
8/8net/iucv: Use the new device_to_pm() helper to access struct dev_pm_opsnet/iucv/iucv.c+18 -128 replies

Reviews trailers per patch

1 of 8 patches has a Reviewed-by or Acked-by.

PatchAlex Elder
1/8
2/8
3/8R-b
4/8
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

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

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/[email protected]/
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(-)
Signature · 1 line
2.26.2