[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200525182608.1823735-1-kw@linux.com>
Date: Mon, 25 May 2020 18:26:00 +0000
From: Krzysztof Wilczyński <kw@...ux.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: "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>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
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: [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/20191014230016.240912-6-helgaas@kernel.org/
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
Powered by blists - more mailing lists