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 <redacted>
---
drivers/scsi/scsi_pm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
index 5f0ad8b32e3a..8f40b60d3383 100644
--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -53,7 +53,7 @@ static int do_scsi_restore(struct device *dev, const struct dev_pm_ops *pm)
static int scsi_dev_type_suspend(struct device *dev,
int (*cb)(struct device *, const struct dev_pm_ops *))
{
- const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+ const struct dev_pm_ops *pm = driver_to_pm(dev->driver);
int err;
/* flush pending in-flight resume operations, suspend is synchronous */@@ -72,7 +72,7 @@ static int scsi_dev_type_suspend(struct device *dev,
static int scsi_dev_type_resume(struct device *dev,
int (*cb)(struct device *, const struct dev_pm_ops *))
{
- const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+ const struct dev_pm_ops *pm = driver_to_pm(dev->driver);
int err = 0;
err = cb(dev, pm);@@ -232,7 +232,7 @@ static int scsi_bus_restore(struct device *dev)
static int sdev_runtime_suspend(struct device *dev)
{
- const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+ const struct dev_pm_ops *pm = driver_to_pm(dev->driver);
struct scsi_device *sdev = to_scsi_device(dev);
int err = 0;
@@ -262,7 +262,7 @@ static int scsi_runtime_suspend(struct device *dev)
static int sdev_runtime_resume(struct device *dev)
{
struct scsi_device *sdev = to_scsi_device(dev);
- const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+ const struct dev_pm_ops *pm = driver_to_pm(dev->driver);
int err = 0;
blk_pre_runtime_resume(sdev->request_queue);--
2.26.2