9 #include <linux/export.h>
12 #include <scsi/scsi.h>
33 dev_dbg(dev,
"scsi suspend: %d\n", err);
37 static int scsi_dev_type_resume(
struct device *dev)
46 dev_dbg(dev,
"scsi resume: %d\n", err);
50 #ifdef CONFIG_PM_SLEEP
62 if (pm_runtime_suspended(dev)) {
68 pm_runtime_resume(dev);
70 err = scsi_dev_type_suspend(dev, msg);
85 pm_runtime_get_sync(dev->
parent);
88 err = scsi_dev_type_resume(dev);
90 pm_runtime_disable(dev);
91 pm_runtime_set_active(dev);
95 pm_runtime_put_sync(dev->
parent);
130 #define scsi_bus_resume_common NULL
131 #define scsi_bus_prepare NULL
132 #define scsi_bus_suspend NULL
133 #define scsi_bus_freeze NULL
134 #define scsi_bus_poweroff NULL
138 #ifdef CONFIG_PM_RUNTIME
144 dev_dbg(dev,
"scsi_runtime_suspend\n");
161 dev_dbg(dev,
"scsi_runtime_resume\n");
163 err = scsi_dev_type_resume(dev);
174 dev_dbg(dev,
"scsi_runtime_idle\n");
181 err = pm_runtime_suspend(dev);
185 int scsi_autopm_get_device(
struct scsi_device *sdev)
189 err = pm_runtime_get_sync(&sdev->sdev_gendev);
190 if (err < 0 && err !=-
EACCES)
191 pm_runtime_put_sync(&sdev->sdev_gendev);
198 void scsi_autopm_put_device(
struct scsi_device *sdev)
200 pm_runtime_put_sync(&sdev->sdev_gendev);
204 void scsi_autopm_get_target(
struct scsi_target *starget)
206 pm_runtime_get_sync(&starget->
dev);
209 void scsi_autopm_put_target(
struct scsi_target *starget)
211 pm_runtime_put_sync(&starget->
dev);
218 err = pm_runtime_get_sync(&shost->shost_gendev);
219 if (err < 0 && err !=-
EACCES)
220 pm_runtime_put_sync(&shost->shost_gendev);
226 void scsi_autopm_put_host(
struct Scsi_Host *shost)
228 pm_runtime_put_sync(&shost->shost_gendev);
233 #define scsi_runtime_suspend NULL
234 #define scsi_runtime_resume NULL
235 #define scsi_runtime_idle NULL