===================================================================
@@ -595,6 +595,7 @@ static int ahci_pci_device_suspend(struc
struct ahci_host_priv *hpriv = host->private_data;
void __iomem *mmio = hpriv->mmio;
u32 ctl;
+ int rc = 0;
if (mesg.event & PM_EVENT_SUSPEND &&
hpriv->flags & AHCI_HFLAG_NO_SUSPEND) {
@@ -614,7 +615,15 @@ static int ahci_pci_device_suspend(struc
readl(mmio + HOST_CTL); /* flush */
}
- return ata_pci_device_suspend(pdev, mesg);
+ if (mesg.event == PM_EVENT_SUSPEND)
+ ata_fake_suspend(host);
+ else
+ rc = ata_host_suspend(host, mesg);
+
+ if (!rc)
+ ata_pci_device_do_suspend(pdev, mesg);
+
+ return rc;
}
static int ahci_pci_device_resume(struct pci_dev *pdev)
===================================================================
@@ -986,6 +986,7 @@ extern bool ata_link_online(struct ata_l
extern bool ata_link_offline(struct ata_link *link);
#ifdef CONFIG_PM
extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
+extern void ata_fake_suspend(struct ata_host *host);
extern void ata_host_resume(struct ata_host *host);
#endif
extern int ata_ratelimit(void);
===================================================================
@@ -5429,6 +5429,25 @@ int ata_host_suspend(struct ata_host *ho
return rc;
}
+void ata_fake_suspend(struct ata_host *host)
+{
+ unsigned long flags;
+ int i;
+
+ for (i = 0; i < host->n_ports; i++) {
+ struct ata_port *ap = host->ports[i];
+
+ spin_lock_irqsave(ap->lock, flags);
+
+ ap->pm_mesg = PMSG_SUSPEND;
+ ap->pflags |= ATA_PFLAG_SUSPENDED;
+
+ spin_unlock_irqrestore(ap->lock, flags);
+ }
+
+ host->dev->power.power_state = PMSG_SUSPEND;
+}
+
/**
* ata_host_resume - resume host
* @host: host to resume
@@ -6691,6 +6710,7 @@ EXPORT_SYMBOL_GPL(ata_link_online);
EXPORT_SYMBOL_GPL(ata_link_offline);
#ifdef CONFIG_PM
EXPORT_SYMBOL_GPL(ata_host_suspend);
+EXPORT_SYMBOL_GPL(ata_fake_suspend);
EXPORT_SYMBOL_GPL(ata_host_resume);
#endif /* CONFIG_PM */
EXPORT_SYMBOL_GPL(ata_id_string);