From: Samuel Morris <samorris@xxxxxxxxxxx> If no devices are detected on boot, and hotplug is disabled, let the transport layer suspend automatically to save power automatically. Signed-off-by: Samuel Morris <samorris@xxxxxxxxxxx> --- drivers/ata/libata-scsi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 89a9d4a2efc8..0f28af19f463 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -51,6 +51,7 @@ #include <linux/suspend.h> #include <asm/unaligned.h> #include <linux/ioprio.h> +#include <linux/pm_runtime.h> #include "libata.h" #include "libata-transport.h" @@ -4568,6 +4569,7 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) void ata_scsi_scan_host(struct ata_port *ap, int sync) { int tries = 5; + int devAttached = 0; struct ata_device *last_failed_dev = NULL; struct ata_link *link; struct ata_device *dev; @@ -4591,12 +4593,18 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync) if (!IS_ERR(sdev)) { dev->sdev = sdev; scsi_device_put(sdev); + devAttached = 1; } else { dev->sdev = NULL; } } } +#ifdef CONFIG_AHCI_HOTPLUG_DISABLED + if (!devAttached) + pm_runtime_allow(&ap->tdev); +#endif + /* If we scanned while EH was in progress or allocation * failure occurred, scan would have failed silently. Check * whether all devices are attached. -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html