aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-05-04 15:27:47 -0400
committerJeff Garzik <jeff@garzik.org>2007-05-11 18:01:03 -0400
commit9666f4009c22f6520ac3fb8a19c9e32ab973e828 (patch)
treeeaac13cd5890af6298e5576a48c29891f0890bd1 /drivers/ata/libata-core.c
parent0a3fd051c7036ef71b58863f8e5da7c3dabd9d3f (diff)
libata: reimplement suspend/resume support using sdev->manage_start_stop
Reimplement suspend/resume support using sdev->manage_start_stop. * Device suspend/resume is now SCSI layer's responsibility and the code is simplified a lot. * DPM is dropped. This also simplifies code a lot. Suspend/resume status is port-wide now. * ata_scsi_device_suspend/resume() and ata_dev_ready() removed. * Resume now has to wait for disk to spin up before proceeding. I couldn't find easy way out as libata is in EH waiting for the disk to be ready and sd is waiting for EH to complete to issue START_STOP. * sdev->manage_start_stop is set to 1 in ata_scsi_slave_config(). This fixes spindown on shutdown and suspend-to-disk. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c39
1 files changed, 4 insertions, 35 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4595d1f8cf60..2e2a2fa8e9e9 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2860,7 +2860,7 @@ int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
2860 dev = &ap->device[i]; 2860 dev = &ap->device[i];
2861 2861
2862 /* don't update suspended devices' xfer mode */ 2862 /* don't update suspended devices' xfer mode */
2863 if (!ata_dev_ready(dev)) 2863 if (!ata_dev_enabled(dev))
2864 continue; 2864 continue;
2865 2865
2866 rc = ata_dev_set_mode(dev); 2866 rc = ata_dev_set_mode(dev);
@@ -5845,37 +5845,11 @@ static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg,
5845 */ 5845 */
5846int ata_host_suspend(struct ata_host *host, pm_message_t mesg) 5846int ata_host_suspend(struct ata_host *host, pm_message_t mesg)
5847{ 5847{
5848 int i, j, rc; 5848 int rc;
5849 5849
5850 rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); 5850 rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1);
5851 if (rc) 5851 if (rc == 0)
5852 goto fail; 5852 host->dev->power.power_state = mesg;
5853
5854 /* EH is quiescent now. Fail if we have any ready device.
5855 * This happens if hotplug occurs between completion of device
5856 * suspension and here.
5857 */
5858 for (i = 0; i < host->n_ports; i++) {
5859 struct ata_port *ap = host->ports[i];
5860
5861 for (j = 0; j < ATA_MAX_DEVICES; j++) {
5862 struct ata_device *dev = &ap->device[j];
5863
5864 if (ata_dev_ready(dev)) {
5865 ata_port_printk(ap, KERN_WARNING,
5866 "suspend failed, device %d "
5867 "still active\n", dev->devno);
5868 rc = -EBUSY;
5869 goto fail;
5870 }
5871 }
5872 }
5873
5874 host->dev->power.power_state = mesg;
5875 return 0;
5876
5877 fail:
5878 ata_host_resume(host);
5879 return rc; 5853 return rc;
5880} 5854}
5881 5855
@@ -6889,11 +6863,6 @@ EXPORT_SYMBOL_GPL(ata_pci_default_filter);
6889EXPORT_SYMBOL_GPL(ata_pci_clear_simplex); 6863EXPORT_SYMBOL_GPL(ata_pci_clear_simplex);
6890#endif /* CONFIG_PCI */ 6864#endif /* CONFIG_PCI */
6891 6865
6892#ifdef CONFIG_PM
6893EXPORT_SYMBOL_GPL(ata_scsi_device_suspend);
6894EXPORT_SYMBOL_GPL(ata_scsi_device_resume);
6895#endif /* CONFIG_PM */
6896
6897EXPORT_SYMBOL_GPL(ata_eng_timeout); 6866EXPORT_SYMBOL_GPL(ata_eng_timeout);
6898EXPORT_SYMBOL_GPL(ata_port_schedule_eh); 6867EXPORT_SYMBOL_GPL(ata_port_schedule_eh);
6899EXPORT_SYMBOL_GPL(ata_port_abort); 6868EXPORT_SYMBOL_GPL(ata_port_abort);