aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/ata/ahci.c4
-rw-r--r--drivers/ata/ata_generic.c6
-rw-r--r--drivers/ata/ata_piix.c4
-rw-r--r--drivers/ata/libata-core.c39
-rw-r--r--drivers/ata/libata-eh.c237
-rw-r--r--drivers/ata/libata-scsi.c129
-rw-r--r--drivers/ata/pata_ali.c4
-rw-r--r--drivers/ata/pata_amd.c4
-rw-r--r--drivers/ata/pata_atiixp.c4
-rw-r--r--drivers/ata/pata_cmd640.c4
-rw-r--r--drivers/ata/pata_cmd64x.c4
-rw-r--r--drivers/ata/pata_cs5520.c4
-rw-r--r--drivers/ata/pata_cs5530.c4
-rw-r--r--drivers/ata/pata_cs5535.c4
-rw-r--r--drivers/ata/pata_cypress.c4
-rw-r--r--drivers/ata/pata_efar.c4
-rw-r--r--drivers/ata/pata_hpt366.c4
-rw-r--r--drivers/ata/pata_hpt3x3.c4
-rw-r--r--drivers/ata/pata_it8213.c4
-rw-r--r--drivers/ata/pata_it821x.c4
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c2
-rw-r--r--drivers/ata/pata_jmicron.c4
-rw-r--r--drivers/ata/pata_marvell.c4
-rw-r--r--drivers/ata/pata_mpc52xx.c4
-rw-r--r--drivers/ata/pata_mpiix.c4
-rw-r--r--drivers/ata/pata_netcell.c4
-rw-r--r--drivers/ata/pata_ns87410.c4
-rw-r--r--drivers/ata/pata_oldpiix.c4
-rw-r--r--drivers/ata/pata_opti.c4
-rw-r--r--drivers/ata/pata_optidma.c4
-rw-r--r--drivers/ata/pata_pdc202xx_old.c4
-rw-r--r--drivers/ata/pata_radisys.c4
-rw-r--r--drivers/ata/pata_rz1000.c6
-rw-r--r--drivers/ata/pata_sc1200.c4
-rw-r--r--drivers/ata/pata_scc.c4
-rw-r--r--drivers/ata/pata_serverworks.c4
-rw-r--r--drivers/ata/pata_sil680.c4
-rw-r--r--drivers/ata/pata_sis.c4
-rw-r--r--drivers/ata/pata_triflex.c4
-rw-r--r--drivers/ata/pata_via.c4
-rw-r--r--drivers/ata/sata_inic162x.c4
-rw-r--r--drivers/ata/sata_nv.c8
-rw-r--r--drivers/ata/sata_sil.c4
-rw-r--r--drivers/ata/sata_sil24.c4
44 files changed, 13 insertions, 562 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index d9617892fc23..1ab8a8fdeaac 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -250,10 +250,6 @@ static struct scsi_host_template ahci_sht = {
250 .slave_configure = ata_scsi_slave_config, 250 .slave_configure = ata_scsi_slave_config,
251 .slave_destroy = ata_scsi_slave_destroy, 251 .slave_destroy = ata_scsi_slave_destroy,
252 .bios_param = ata_std_bios_param, 252 .bios_param = ata_std_bios_param,
253#ifdef CONFIG_PM
254 .suspend = ata_scsi_device_suspend,
255 .resume = ata_scsi_device_resume,
256#endif
257}; 253};
258 254
259static const struct ata_port_operations ahci_ops = { 255static const struct ata_port_operations ahci_ops = {
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 92a491ddd030..0f19e3223358 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -54,7 +54,7 @@ static int generic_set_mode(struct ata_port *ap, struct ata_device **unused)
54 54
55 for (i = 0; i < ATA_MAX_DEVICES; i++) { 55 for (i = 0; i < ATA_MAX_DEVICES; i++) {
56 struct ata_device *dev = &ap->device[i]; 56 struct ata_device *dev = &ap->device[i];
57 if (ata_dev_ready(dev)) { 57 if (ata_dev_enabled(dev)) {
58 /* We don't really care */ 58 /* We don't really care */
59 dev->pio_mode = XFER_PIO_0; 59 dev->pio_mode = XFER_PIO_0;
60 dev->dma_mode = XFER_MW_DMA_0; 60 dev->dma_mode = XFER_MW_DMA_0;
@@ -90,10 +90,6 @@ static struct scsi_host_template generic_sht = {
90 .slave_configure = ata_scsi_slave_config, 90 .slave_configure = ata_scsi_slave_config,
91 .slave_destroy = ata_scsi_slave_destroy, 91 .slave_destroy = ata_scsi_slave_destroy,
92 .bios_param = ata_std_bios_param, 92 .bios_param = ata_std_bios_param,
93#ifdef CONFIG_PM
94 .resume = ata_scsi_device_resume,
95 .suspend = ata_scsi_device_suspend,
96#endif
97}; 93};
98 94
99static struct ata_port_operations generic_port_ops = { 95static struct ata_port_operations generic_port_ops = {
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 4a795fdb6a02..4f5a0dc7fb9c 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -275,10 +275,6 @@ static struct scsi_host_template piix_sht = {
275 .slave_configure = ata_scsi_slave_config, 275 .slave_configure = ata_scsi_slave_config,
276 .slave_destroy = ata_scsi_slave_destroy, 276 .slave_destroy = ata_scsi_slave_destroy,
277 .bios_param = ata_std_bios_param, 277 .bios_param = ata_std_bios_param,
278#ifdef CONFIG_PM
279 .resume = ata_scsi_device_resume,
280 .suspend = ata_scsi_device_suspend,
281#endif
282}; 278};
283 279
284static const struct ata_port_operations piix_pata_ops = { 280static const struct ata_port_operations piix_pata_ops = {
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);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 8256655ce7d9..412d6049afa3 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -77,29 +77,12 @@ static void ata_eh_finish(struct ata_port *ap);
77#ifdef CONFIG_PM 77#ifdef CONFIG_PM
78static void ata_eh_handle_port_suspend(struct ata_port *ap); 78static void ata_eh_handle_port_suspend(struct ata_port *ap);
79static void ata_eh_handle_port_resume(struct ata_port *ap); 79static void ata_eh_handle_port_resume(struct ata_port *ap);
80static int ata_eh_suspend(struct ata_port *ap,
81 struct ata_device **r_failed_dev);
82static void ata_eh_prep_resume(struct ata_port *ap);
83static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev);
84#else /* CONFIG_PM */ 80#else /* CONFIG_PM */
85static void ata_eh_handle_port_suspend(struct ata_port *ap) 81static void ata_eh_handle_port_suspend(struct ata_port *ap)
86{ } 82{ }
87 83
88static void ata_eh_handle_port_resume(struct ata_port *ap) 84static void ata_eh_handle_port_resume(struct ata_port *ap)
89{ } 85{ }
90
91static int ata_eh_suspend(struct ata_port *ap, struct ata_device **r_failed_dev)
92{
93 return 0;
94}
95
96static void ata_eh_prep_resume(struct ata_port *ap)
97{ }
98
99static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev)
100{
101 return 0;
102}
103#endif /* CONFIG_PM */ 86#endif /* CONFIG_PM */
104 87
105static void ata_ering_record(struct ata_ering *ering, int is_io, 88static void ata_ering_record(struct ata_ering *ering, int is_io,
@@ -1791,7 +1774,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1791 if (ehc->i.flags & ATA_EHI_DID_RESET) 1774 if (ehc->i.flags & ATA_EHI_DID_RESET)
1792 readid_flags |= ATA_READID_POSTRESET; 1775 readid_flags |= ATA_READID_POSTRESET;
1793 1776
1794 if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) { 1777 if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) {
1795 if (ata_port_offline(ap)) { 1778 if (ata_port_offline(ap)) {
1796 rc = -EIO; 1779 rc = -EIO;
1797 goto err; 1780 goto err;
@@ -1872,166 +1855,6 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1872 return rc; 1855 return rc;
1873} 1856}
1874 1857
1875#ifdef CONFIG_PM
1876/**
1877 * ata_eh_suspend - handle suspend EH action
1878 * @ap: target host port
1879 * @r_failed_dev: result parameter to indicate failing device
1880 *
1881 * Handle suspend EH action. Disk devices are spinned down and
1882 * other types of devices are just marked suspended. Once
1883 * suspended, no EH action to the device is allowed until it is
1884 * resumed.
1885 *
1886 * LOCKING:
1887 * Kernel thread context (may sleep).
1888 *
1889 * RETURNS:
1890 * 0 on success, -errno otherwise
1891 */
1892static int ata_eh_suspend(struct ata_port *ap, struct ata_device **r_failed_dev)
1893{
1894 struct ata_device *dev;
1895 int i, rc = 0;
1896
1897 DPRINTK("ENTER\n");
1898
1899 for (i = 0; i < ATA_MAX_DEVICES; i++) {
1900 unsigned long flags;
1901 unsigned int action, err_mask;
1902
1903 dev = &ap->device[i];
1904 action = ata_eh_dev_action(dev);
1905
1906 if (!ata_dev_enabled(dev) || !(action & ATA_EH_SUSPEND))
1907 continue;
1908
1909 WARN_ON(dev->flags & ATA_DFLAG_SUSPENDED);
1910
1911 ata_eh_about_to_do(ap, dev, ATA_EH_SUSPEND);
1912
1913 if (dev->class == ATA_DEV_ATA && !(action & ATA_EH_PM_FREEZE)) {
1914 /* flush cache */
1915 rc = ata_flush_cache(dev);
1916 if (rc)
1917 break;
1918
1919 /* spin down */
1920 err_mask = ata_do_simple_cmd(dev, ATA_CMD_STANDBYNOW1);
1921 if (err_mask) {
1922 ata_dev_printk(dev, KERN_ERR, "failed to "
1923 "spin down (err_mask=0x%x)\n",
1924 err_mask);
1925 rc = -EIO;
1926 break;
1927 }
1928 }
1929
1930 spin_lock_irqsave(ap->lock, flags);
1931 dev->flags |= ATA_DFLAG_SUSPENDED;
1932 spin_unlock_irqrestore(ap->lock, flags);
1933
1934 ata_eh_done(ap, dev, ATA_EH_SUSPEND);
1935 }
1936
1937 if (rc)
1938 *r_failed_dev = dev;
1939
1940 DPRINTK("EXIT\n");
1941 return rc;
1942}
1943
1944/**
1945 * ata_eh_prep_resume - prep for resume EH action
1946 * @ap: target host port
1947 *
1948 * Clear SUSPENDED in preparation for scheduled resume actions.
1949 * This allows other parts of EH to access the devices being
1950 * resumed.
1951 *
1952 * LOCKING:
1953 * Kernel thread context (may sleep).
1954 */
1955static void ata_eh_prep_resume(struct ata_port *ap)
1956{
1957 struct ata_device *dev;
1958 unsigned long flags;
1959 int i;
1960
1961 DPRINTK("ENTER\n");
1962
1963 for (i = 0; i < ATA_MAX_DEVICES; i++) {
1964 unsigned int action;
1965
1966 dev = &ap->device[i];
1967 action = ata_eh_dev_action(dev);
1968
1969 if (!ata_dev_enabled(dev) || !(action & ATA_EH_RESUME))
1970 continue;
1971
1972 spin_lock_irqsave(ap->lock, flags);
1973 dev->flags &= ~ATA_DFLAG_SUSPENDED;
1974 spin_unlock_irqrestore(ap->lock, flags);
1975 }
1976
1977 DPRINTK("EXIT\n");
1978}
1979
1980/**
1981 * ata_eh_resume - handle resume EH action
1982 * @ap: target host port
1983 * @r_failed_dev: result parameter to indicate failing device
1984 *
1985 * Handle resume EH action. Target devices are already reset and
1986 * revalidated. Spinning up is the only operation left.
1987 *
1988 * LOCKING:
1989 * Kernel thread context (may sleep).
1990 *
1991 * RETURNS:
1992 * 0 on success, -errno otherwise
1993 */
1994static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev)
1995{
1996 struct ata_device *dev;
1997 int i, rc = 0;
1998
1999 DPRINTK("ENTER\n");
2000
2001 for (i = 0; i < ATA_MAX_DEVICES; i++) {
2002 unsigned int action, err_mask;
2003
2004 dev = &ap->device[i];
2005 action = ata_eh_dev_action(dev);
2006
2007 if (!ata_dev_enabled(dev) || !(action & ATA_EH_RESUME))
2008 continue;
2009
2010 ata_eh_about_to_do(ap, dev, ATA_EH_RESUME);
2011
2012 if (dev->class == ATA_DEV_ATA && !(action & ATA_EH_PM_FREEZE)) {
2013 err_mask = ata_do_simple_cmd(dev,
2014 ATA_CMD_IDLEIMMEDIATE);
2015 if (err_mask) {
2016 ata_dev_printk(dev, KERN_ERR, "failed to "
2017 "spin up (err_mask=0x%x)\n",
2018 err_mask);
2019 rc = -EIO;
2020 break;
2021 }
2022 }
2023
2024 ata_eh_done(ap, dev, ATA_EH_RESUME);
2025 }
2026
2027 if (rc)
2028 *r_failed_dev = dev;
2029
2030 DPRINTK("EXIT\n");
2031 return 0;
2032}
2033#endif /* CONFIG_PM */
2034
2035static int ata_port_nr_enabled(struct ata_port *ap) 1858static int ata_port_nr_enabled(struct ata_port *ap)
2036{ 1859{
2037 int i, cnt = 0; 1860 int i, cnt = 0;
@@ -2057,17 +1880,6 @@ static int ata_eh_skip_recovery(struct ata_port *ap)
2057 struct ata_eh_context *ehc = &ap->eh_context; 1880 struct ata_eh_context *ehc = &ap->eh_context;
2058 int i; 1881 int i;
2059 1882
2060 /* skip if all possible devices are suspended */
2061 for (i = 0; i < ata_port_max_devices(ap); i++) {
2062 struct ata_device *dev = &ap->device[i];
2063
2064 if (!(dev->flags & ATA_DFLAG_SUSPENDED))
2065 break;
2066 }
2067
2068 if (i == ata_port_max_devices(ap))
2069 return 1;
2070
2071 /* thaw frozen port, resume link and recover failed devices */ 1883 /* thaw frozen port, resume link and recover failed devices */
2072 if ((ap->pflags & ATA_PFLAG_FROZEN) || 1884 if ((ap->pflags & ATA_PFLAG_FROZEN) ||
2073 (ehc->i.flags & ATA_EHI_RESUME_LINK) || ata_port_nr_enabled(ap)) 1885 (ehc->i.flags & ATA_EHI_RESUME_LINK) || ata_port_nr_enabled(ap))
@@ -2147,9 +1959,6 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2147 if (ap->pflags & ATA_PFLAG_UNLOADING) 1959 if (ap->pflags & ATA_PFLAG_UNLOADING)
2148 goto out; 1960 goto out;
2149 1961
2150 /* prep for resume */
2151 ata_eh_prep_resume(ap);
2152
2153 /* skip EH if possible. */ 1962 /* skip EH if possible. */
2154 if (ata_eh_skip_recovery(ap)) 1963 if (ata_eh_skip_recovery(ap))
2155 ehc->i.action = 0; 1964 ehc->i.action = 0;
@@ -2177,11 +1986,6 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2177 if (rc) 1986 if (rc)
2178 goto dev_fail; 1987 goto dev_fail;
2179 1988
2180 /* resume devices */
2181 rc = ata_eh_resume(ap, &dev);
2182 if (rc)
2183 goto dev_fail;
2184
2185 /* configure transfer mode if necessary */ 1989 /* configure transfer mode if necessary */
2186 if (ehc->i.flags & ATA_EHI_SETMODE) { 1990 if (ehc->i.flags & ATA_EHI_SETMODE) {
2187 rc = ata_set_mode(ap, &dev); 1991 rc = ata_set_mode(ap, &dev);
@@ -2190,11 +1994,6 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2190 ehc->i.flags &= ~ATA_EHI_SETMODE; 1994 ehc->i.flags &= ~ATA_EHI_SETMODE;
2191 } 1995 }
2192 1996
2193 /* suspend devices */
2194 rc = ata_eh_suspend(ap, &dev);
2195 if (rc)
2196 goto dev_fail;
2197
2198 goto out; 1997 goto out;
2199 1998
2200 dev_fail: 1999 dev_fail:
@@ -2390,22 +2189,13 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
2390 * 2189 *
2391 * Resume @ap. 2190 * Resume @ap.
2392 * 2191 *
2393 * This function also waits upto one second until all devices
2394 * hanging off this port requests resume EH action. This is to
2395 * prevent invoking EH and thus reset multiple times on resume.
2396 *
2397 * On DPM resume, where some of devices might not be resumed
2398 * together, this may delay port resume upto one second, but such
2399 * DPM resumes are rare and 1 sec delay isn't too bad.
2400 *
2401 * LOCKING: 2192 * LOCKING:
2402 * Kernel thread context (may sleep). 2193 * Kernel thread context (may sleep).
2403 */ 2194 */
2404static void ata_eh_handle_port_resume(struct ata_port *ap) 2195static void ata_eh_handle_port_resume(struct ata_port *ap)
2405{ 2196{
2406 unsigned long timeout;
2407 unsigned long flags; 2197 unsigned long flags;
2408 int i, rc = 0; 2198 int rc = 0;
2409 2199
2410 /* are we resuming? */ 2200 /* are we resuming? */
2411 spin_lock_irqsave(ap->lock, flags); 2201 spin_lock_irqsave(ap->lock, flags);
@@ -2416,31 +2206,12 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
2416 } 2206 }
2417 spin_unlock_irqrestore(ap->lock, flags); 2207 spin_unlock_irqrestore(ap->lock, flags);
2418 2208
2419 /* spurious? */ 2209 WARN_ON(!(ap->pflags & ATA_PFLAG_SUSPENDED));
2420 if (!(ap->pflags & ATA_PFLAG_SUSPENDED))
2421 goto done;
2422 2210
2423 if (ap->ops->port_resume) 2211 if (ap->ops->port_resume)
2424 rc = ap->ops->port_resume(ap); 2212 rc = ap->ops->port_resume(ap);
2425 2213
2426 /* give devices time to request EH */ 2214 /* report result */
2427 timeout = jiffies + HZ; /* 1s max */
2428 while (1) {
2429 for (i = 0; i < ATA_MAX_DEVICES; i++) {
2430 struct ata_device *dev = &ap->device[i];
2431 unsigned int action = ata_eh_dev_action(dev);
2432
2433 if ((dev->flags & ATA_DFLAG_SUSPENDED) &&
2434 !(action & ATA_EH_RESUME))
2435 break;
2436 }
2437
2438 if (i == ATA_MAX_DEVICES || time_after(jiffies, timeout))
2439 break;
2440 msleep(10);
2441 }
2442
2443 done:
2444 spin_lock_irqsave(ap->lock, flags); 2215 spin_lock_irqsave(ap->lock, flags);
2445 ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED); 2216 ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED);
2446 if (ap->pm_result) { 2217 if (ap->pm_result) {
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 9afba2ba489e..8f800196d596 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -510,133 +510,6 @@ static void ata_dump_status(unsigned id, struct ata_taskfile *tf)
510 } 510 }
511} 511}
512 512
513#ifdef CONFIG_PM
514/**
515 * ata_scsi_device_suspend - suspend ATA device associated with sdev
516 * @sdev: the SCSI device to suspend
517 * @mesg: target power management message
518 *
519 * Request suspend EH action on the ATA device associated with
520 * @sdev and wait for the operation to complete.
521 *
522 * LOCKING:
523 * Kernel thread context (may sleep).
524 *
525 * RETURNS:
526 * 0 on success, -errno otherwise.
527 */
528int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t mesg)
529{
530 struct ata_port *ap = ata_shost_to_port(sdev->host);
531 struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
532 unsigned long flags;
533 unsigned int action;
534 int rc = 0;
535
536 if (!dev)
537 goto out;
538
539 spin_lock_irqsave(ap->lock, flags);
540
541 /* wait for the previous resume to complete */
542 while (dev->flags & ATA_DFLAG_SUSPENDED) {
543 spin_unlock_irqrestore(ap->lock, flags);
544 ata_port_wait_eh(ap);
545 spin_lock_irqsave(ap->lock, flags);
546 }
547
548 /* if @sdev is already detached, nothing to do */
549 if (sdev->sdev_state == SDEV_OFFLINE ||
550 sdev->sdev_state == SDEV_CANCEL || sdev->sdev_state == SDEV_DEL)
551 goto out_unlock;
552
553 /* request suspend */
554 action = ATA_EH_SUSPEND;
555 if (mesg.event != PM_EVENT_SUSPEND)
556 action |= ATA_EH_PM_FREEZE;
557 ap->eh_info.dev_action[dev->devno] |= action;
558 ap->eh_info.flags |= ATA_EHI_QUIET;
559 ata_port_schedule_eh(ap);
560
561 spin_unlock_irqrestore(ap->lock, flags);
562
563 /* wait for EH to do the job */
564 ata_port_wait_eh(ap);
565
566 spin_lock_irqsave(ap->lock, flags);
567
568 /* If @sdev is still attached but the associated ATA device
569 * isn't suspended, the operation failed.
570 */
571 if (sdev->sdev_state != SDEV_OFFLINE &&
572 sdev->sdev_state != SDEV_CANCEL && sdev->sdev_state != SDEV_DEL &&
573 !(dev->flags & ATA_DFLAG_SUSPENDED))
574 rc = -EIO;
575
576 out_unlock:
577 spin_unlock_irqrestore(ap->lock, flags);
578 out:
579 if (rc == 0)
580 sdev->sdev_gendev.power.power_state = mesg;
581 return rc;
582}
583
584/**
585 * ata_scsi_device_resume - resume ATA device associated with sdev
586 * @sdev: the SCSI device to resume
587 *
588 * Request resume EH action on the ATA device associated with
589 * @sdev and return immediately. This enables parallel
590 * wakeup/spinup of devices.
591 *
592 * LOCKING:
593 * Kernel thread context (may sleep).
594 *
595 * RETURNS:
596 * 0.
597 */
598int ata_scsi_device_resume(struct scsi_device *sdev)
599{
600 struct ata_port *ap = ata_shost_to_port(sdev->host);
601 struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
602 struct ata_eh_info *ehi = &ap->eh_info;
603 unsigned long flags;
604 unsigned int action;
605
606 if (!dev)
607 goto out;
608
609 spin_lock_irqsave(ap->lock, flags);
610
611 /* if @sdev is already detached, nothing to do */
612 if (sdev->sdev_state == SDEV_OFFLINE ||
613 sdev->sdev_state == SDEV_CANCEL || sdev->sdev_state == SDEV_DEL)
614 goto out_unlock;
615
616 /* request resume */
617 action = ATA_EH_RESUME;
618 if (sdev->sdev_gendev.power.power_state.event == PM_EVENT_SUSPEND)
619 __ata_ehi_hotplugged(ehi);
620 else
621 action |= ATA_EH_PM_FREEZE | ATA_EH_SOFTRESET;
622 ehi->dev_action[dev->devno] |= action;
623
624 /* We don't want autopsy and verbose EH messages. Disable
625 * those if we're the only device on this link.
626 */
627 if (ata_port_max_devices(ap) == 1)
628 ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET;
629
630 ata_port_schedule_eh(ap);
631
632 out_unlock:
633 spin_unlock_irqrestore(ap->lock, flags);
634 out:
635 sdev->sdev_gendev.power.power_state = PMSG_ON;
636 return 0;
637}
638#endif /* CONFIG_PM */
639
640/** 513/**
641 * ata_to_sense_error - convert ATA error to SCSI error 514 * ata_to_sense_error - convert ATA error to SCSI error
642 * @id: ATA device number 515 * @id: ATA device number
@@ -929,6 +802,8 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
929 802
930 blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD); 803 blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD);
931 804
805 sdev->manage_start_stop = 1;
806
932 if (dev) 807 if (dev)
933 ata_scsi_dev_config(sdev, dev); 808 ata_scsi_dev_config(sdev, dev);
934 809
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index d40edebb510a..48c7531ae690 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -291,10 +291,6 @@ static struct scsi_host_template ali_sht = {
291 .slave_configure = ata_scsi_slave_config, 291 .slave_configure = ata_scsi_slave_config,
292 .slave_destroy = ata_scsi_slave_destroy, 292 .slave_destroy = ata_scsi_slave_destroy,
293 .bios_param = ata_std_bios_param, 293 .bios_param = ata_std_bios_param,
294#ifdef CONFIG_PM
295 .resume = ata_scsi_device_resume,
296 .suspend = ata_scsi_device_suspend,
297#endif
298}; 294};
299 295
300/* 296/*
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 67c7e87dec04..86a26186739c 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -324,10 +324,6 @@ static struct scsi_host_template amd_sht = {
324 .slave_configure = ata_scsi_slave_config, 324 .slave_configure = ata_scsi_slave_config,
325 .slave_destroy = ata_scsi_slave_destroy, 325 .slave_destroy = ata_scsi_slave_destroy,
326 .bios_param = ata_std_bios_param, 326 .bios_param = ata_std_bios_param,
327#ifdef CONFIG_PM
328 .resume = ata_scsi_device_resume,
329 .suspend = ata_scsi_device_suspend,
330#endif
331}; 327};
332 328
333static struct ata_port_operations amd33_port_ops = { 329static struct ata_port_operations amd33_port_ops = {
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index 21515381b5b3..3c2264dbdd67 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -229,10 +229,6 @@ static struct scsi_host_template atiixp_sht = {
229 .slave_configure = ata_scsi_slave_config, 229 .slave_configure = ata_scsi_slave_config,
230 .slave_destroy = ata_scsi_slave_destroy, 230 .slave_destroy = ata_scsi_slave_destroy,
231 .bios_param = ata_std_bios_param, 231 .bios_param = ata_std_bios_param,
232#ifdef CONFIG_PM
233 .resume = ata_scsi_device_resume,
234 .suspend = ata_scsi_device_suspend,
235#endif
236}; 232};
237 233
238static struct ata_port_operations atiixp_port_ops = { 234static struct ata_port_operations atiixp_port_ops = {
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
index 2105985a8013..987dec935b5c 100644
--- a/drivers/ata/pata_cmd640.c
+++ b/drivers/ata/pata_cmd640.c
@@ -181,10 +181,6 @@ static struct scsi_host_template cmd640_sht = {
181 .slave_configure = ata_scsi_slave_config, 181 .slave_configure = ata_scsi_slave_config,
182 .slave_destroy = ata_scsi_slave_destroy, 182 .slave_destroy = ata_scsi_slave_destroy,
183 .bios_param = ata_std_bios_param, 183 .bios_param = ata_std_bios_param,
184#ifdef CONFIG_PM
185 .resume = ata_scsi_device_resume,
186 .suspend = ata_scsi_device_suspend,
187#endif
188}; 184};
189 185
190static struct ata_port_operations cmd640_port_ops = { 186static struct ata_port_operations cmd640_port_ops = {
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index 3989cc577fcd..3e02c6a3ba9c 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -266,10 +266,6 @@ static struct scsi_host_template cmd64x_sht = {
266 .slave_configure = ata_scsi_slave_config, 266 .slave_configure = ata_scsi_slave_config,
267 .slave_destroy = ata_scsi_slave_destroy, 267 .slave_destroy = ata_scsi_slave_destroy,
268 .bios_param = ata_std_bios_param, 268 .bios_param = ata_std_bios_param,
269#ifdef CONFIG_PM
270 .resume = ata_scsi_device_resume,
271 .suspend = ata_scsi_device_suspend,
272#endif
273}; 269};
274 270
275static struct ata_port_operations cmd64x_port_ops = { 271static struct ata_port_operations cmd64x_port_ops = {
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index 79bef0d1fad3..83bcc5b32597 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -155,10 +155,6 @@ static struct scsi_host_template cs5520_sht = {
155 .slave_configure = ata_scsi_slave_config, 155 .slave_configure = ata_scsi_slave_config,
156 .slave_destroy = ata_scsi_slave_destroy, 156 .slave_destroy = ata_scsi_slave_destroy,
157 .bios_param = ata_std_bios_param, 157 .bios_param = ata_std_bios_param,
158#ifdef CONFIG_PM
159 .resume = ata_scsi_device_resume,
160 .suspend = ata_scsi_device_suspend,
161#endif
162}; 158};
163 159
164static struct ata_port_operations cs5520_port_ops = { 160static struct ata_port_operations cs5520_port_ops = {
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 29642d5ee189..637d8b302e3e 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -176,10 +176,6 @@ static struct scsi_host_template cs5530_sht = {
176 .slave_configure = ata_scsi_slave_config, 176 .slave_configure = ata_scsi_slave_config,
177 .slave_destroy = ata_scsi_slave_destroy, 177 .slave_destroy = ata_scsi_slave_destroy,
178 .bios_param = ata_std_bios_param, 178 .bios_param = ata_std_bios_param,
179#ifdef CONFIG_PM
180 .resume = ata_scsi_device_resume,
181 .suspend = ata_scsi_device_suspend,
182#endif
183}; 179};
184 180
185static struct ata_port_operations cs5530_port_ops = { 181static struct ata_port_operations cs5530_port_ops = {
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c
index 22006ae71941..683885a47b6d 100644
--- a/drivers/ata/pata_cs5535.c
+++ b/drivers/ata/pata_cs5535.c
@@ -173,10 +173,6 @@ static struct scsi_host_template cs5535_sht = {
173 .slave_configure = ata_scsi_slave_config, 173 .slave_configure = ata_scsi_slave_config,
174 .slave_destroy = ata_scsi_slave_destroy, 174 .slave_destroy = ata_scsi_slave_destroy,
175 .bios_param = ata_std_bios_param, 175 .bios_param = ata_std_bios_param,
176#ifdef CONFIG_PM
177 .resume = ata_scsi_device_resume,
178 .suspend = ata_scsi_device_suspend,
179#endif
180}; 176};
181 177
182static struct ata_port_operations cs5535_port_ops = { 178static struct ata_port_operations cs5535_port_ops = {
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c
index 6ec049c3b1dc..30e5c543bcb0 100644
--- a/drivers/ata/pata_cypress.c
+++ b/drivers/ata/pata_cypress.c
@@ -125,10 +125,6 @@ static struct scsi_host_template cy82c693_sht = {
125 .slave_configure = ata_scsi_slave_config, 125 .slave_configure = ata_scsi_slave_config,
126 .slave_destroy = ata_scsi_slave_destroy, 126 .slave_destroy = ata_scsi_slave_destroy,
127 .bios_param = ata_std_bios_param, 127 .bios_param = ata_std_bios_param,
128#ifdef CONFIG_PM
129 .resume = ata_scsi_device_resume,
130 .suspend = ata_scsi_device_suspend,
131#endif
132}; 128};
133 129
134static struct ata_port_operations cy82c693_port_ops = { 130static struct ata_port_operations cy82c693_port_ops = {
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c
index d0f52e034906..23e929f0cd3f 100644
--- a/drivers/ata/pata_efar.c
+++ b/drivers/ata/pata_efar.c
@@ -247,10 +247,6 @@ static struct scsi_host_template efar_sht = {
247 .slave_configure = ata_scsi_slave_config, 247 .slave_configure = ata_scsi_slave_config,
248 .slave_destroy = ata_scsi_slave_destroy, 248 .slave_destroy = ata_scsi_slave_destroy,
249 .bios_param = ata_std_bios_param, 249 .bios_param = ata_std_bios_param,
250#ifdef CONFIG_PM
251 .resume = ata_scsi_device_resume,
252 .suspend = ata_scsi_device_suspend,
253#endif
254}; 250};
255 251
256static const struct ata_port_operations efar_ops = { 252static const struct ata_port_operations efar_ops = {
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index e64e05e5c7fe..cb965f41d093 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -331,10 +331,6 @@ static struct scsi_host_template hpt36x_sht = {
331 .slave_configure = ata_scsi_slave_config, 331 .slave_configure = ata_scsi_slave_config,
332 .slave_destroy = ata_scsi_slave_destroy, 332 .slave_destroy = ata_scsi_slave_destroy,
333 .bios_param = ata_std_bios_param, 333 .bios_param = ata_std_bios_param,
334#ifdef CONFIG_PM
335 .resume = ata_scsi_device_resume,
336 .suspend = ata_scsi_device_suspend,
337#endif
338}; 334};
339 335
340/* 336/*
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c
index ac28ec8c50aa..84c636b9beac 100644
--- a/drivers/ata/pata_hpt3x3.c
+++ b/drivers/ata/pata_hpt3x3.c
@@ -100,10 +100,6 @@ static struct scsi_host_template hpt3x3_sht = {
100 .slave_configure = ata_scsi_slave_config, 100 .slave_configure = ata_scsi_slave_config,
101 .slave_destroy = ata_scsi_slave_destroy, 101 .slave_destroy = ata_scsi_slave_destroy,
102 .bios_param = ata_std_bios_param, 102 .bios_param = ata_std_bios_param,
103#ifdef CONFIG_PM
104 .resume = ata_scsi_device_resume,
105 .suspend = ata_scsi_device_suspend,
106#endif
107}; 103};
108 104
109static struct ata_port_operations hpt3x3_port_ops = { 105static struct ata_port_operations hpt3x3_port_ops = {
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c
index 17bf9f3ed013..bf3aaa205edc 100644
--- a/drivers/ata/pata_it8213.c
+++ b/drivers/ata/pata_it8213.c
@@ -257,10 +257,6 @@ static struct scsi_host_template it8213_sht = {
257 .dma_boundary = ATA_DMA_BOUNDARY, 257 .dma_boundary = ATA_DMA_BOUNDARY,
258 .slave_configure = ata_scsi_slave_config, 258 .slave_configure = ata_scsi_slave_config,
259 .bios_param = ata_std_bios_param, 259 .bios_param = ata_std_bios_param,
260#ifdef CONFIG_PM
261 .resume = ata_scsi_device_resume,
262 .suspend = ata_scsi_device_suspend,
263#endif
264}; 260};
265 261
266static const struct ata_port_operations it8213_ops = { 262static const struct ata_port_operations it8213_ops = {
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index f1f8cec8c224..8e565a5f2c8d 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -620,10 +620,6 @@ static struct scsi_host_template it821x_sht = {
620 .slave_configure = ata_scsi_slave_config, 620 .slave_configure = ata_scsi_slave_config,
621 .slave_destroy = ata_scsi_slave_destroy, 621 .slave_destroy = ata_scsi_slave_destroy,
622 .bios_param = ata_std_bios_param, 622 .bios_param = ata_std_bios_param,
623#ifdef CONFIG_PM
624 .resume = ata_scsi_device_resume,
625 .suspend = ata_scsi_device_suspend,
626#endif
627}; 623};
628 624
629static struct ata_port_operations it821x_smart_port_ops = { 625static struct ata_port_operations it821x_smart_port_ops = {
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index 420c343e5711..b994351fbcd0 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -31,7 +31,7 @@ static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error)
31 31
32 for (i = 0; i < ATA_MAX_DEVICES; i++) { 32 for (i = 0; i < ATA_MAX_DEVICES; i++) {
33 struct ata_device *dev = &ap->device[i]; 33 struct ata_device *dev = &ap->device[i];
34 if (ata_dev_ready(dev)) { 34 if (ata_dev_enabled(dev)) {
35 ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); 35 ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n");
36 dev->pio_mode = XFER_PIO_0; 36 dev->pio_mode = XFER_PIO_0;
37 dev->xfer_mode = XFER_PIO_0; 37 dev->xfer_mode = XFER_PIO_0;
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 1daf78ac6efb..1aa7bc2fda54 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -138,10 +138,6 @@ static struct scsi_host_template jmicron_sht = {
138 .slave_destroy = ata_scsi_slave_destroy, 138 .slave_destroy = ata_scsi_slave_destroy,
139 /* Use standard CHS mapping rules */ 139 /* Use standard CHS mapping rules */
140 .bios_param = ata_std_bios_param, 140 .bios_param = ata_std_bios_param,
141#ifdef CONFIG_PM
142 .suspend = ata_scsi_device_suspend,
143 .resume = ata_scsi_device_resume,
144#endif
145}; 141};
146 142
147static const struct ata_port_operations jmicron_ops = { 143static const struct ata_port_operations jmicron_ops = {
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 837b7fe77dc7..2745e23cac43 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -107,10 +107,6 @@ static struct scsi_host_template marvell_sht = {
107 .slave_destroy = ata_scsi_slave_destroy, 107 .slave_destroy = ata_scsi_slave_destroy,
108 /* Use standard CHS mapping rules */ 108 /* Use standard CHS mapping rules */
109 .bios_param = ata_std_bios_param, 109 .bios_param = ata_std_bios_param,
110#ifdef CONFIG_PM
111 .resume = ata_scsi_device_resume,
112 .suspend = ata_scsi_device_suspend,
113#endif
114}; 110};
115 111
116static const struct ata_port_operations marvell_ops = { 112static const struct ata_port_operations marvell_ops = {
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index 9587a89f9683..368fac7d168b 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -280,10 +280,6 @@ static struct scsi_host_template mpc52xx_ata_sht = {
280 .dma_boundary = ATA_DMA_BOUNDARY, 280 .dma_boundary = ATA_DMA_BOUNDARY,
281 .slave_configure = ata_scsi_slave_config, 281 .slave_configure = ata_scsi_slave_config,
282 .bios_param = ata_std_bios_param, 282 .bios_param = ata_std_bios_param,
283#ifdef CONFIG_PM
284 .suspend = ata_scsi_device_suspend,
285 .resume = ata_scsi_device_resume,
286#endif
287}; 283};
288 284
289static struct ata_port_operations mpc52xx_ata_port_ops = { 285static struct ata_port_operations mpc52xx_ata_port_ops = {
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index 3bfbd495f643..4ea42838297e 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -165,10 +165,6 @@ static struct scsi_host_template mpiix_sht = {
165 .slave_configure = ata_scsi_slave_config, 165 .slave_configure = ata_scsi_slave_config,
166 .slave_destroy = ata_scsi_slave_destroy, 166 .slave_destroy = ata_scsi_slave_destroy,
167 .bios_param = ata_std_bios_param, 167 .bios_param = ata_std_bios_param,
168#ifdef CONFIG_PM
169 .resume = ata_scsi_device_resume,
170 .suspend = ata_scsi_device_suspend,
171#endif
172}; 168};
173 169
174static struct ata_port_operations mpiix_port_ops = { 170static struct ata_port_operations mpiix_port_ops = {
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c
index dbba5b77d79c..f15eb34fb1fc 100644
--- a/drivers/ata/pata_netcell.c
+++ b/drivers/ata/pata_netcell.c
@@ -37,10 +37,6 @@ static struct scsi_host_template netcell_sht = {
37 .slave_destroy = ata_scsi_slave_destroy, 37 .slave_destroy = ata_scsi_slave_destroy,
38 /* Use standard CHS mapping rules */ 38 /* Use standard CHS mapping rules */
39 .bios_param = ata_std_bios_param, 39 .bios_param = ata_std_bios_param,
40#ifdef CONFIG_PM
41 .resume = ata_scsi_device_resume,
42 .suspend = ata_scsi_device_suspend,
43#endif
44}; 40};
45 41
46static const struct ata_port_operations netcell_ops = { 42static const struct ata_port_operations netcell_ops = {
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index ebc58a907d26..d5eb42bdae9a 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -158,10 +158,6 @@ static struct scsi_host_template ns87410_sht = {
158 .slave_configure = ata_scsi_slave_config, 158 .slave_configure = ata_scsi_slave_config,
159 .slave_destroy = ata_scsi_slave_destroy, 159 .slave_destroy = ata_scsi_slave_destroy,
160 .bios_param = ata_std_bios_param, 160 .bios_param = ata_std_bios_param,
161#ifdef CONFIG_PM
162 .resume = ata_scsi_device_resume,
163 .suspend = ata_scsi_device_suspend,
164#endif
165}; 161};
166 162
167static struct ata_port_operations ns87410_port_ops = { 163static struct ata_port_operations ns87410_port_ops = {
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index 4d75d32e5826..d59002e7528d 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -234,10 +234,6 @@ static struct scsi_host_template oldpiix_sht = {
234 .slave_configure = ata_scsi_slave_config, 234 .slave_configure = ata_scsi_slave_config,
235 .slave_destroy = ata_scsi_slave_destroy, 235 .slave_destroy = ata_scsi_slave_destroy,
236 .bios_param = ata_std_bios_param, 236 .bios_param = ata_std_bios_param,
237#ifdef CONFIG_PM
238 .resume = ata_scsi_device_resume,
239 .suspend = ata_scsi_device_suspend,
240#endif
241}; 237};
242 238
243static const struct ata_port_operations oldpiix_pata_ops = { 239static const struct ata_port_operations oldpiix_pata_ops = {
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c
index 0af8a2c77cc9..944b7084b459 100644
--- a/drivers/ata/pata_opti.c
+++ b/drivers/ata/pata_opti.c
@@ -179,10 +179,6 @@ static struct scsi_host_template opti_sht = {
179 .slave_configure = ata_scsi_slave_config, 179 .slave_configure = ata_scsi_slave_config,
180 .slave_destroy = ata_scsi_slave_destroy, 180 .slave_destroy = ata_scsi_slave_destroy,
181 .bios_param = ata_std_bios_param, 181 .bios_param = ata_std_bios_param,
182#ifdef CONFIG_PM
183 .resume = ata_scsi_device_resume,
184 .suspend = ata_scsi_device_suspend,
185#endif
186}; 182};
187 183
188static struct ata_port_operations opti_port_ops = { 184static struct ata_port_operations opti_port_ops = {
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c
index 2843e480f216..875ac4a49dd7 100644
--- a/drivers/ata/pata_optidma.c
+++ b/drivers/ata/pata_optidma.c
@@ -363,10 +363,6 @@ static struct scsi_host_template optidma_sht = {
363 .slave_configure = ata_scsi_slave_config, 363 .slave_configure = ata_scsi_slave_config,
364 .slave_destroy = ata_scsi_slave_destroy, 364 .slave_destroy = ata_scsi_slave_destroy,
365 .bios_param = ata_std_bios_param, 365 .bios_param = ata_std_bios_param,
366#ifdef CONFIG_PM
367 .resume = ata_scsi_device_resume,
368 .suspend = ata_scsi_device_suspend,
369#endif
370}; 366};
371 367
372static struct ata_port_operations optidma_port_ops = { 368static struct ata_port_operations optidma_port_ops = {
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index ee636beb05e1..3e204c329d51 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -244,10 +244,6 @@ static struct scsi_host_template pdc202xx_sht = {
244 .slave_configure = ata_scsi_slave_config, 244 .slave_configure = ata_scsi_slave_config,
245 .slave_destroy = ata_scsi_slave_destroy, 245 .slave_destroy = ata_scsi_slave_destroy,
246 .bios_param = ata_std_bios_param, 246 .bios_param = ata_std_bios_param,
247#ifdef CONFIG_PM
248 .resume = ata_scsi_device_resume,
249 .suspend = ata_scsi_device_suspend,
250#endif
251}; 247};
252 248
253static struct ata_port_operations pdc2024x_port_ops = { 249static struct ata_port_operations pdc2024x_port_ops = {
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c
index 1c54673e008d..bc01b17a00c2 100644
--- a/drivers/ata/pata_radisys.c
+++ b/drivers/ata/pata_radisys.c
@@ -200,10 +200,6 @@ static struct scsi_host_template radisys_sht = {
200 .slave_configure = ata_scsi_slave_config, 200 .slave_configure = ata_scsi_slave_config,
201 .slave_destroy = ata_scsi_slave_destroy, 201 .slave_destroy = ata_scsi_slave_destroy,
202 .bios_param = ata_std_bios_param, 202 .bios_param = ata_std_bios_param,
203#ifdef CONFIG_PM
204 .resume = ata_scsi_device_resume,
205 .suspend = ata_scsi_device_suspend,
206#endif
207}; 203};
208 204
209static const struct ata_port_operations radisys_pata_ops = { 205static const struct ata_port_operations radisys_pata_ops = {
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c
index 85c45290eeee..97785b4f1efa 100644
--- a/drivers/ata/pata_rz1000.c
+++ b/drivers/ata/pata_rz1000.c
@@ -40,7 +40,7 @@ static int rz1000_set_mode(struct ata_port *ap, struct ata_device **unused)
40 40
41 for (i = 0; i < ATA_MAX_DEVICES; i++) { 41 for (i = 0; i < ATA_MAX_DEVICES; i++) {
42 struct ata_device *dev = &ap->device[i]; 42 struct ata_device *dev = &ap->device[i];
43 if (ata_dev_ready(dev)) { 43 if (ata_dev_enabled(dev)) {
44 /* We don't really care */ 44 /* We don't really care */
45 dev->pio_mode = XFER_PIO_0; 45 dev->pio_mode = XFER_PIO_0;
46 dev->xfer_mode = XFER_PIO_0; 46 dev->xfer_mode = XFER_PIO_0;
@@ -69,10 +69,6 @@ static struct scsi_host_template rz1000_sht = {
69 .slave_configure = ata_scsi_slave_config, 69 .slave_configure = ata_scsi_slave_config,
70 .slave_destroy = ata_scsi_slave_destroy, 70 .slave_destroy = ata_scsi_slave_destroy,
71 .bios_param = ata_std_bios_param, 71 .bios_param = ata_std_bios_param,
72#ifdef CONFIG_PM
73 .resume = ata_scsi_device_resume,
74 .suspend = ata_scsi_device_suspend,
75#endif
76}; 72};
77 73
78static struct ata_port_operations rz1000_port_ops = { 74static struct ata_port_operations rz1000_port_ops = {
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index 66e8ff467c8d..2af9f8c8bd1f 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -194,10 +194,6 @@ static struct scsi_host_template sc1200_sht = {
194 .slave_configure = ata_scsi_slave_config, 194 .slave_configure = ata_scsi_slave_config,
195 .slave_destroy = ata_scsi_slave_destroy, 195 .slave_destroy = ata_scsi_slave_destroy,
196 .bios_param = ata_std_bios_param, 196 .bios_param = ata_std_bios_param,
197#ifdef CONFIG_PM
198 .resume = ata_scsi_device_resume,
199 .suspend = ata_scsi_device_suspend,
200#endif
201}; 197};
202 198
203static struct ata_port_operations sc1200_port_ops = { 199static struct ata_port_operations sc1200_port_ops = {
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 203f463ac39f..cca3aa225efe 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -984,10 +984,6 @@ static struct scsi_host_template scc_sht = {
984 .slave_configure = ata_scsi_slave_config, 984 .slave_configure = ata_scsi_slave_config,
985 .slave_destroy = ata_scsi_slave_destroy, 985 .slave_destroy = ata_scsi_slave_destroy,
986 .bios_param = ata_std_bios_param, 986 .bios_param = ata_std_bios_param,
987#ifdef CONFIG_PM
988 .resume = ata_scsi_device_resume,
989 .suspend = ata_scsi_device_suspend,
990#endif
991}; 987};
992 988
993static const struct ata_port_operations scc_pata_ops = { 989static const struct ata_port_operations scc_pata_ops = {
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index b6e020383dd9..8bbe4266f760 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -315,10 +315,6 @@ static struct scsi_host_template serverworks_sht = {
315 .slave_configure = ata_scsi_slave_config, 315 .slave_configure = ata_scsi_slave_config,
316 .slave_destroy = ata_scsi_slave_destroy, 316 .slave_destroy = ata_scsi_slave_destroy,
317 .bios_param = ata_std_bios_param, 317 .bios_param = ata_std_bios_param,
318#ifdef CONFIG_PM
319 .resume = ata_scsi_device_resume,
320 .suspend = ata_scsi_device_suspend,
321#endif
322}; 318};
323 319
324static struct ata_port_operations serverworks_osb4_port_ops = { 320static struct ata_port_operations serverworks_osb4_port_ops = {
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index a5886f061c0b..8c0b25f145ae 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -232,10 +232,6 @@ static struct scsi_host_template sil680_sht = {
232 .slave_configure = ata_scsi_slave_config, 232 .slave_configure = ata_scsi_slave_config,
233 .slave_destroy = ata_scsi_slave_destroy, 233 .slave_destroy = ata_scsi_slave_destroy,
234 .bios_param = ata_std_bios_param, 234 .bios_param = ata_std_bios_param,
235#ifdef CONFIG_PM
236 .suspend = ata_scsi_device_suspend,
237 .resume = ata_scsi_device_resume,
238#endif
239}; 235};
240 236
241static struct ata_port_operations sil680_port_ops = { 237static struct ata_port_operations sil680_port_ops = {
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index f5838cc11728..9b3774a4775a 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -524,10 +524,6 @@ static struct scsi_host_template sis_sht = {
524 .slave_configure = ata_scsi_slave_config, 524 .slave_configure = ata_scsi_slave_config,
525 .slave_destroy = ata_scsi_slave_destroy, 525 .slave_destroy = ata_scsi_slave_destroy,
526 .bios_param = ata_std_bios_param, 526 .bios_param = ata_std_bios_param,
527#ifdef CONFIG_PM
528 .resume = ata_scsi_device_resume,
529 .suspend = ata_scsi_device_suspend,
530#endif
531}; 527};
532 528
533static const struct ata_port_operations sis_133_ops = { 529static const struct ata_port_operations sis_133_ops = {
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c
index 349887bf5b93..045f9d2832df 100644
--- a/drivers/ata/pata_triflex.c
+++ b/drivers/ata/pata_triflex.c
@@ -194,10 +194,6 @@ static struct scsi_host_template triflex_sht = {
194 .slave_configure = ata_scsi_slave_config, 194 .slave_configure = ata_scsi_slave_config,
195 .slave_destroy = ata_scsi_slave_destroy, 195 .slave_destroy = ata_scsi_slave_destroy,
196 .bios_param = ata_std_bios_param, 196 .bios_param = ata_std_bios_param,
197#ifdef CONFIG_PM
198 .resume = ata_scsi_device_resume,
199 .suspend = ata_scsi_device_suspend,
200#endif
201}; 197};
202 198
203static struct ata_port_operations triflex_port_ops = { 199static struct ata_port_operations triflex_port_ops = {
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 362beb2f489c..3740644e7f43 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -301,10 +301,6 @@ static struct scsi_host_template via_sht = {
301 .slave_configure = ata_scsi_slave_config, 301 .slave_configure = ata_scsi_slave_config,
302 .slave_destroy = ata_scsi_slave_destroy, 302 .slave_destroy = ata_scsi_slave_destroy,
303 .bios_param = ata_std_bios_param, 303 .bios_param = ata_std_bios_param,
304#ifdef CONFIG_PM
305 .resume = ata_scsi_device_resume,
306 .suspend = ata_scsi_device_suspend,
307#endif
308}; 304};
309 305
310static struct ata_port_operations via_port_ops = { 306static struct ata_port_operations via_port_ops = {
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index b3b62e985f19..bda5e7747c21 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -135,10 +135,6 @@ static struct scsi_host_template inic_sht = {
135 .slave_configure = inic_slave_config, 135 .slave_configure = inic_slave_config,
136 .slave_destroy = ata_scsi_slave_destroy, 136 .slave_destroy = ata_scsi_slave_destroy,
137 .bios_param = ata_std_bios_param, 137 .bios_param = ata_std_bios_param,
138#ifdef CONFIG_PM
139 .suspend = ata_scsi_device_suspend,
140 .resume = ata_scsi_device_resume,
141#endif
142}; 138};
143 139
144static const int scr_map[] = { 140static const int scr_map[] = {
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index a097595d4dc7..6962f8e492f5 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -325,10 +325,6 @@ static struct scsi_host_template nv_sht = {
325 .slave_configure = ata_scsi_slave_config, 325 .slave_configure = ata_scsi_slave_config,
326 .slave_destroy = ata_scsi_slave_destroy, 326 .slave_destroy = ata_scsi_slave_destroy,
327 .bios_param = ata_std_bios_param, 327 .bios_param = ata_std_bios_param,
328#ifdef CONFIG_PM
329 .suspend = ata_scsi_device_suspend,
330 .resume = ata_scsi_device_resume,
331#endif
332}; 328};
333 329
334static struct scsi_host_template nv_adma_sht = { 330static struct scsi_host_template nv_adma_sht = {
@@ -347,10 +343,6 @@ static struct scsi_host_template nv_adma_sht = {
347 .slave_configure = nv_adma_slave_config, 343 .slave_configure = nv_adma_slave_config,
348 .slave_destroy = ata_scsi_slave_destroy, 344 .slave_destroy = ata_scsi_slave_destroy,
349 .bios_param = ata_std_bios_param, 345 .bios_param = ata_std_bios_param,
350#ifdef CONFIG_PM
351 .suspend = ata_scsi_device_suspend,
352 .resume = ata_scsi_device_resume,
353#endif
354}; 346};
355 347
356static const struct ata_port_operations nv_generic_ops = { 348static const struct ata_port_operations nv_generic_ops = {
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 0a1e417f309c..e8483aadd11b 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -182,10 +182,6 @@ static struct scsi_host_template sil_sht = {
182 .slave_configure = ata_scsi_slave_config, 182 .slave_configure = ata_scsi_slave_config,
183 .slave_destroy = ata_scsi_slave_destroy, 183 .slave_destroy = ata_scsi_slave_destroy,
184 .bios_param = ata_std_bios_param, 184 .bios_param = ata_std_bios_param,
185#ifdef CONFIG_PM
186 .suspend = ata_scsi_device_suspend,
187 .resume = ata_scsi_device_resume,
188#endif
189}; 185};
190 186
191static const struct ata_port_operations sil_ops = { 187static const struct ata_port_operations sil_ops = {
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index b97ee9f31aec..a69d78cd8e9b 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -380,10 +380,6 @@ static struct scsi_host_template sil24_sht = {
380 .slave_configure = ata_scsi_slave_config, 380 .slave_configure = ata_scsi_slave_config,
381 .slave_destroy = ata_scsi_slave_destroy, 381 .slave_destroy = ata_scsi_slave_destroy,
382 .bios_param = ata_std_bios_param, 382 .bios_param = ata_std_bios_param,
383#ifdef CONFIG_PM
384 .suspend = ata_scsi_device_suspend,
385 .resume = ata_scsi_device_resume,
386#endif
387}; 383};
388 384
389static const struct ata_port_operations sil24_ops = { 385static const struct ata_port_operations sil24_ops = {