@@ -201,6 +201,13 @@ void scsi_autopm_put_device(struct scsi_device *sdev)
}
EXPORT_SYMBOL_GPL(scsi_autopm_put_device);
+void scsi_autopm_put_device_autosuspend(struct scsi_device *sdev)
+{
+ pm_runtime_mark_last_busy(&sdev->sdev_gendev);
+ pm_runtime_put_autosuspend(&sdev->sdev_gendev);
+}
+EXPORT_SYMBOL_GPL(scsi_autopm_put_device_autosuspend);
+
void scsi_autopm_get_target(struct scsi_target *starget)
{
pm_runtime_get_sync(&starget->dev);
@@ -395,9 +395,11 @@ extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
#ifdef CONFIG_PM_RUNTIME
extern int scsi_autopm_get_device(struct scsi_device *);
extern void scsi_autopm_put_device(struct scsi_device *);
+extern void scsi_autopm_put_device_autosuspend(struct scsi_device *);
#else
static inline int scsi_autopm_get_device(struct scsi_device *d) { return 0; }
static inline void scsi_autopm_put_device(struct scsi_device *d) {}
+static inline void scsi_autopm_put_device_autosuspend(struct scsi_device *d) {}
#endif /* CONFIG_PM_RUNTIME */
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
Add a new interface scsi_autopm_put_device_autosuspend to mark last busy for the device and then put autosuspend the device. Signed-off-by: Aaron Lu <aaron.lu@amd.com> --- drivers/scsi/scsi_pm.c | 7 +++++++ include/scsi/scsi_device.h | 2 ++ 2 files changed, 9 insertions(+)