aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-02 20:58:52 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-02 20:58:52 -0500
commitbb648a0d22908116b4ef168935a160d7f17c4e6d (patch)
tree5ccb780a679433283ac7931d2bcbeb92828e443d /drivers
parent8b453397da923eae4aeb3b41e49793295e09eedf (diff)
parent6ffa01d88c9dd45e2ed917b5eeeb494d07efb1ab (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev: libata: add CONFIG_PM to libata core layer libata: add missing CONFIG_PM in LLDs libata: add missing PM callbacks pata_qdi: Fix initialisation [libata] pata_cmd64x: fix driver description in comments [libata] pata_{legacy,sc1200,sl82c105}: add missing hooks [libata] change master/slave IDENTIFY order libata-core: Fix simplex handling
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ahci.c14
-rw-r--r--drivers/ata/ata_generic.c4
-rw-r--r--drivers/ata/ata_piix.c4
-rw-r--r--drivers/ata/libata-core.c32
-rw-r--r--drivers/ata/libata-eh.c29
-rw-r--r--drivers/ata/libata-scsi.c2
-rw-r--r--drivers/ata/pata_ali.c6
-rw-r--r--drivers/ata/pata_amd.c6
-rw-r--r--drivers/ata/pata_atiixp.c4
-rw-r--r--drivers/ata/pata_cmd64x.c8
-rw-r--r--drivers/ata/pata_cs5520.c6
-rw-r--r--drivers/ata/pata_cs5530.c6
-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.c7
-rw-r--r--drivers/ata/pata_hpt3x3.c6
-rw-r--r--drivers/ata/pata_it8213.c4
-rw-r--r--drivers/ata/pata_it821x.c6
-rw-r--r--drivers/ata/pata_jmicron.c7
-rw-r--r--drivers/ata/pata_legacy.c18
-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_qdi.c12
-rw-r--r--drivers/ata/pata_radisys.c4
-rw-r--r--drivers/ata/pata_rz1000.c6
-rw-r--r--drivers/ata/pata_sc1200.c7
-rw-r--r--drivers/ata/pata_scc.c2
-rw-r--r--drivers/ata/pata_serverworks.c6
-rw-r--r--drivers/ata/pata_sil680.c8
-rw-r--r--drivers/ata/pata_sis.c4
-rw-r--r--drivers/ata/pata_sl82c105.c3
-rw-r--r--drivers/ata/pata_triflex.c4
-rw-r--r--drivers/ata/pata_via.c6
-rw-r--r--drivers/ata/sata_inic162x.c7
-rw-r--r--drivers/ata/sata_nv.c16
-rw-r--r--drivers/ata/sata_sil.c2
-rw-r--r--drivers/ata/sata_sil24.c2
45 files changed, 294 insertions, 12 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 1539734bbbad..43cc43d7b591 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -219,10 +219,12 @@ static void ahci_thaw(struct ata_port *ap);
219static void ahci_error_handler(struct ata_port *ap); 219static void ahci_error_handler(struct ata_port *ap);
220static void ahci_vt8251_error_handler(struct ata_port *ap); 220static void ahci_vt8251_error_handler(struct ata_port *ap);
221static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); 221static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
222#ifdef CONFIG_PM
222static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg); 223static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
223static int ahci_port_resume(struct ata_port *ap); 224static int ahci_port_resume(struct ata_port *ap);
224static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 225static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
225static int ahci_pci_device_resume(struct pci_dev *pdev); 226static int ahci_pci_device_resume(struct pci_dev *pdev);
227#endif
226 228
227static struct scsi_host_template ahci_sht = { 229static struct scsi_host_template ahci_sht = {
228 .module = THIS_MODULE, 230 .module = THIS_MODULE,
@@ -241,8 +243,10 @@ static struct scsi_host_template ahci_sht = {
241 .slave_configure = ata_scsi_slave_config, 243 .slave_configure = ata_scsi_slave_config,
242 .slave_destroy = ata_scsi_slave_destroy, 244 .slave_destroy = ata_scsi_slave_destroy,
243 .bios_param = ata_std_bios_param, 245 .bios_param = ata_std_bios_param,
246#ifdef CONFIG_PM
244 .suspend = ata_scsi_device_suspend, 247 .suspend = ata_scsi_device_suspend,
245 .resume = ata_scsi_device_resume, 248 .resume = ata_scsi_device_resume,
249#endif
246}; 250};
247 251
248static const struct ata_port_operations ahci_ops = { 252static const struct ata_port_operations ahci_ops = {
@@ -271,8 +275,10 @@ static const struct ata_port_operations ahci_ops = {
271 .error_handler = ahci_error_handler, 275 .error_handler = ahci_error_handler,
272 .post_internal_cmd = ahci_post_internal_cmd, 276 .post_internal_cmd = ahci_post_internal_cmd,
273 277
278#ifdef CONFIG_PM
274 .port_suspend = ahci_port_suspend, 279 .port_suspend = ahci_port_suspend,
275 .port_resume = ahci_port_resume, 280 .port_resume = ahci_port_resume,
281#endif
276 282
277 .port_start = ahci_port_start, 283 .port_start = ahci_port_start,
278 .port_stop = ahci_port_stop, 284 .port_stop = ahci_port_stop,
@@ -304,8 +310,10 @@ static const struct ata_port_operations ahci_vt8251_ops = {
304 .error_handler = ahci_vt8251_error_handler, 310 .error_handler = ahci_vt8251_error_handler,
305 .post_internal_cmd = ahci_post_internal_cmd, 311 .post_internal_cmd = ahci_post_internal_cmd,
306 312
313#ifdef CONFIG_PM
307 .port_suspend = ahci_port_suspend, 314 .port_suspend = ahci_port_suspend,
308 .port_resume = ahci_port_resume, 315 .port_resume = ahci_port_resume,
316#endif
309 317
310 .port_start = ahci_port_start, 318 .port_start = ahci_port_start,
311 .port_stop = ahci_port_stop, 319 .port_stop = ahci_port_stop,
@@ -436,8 +444,10 @@ static struct pci_driver ahci_pci_driver = {
436 .id_table = ahci_pci_tbl, 444 .id_table = ahci_pci_tbl,
437 .probe = ahci_init_one, 445 .probe = ahci_init_one,
438 .remove = ata_pci_remove_one, 446 .remove = ata_pci_remove_one,
447#ifdef CONFIG_PM
439 .suspend = ahci_pci_device_suspend, 448 .suspend = ahci_pci_device_suspend,
440 .resume = ahci_pci_device_resume, 449 .resume = ahci_pci_device_resume,
450#endif
441}; 451};
442 452
443 453
@@ -577,6 +587,7 @@ static void ahci_power_up(void __iomem *port_mmio, u32 cap)
577 writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD); 587 writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD);
578} 588}
579 589
590#ifdef CONFIG_PM
580static void ahci_power_down(void __iomem *port_mmio, u32 cap) 591static void ahci_power_down(void __iomem *port_mmio, u32 cap)
581{ 592{
582 u32 cmd, scontrol; 593 u32 cmd, scontrol;
@@ -594,6 +605,7 @@ static void ahci_power_down(void __iomem *port_mmio, u32 cap)
594 cmd &= ~PORT_CMD_SPIN_UP; 605 cmd &= ~PORT_CMD_SPIN_UP;
595 writel(cmd, port_mmio + PORT_CMD); 606 writel(cmd, port_mmio + PORT_CMD);
596} 607}
608#endif
597 609
598static void ahci_init_port(void __iomem *port_mmio, u32 cap, 610static void ahci_init_port(void __iomem *port_mmio, u32 cap,
599 dma_addr_t cmd_slot_dma, dma_addr_t rx_fis_dma) 611 dma_addr_t cmd_slot_dma, dma_addr_t rx_fis_dma)
@@ -1335,6 +1347,7 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
1335 } 1347 }
1336} 1348}
1337 1349
1350#ifdef CONFIG_PM
1338static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) 1351static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
1339{ 1352{
1340 struct ahci_host_priv *hpriv = ap->host->private_data; 1353 struct ahci_host_priv *hpriv = ap->host->private_data;
@@ -1413,6 +1426,7 @@ static int ahci_pci_device_resume(struct pci_dev *pdev)
1413 1426
1414 return 0; 1427 return 0;
1415} 1428}
1429#endif
1416 1430
1417static int ahci_port_start(struct ata_port *ap) 1431static int ahci_port_start(struct ata_port *ap)
1418{ 1432{
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index f48b4883c930..d8e79882b880 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -119,8 +119,10 @@ static struct scsi_host_template generic_sht = {
119 .slave_configure = ata_scsi_slave_config, 119 .slave_configure = ata_scsi_slave_config,
120 .slave_destroy = ata_scsi_slave_destroy, 120 .slave_destroy = ata_scsi_slave_destroy,
121 .bios_param = ata_std_bios_param, 121 .bios_param = ata_std_bios_param,
122#ifdef CONFIG_PM
122 .resume = ata_scsi_device_resume, 123 .resume = ata_scsi_device_resume,
123 .suspend = ata_scsi_device_suspend, 124 .suspend = ata_scsi_device_suspend,
125#endif
124}; 126};
125 127
126static struct ata_port_operations generic_port_ops = { 128static struct ata_port_operations generic_port_ops = {
@@ -230,8 +232,10 @@ static struct pci_driver ata_generic_pci_driver = {
230 .id_table = ata_generic, 232 .id_table = ata_generic,
231 .probe = ata_generic_init_one, 233 .probe = ata_generic_init_one,
232 .remove = ata_pci_remove_one, 234 .remove = ata_pci_remove_one,
235#ifdef CONFIG_PM
233 .suspend = ata_pci_device_suspend, 236 .suspend = ata_pci_device_suspend,
234 .resume = ata_pci_device_resume, 237 .resume = ata_pci_device_resume,
238#endif
235}; 239};
236 240
237static int __init ata_generic_init(void) 241static int __init ata_generic_init(void)
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 61572d8c78ad..dc42ba1b46f7 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -253,8 +253,10 @@ static struct pci_driver piix_pci_driver = {
253 .id_table = piix_pci_tbl, 253 .id_table = piix_pci_tbl,
254 .probe = piix_init_one, 254 .probe = piix_init_one,
255 .remove = ata_pci_remove_one, 255 .remove = ata_pci_remove_one,
256#ifdef CONFIG_PM
256 .suspend = ata_pci_device_suspend, 257 .suspend = ata_pci_device_suspend,
257 .resume = ata_pci_device_resume, 258 .resume = ata_pci_device_resume,
259#endif
258}; 260};
259 261
260static struct scsi_host_template piix_sht = { 262static struct scsi_host_template piix_sht = {
@@ -273,8 +275,10 @@ static struct scsi_host_template piix_sht = {
273 .slave_configure = ata_scsi_slave_config, 275 .slave_configure = ata_scsi_slave_config,
274 .slave_destroy = ata_scsi_slave_destroy, 276 .slave_destroy = ata_scsi_slave_destroy,
275 .bios_param = ata_std_bios_param, 277 .bios_param = ata_std_bios_param,
278#ifdef CONFIG_PM
276 .resume = ata_scsi_device_resume, 279 .resume = ata_scsi_device_resume,
277 .suspend = ata_scsi_device_suspend, 280 .suspend = ata_scsi_device_suspend,
281#endif
278}; 282};
279 283
280static const struct ata_port_operations piix_pata_ops = { 284static const struct ata_port_operations piix_pata_ops = {
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index ac3d1204ea35..dc362fa01ca4 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1850,8 +1850,11 @@ int ata_bus_probe(struct ata_port *ap)
1850 for (i = 0; i < ATA_MAX_DEVICES; i++) 1850 for (i = 0; i < ATA_MAX_DEVICES; i++)
1851 ap->device[i].pio_mode = XFER_PIO_0; 1851 ap->device[i].pio_mode = XFER_PIO_0;
1852 1852
1853 /* read IDENTIFY page and configure devices */ 1853 /* read IDENTIFY page and configure devices. We have to do the identify
1854 for (i = 0; i < ATA_MAX_DEVICES; i++) { 1854 specific sequence bass-ackwards so that PDIAG- is released by
1855 the slave device */
1856
1857 for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) {
1855 dev = &ap->device[i]; 1858 dev = &ap->device[i];
1856 1859
1857 if (tries[i]) 1860 if (tries[i])
@@ -1864,6 +1867,15 @@ int ata_bus_probe(struct ata_port *ap)
1864 dev->id); 1867 dev->id);
1865 if (rc) 1868 if (rc)
1866 goto fail; 1869 goto fail;
1870 }
1871
1872 /* After the identify sequence we can now set up the devices. We do
1873 this in the normal order so that the user doesn't get confused */
1874
1875 for(i = 0; i < ATA_MAX_DEVICES; i++) {
1876 dev = &ap->device[i];
1877 if (!ata_dev_enabled(dev))
1878 continue;
1867 1879
1868 ap->eh_context.i.flags |= ATA_EHI_PRINTINFO; 1880 ap->eh_context.i.flags |= ATA_EHI_PRINTINFO;
1869 rc = ata_dev_configure(dev); 1881 rc = ata_dev_configure(dev);
@@ -2556,12 +2568,11 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
2556 * host channels are not permitted to do so. 2568 * host channels are not permitted to do so.
2557 */ 2569 */
2558 if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX)) 2570 if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX))
2559 ap->host->simplex_claimed = 1; 2571 ap->host->simplex_claimed = ap;
2560 2572
2561 /* step5: chip specific finalisation */ 2573 /* step5: chip specific finalisation */
2562 if (ap->ops->post_set_mode) 2574 if (ap->ops->post_set_mode)
2563 ap->ops->post_set_mode(ap); 2575 ap->ops->post_set_mode(ap);
2564
2565 out: 2576 out:
2566 if (rc) 2577 if (rc)
2567 *r_failed_dev = dev; 2578 *r_failed_dev = dev;
@@ -3444,7 +3455,7 @@ static void ata_dev_xfermask(struct ata_device *dev)
3444 "device is on DMA blacklist, disabling DMA\n"); 3455 "device is on DMA blacklist, disabling DMA\n");
3445 } 3456 }
3446 3457
3447 if ((host->flags & ATA_HOST_SIMPLEX) && host->simplex_claimed) { 3458 if ((host->flags & ATA_HOST_SIMPLEX) && host->simplex_claimed != ap) {
3448 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 3459 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
3449 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " 3460 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by "
3450 "other device, disabling DMA\n"); 3461 "other device, disabling DMA\n");
@@ -5343,6 +5354,7 @@ int ata_flush_cache(struct ata_device *dev)
5343 return 0; 5354 return 0;
5344} 5355}
5345 5356
5357#ifdef CONFIG_PM
5346static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, 5358static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg,
5347 unsigned int action, unsigned int ehi_flags, 5359 unsigned int action, unsigned int ehi_flags,
5348 int wait) 5360 int wait)
@@ -5458,6 +5470,7 @@ void ata_host_resume(struct ata_host *host)
5458 ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); 5470 ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0);
5459 host->dev->power.power_state = PMSG_ON; 5471 host->dev->power.power_state = PMSG_ON;
5460} 5472}
5473#endif
5461 5474
5462/** 5475/**
5463 * ata_port_start - Set port up for dma. 5476 * ata_port_start - Set port up for dma.
@@ -6093,6 +6106,7 @@ int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits)
6093 return (tmp == bits->val) ? 1 : 0; 6106 return (tmp == bits->val) ? 1 : 0;
6094} 6107}
6095 6108
6109#ifdef CONFIG_PM
6096void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg) 6110void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg)
6097{ 6111{
6098 pci_save_state(pdev); 6112 pci_save_state(pdev);
@@ -6144,6 +6158,8 @@ int ata_pci_device_resume(struct pci_dev *pdev)
6144 ata_host_resume(host); 6158 ata_host_resume(host);
6145 return rc; 6159 return rc;
6146} 6160}
6161#endif /* CONFIG_PM */
6162
6147#endif /* CONFIG_PCI */ 6163#endif /* CONFIG_PCI */
6148 6164
6149 6165
@@ -6352,8 +6368,10 @@ EXPORT_SYMBOL_GPL(sata_scr_write);
6352EXPORT_SYMBOL_GPL(sata_scr_write_flush); 6368EXPORT_SYMBOL_GPL(sata_scr_write_flush);
6353EXPORT_SYMBOL_GPL(ata_port_online); 6369EXPORT_SYMBOL_GPL(ata_port_online);
6354EXPORT_SYMBOL_GPL(ata_port_offline); 6370EXPORT_SYMBOL_GPL(ata_port_offline);
6371#ifdef CONFIG_PM
6355EXPORT_SYMBOL_GPL(ata_host_suspend); 6372EXPORT_SYMBOL_GPL(ata_host_suspend);
6356EXPORT_SYMBOL_GPL(ata_host_resume); 6373EXPORT_SYMBOL_GPL(ata_host_resume);
6374#endif /* CONFIG_PM */
6357EXPORT_SYMBOL_GPL(ata_id_string); 6375EXPORT_SYMBOL_GPL(ata_id_string);
6358EXPORT_SYMBOL_GPL(ata_id_c_string); 6376EXPORT_SYMBOL_GPL(ata_id_c_string);
6359EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); 6377EXPORT_SYMBOL_GPL(ata_id_to_dma_mode);
@@ -6369,16 +6387,20 @@ EXPORT_SYMBOL_GPL(pci_test_config_bits);
6369EXPORT_SYMBOL_GPL(ata_pci_init_native_mode); 6387EXPORT_SYMBOL_GPL(ata_pci_init_native_mode);
6370EXPORT_SYMBOL_GPL(ata_pci_init_one); 6388EXPORT_SYMBOL_GPL(ata_pci_init_one);
6371EXPORT_SYMBOL_GPL(ata_pci_remove_one); 6389EXPORT_SYMBOL_GPL(ata_pci_remove_one);
6390#ifdef CONFIG_PM
6372EXPORT_SYMBOL_GPL(ata_pci_device_do_suspend); 6391EXPORT_SYMBOL_GPL(ata_pci_device_do_suspend);
6373EXPORT_SYMBOL_GPL(ata_pci_device_do_resume); 6392EXPORT_SYMBOL_GPL(ata_pci_device_do_resume);
6374EXPORT_SYMBOL_GPL(ata_pci_device_suspend); 6393EXPORT_SYMBOL_GPL(ata_pci_device_suspend);
6375EXPORT_SYMBOL_GPL(ata_pci_device_resume); 6394EXPORT_SYMBOL_GPL(ata_pci_device_resume);
6395#endif /* CONFIG_PM */
6376EXPORT_SYMBOL_GPL(ata_pci_default_filter); 6396EXPORT_SYMBOL_GPL(ata_pci_default_filter);
6377EXPORT_SYMBOL_GPL(ata_pci_clear_simplex); 6397EXPORT_SYMBOL_GPL(ata_pci_clear_simplex);
6378#endif /* CONFIG_PCI */ 6398#endif /* CONFIG_PCI */
6379 6399
6400#ifdef CONFIG_PM
6380EXPORT_SYMBOL_GPL(ata_scsi_device_suspend); 6401EXPORT_SYMBOL_GPL(ata_scsi_device_suspend);
6381EXPORT_SYMBOL_GPL(ata_scsi_device_resume); 6402EXPORT_SYMBOL_GPL(ata_scsi_device_resume);
6403#endif /* CONFIG_PM */
6382 6404
6383EXPORT_SYMBOL_GPL(ata_eng_timeout); 6405EXPORT_SYMBOL_GPL(ata_eng_timeout);
6384EXPORT_SYMBOL_GPL(ata_port_schedule_eh); 6406EXPORT_SYMBOL_GPL(ata_port_schedule_eh);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index cad0d6db6df5..7349c3dbf774 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -52,8 +52,33 @@ enum {
52 52
53static void __ata_port_freeze(struct ata_port *ap); 53static void __ata_port_freeze(struct ata_port *ap);
54static void ata_eh_finish(struct ata_port *ap); 54static void ata_eh_finish(struct ata_port *ap);
55#ifdef CONFIG_PM
55static void ata_eh_handle_port_suspend(struct ata_port *ap); 56static void ata_eh_handle_port_suspend(struct ata_port *ap);
56static void ata_eh_handle_port_resume(struct ata_port *ap); 57static void ata_eh_handle_port_resume(struct ata_port *ap);
58static int ata_eh_suspend(struct ata_port *ap,
59 struct ata_device **r_failed_dev);
60static void ata_eh_prep_resume(struct ata_port *ap);
61static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev);
62#else /* CONFIG_PM */
63static void ata_eh_handle_port_suspend(struct ata_port *ap)
64{ }
65
66static void ata_eh_handle_port_resume(struct ata_port *ap)
67{ }
68
69static int ata_eh_suspend(struct ata_port *ap, struct ata_device **r_failed_dev)
70{
71 return 0;
72}
73
74static void ata_eh_prep_resume(struct ata_port *ap)
75{ }
76
77static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev)
78{
79 return 0;
80}
81#endif /* CONFIG_PM */
57 82
58static void ata_ering_record(struct ata_ering *ering, int is_io, 83static void ata_ering_record(struct ata_ering *ering, int is_io,
59 unsigned int err_mask) 84 unsigned int err_mask)
@@ -1790,6 +1815,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1790 return rc; 1815 return rc;
1791} 1816}
1792 1817
1818#ifdef CONFIG_PM
1793/** 1819/**
1794 * ata_eh_suspend - handle suspend EH action 1820 * ata_eh_suspend - handle suspend EH action
1795 * @ap: target host port 1821 * @ap: target host port
@@ -1947,6 +1973,7 @@ static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev)
1947 DPRINTK("EXIT\n"); 1973 DPRINTK("EXIT\n");
1948 return 0; 1974 return 0;
1949} 1975}
1976#endif /* CONFIG_PM */
1950 1977
1951static int ata_port_nr_enabled(struct ata_port *ap) 1978static int ata_port_nr_enabled(struct ata_port *ap)
1952{ 1979{
@@ -2249,6 +2276,7 @@ void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
2249 ata_eh_finish(ap); 2276 ata_eh_finish(ap);
2250} 2277}
2251 2278
2279#ifdef CONFIG_PM
2252/** 2280/**
2253 * ata_eh_handle_port_suspend - perform port suspend operation 2281 * ata_eh_handle_port_suspend - perform port suspend operation
2254 * @ap: port to suspend 2282 * @ap: port to suspend
@@ -2364,3 +2392,4 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
2364 } 2392 }
2365 spin_unlock_irqrestore(ap->lock, flags); 2393 spin_unlock_irqrestore(ap->lock, flags);
2366} 2394}
2395#endif /* CONFIG_PM */
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 00a9a6c8f83c..6cc817a10204 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -510,6 +510,7 @@ static void ata_dump_status(unsigned id, struct ata_taskfile *tf)
510 } 510 }
511} 511}
512 512
513#ifdef CONFIG_PM
513/** 514/**
514 * ata_scsi_device_suspend - suspend ATA device associated with sdev 515 * ata_scsi_device_suspend - suspend ATA device associated with sdev
515 * @sdev: the SCSI device to suspend 516 * @sdev: the SCSI device to suspend
@@ -634,6 +635,7 @@ int ata_scsi_device_resume(struct scsi_device *sdev)
634 sdev->sdev_gendev.power.power_state = PMSG_ON; 635 sdev->sdev_gendev.power.power_state = PMSG_ON;
635 return 0; 636 return 0;
636} 637}
638#endif /* CONFIG_PM */
637 639
638/** 640/**
639 * ata_to_sense_error - convert ATA error to SCSI error 641 * ata_to_sense_error - convert ATA error to SCSI error
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index a90ed00c07e0..11ea552a58ca 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -345,8 +345,10 @@ static struct scsi_host_template ali_sht = {
345 .slave_configure = ata_scsi_slave_config, 345 .slave_configure = ata_scsi_slave_config,
346 .slave_destroy = ata_scsi_slave_destroy, 346 .slave_destroy = ata_scsi_slave_destroy,
347 .bios_param = ata_std_bios_param, 347 .bios_param = ata_std_bios_param,
348#ifdef CONFIG_PM
348 .resume = ata_scsi_device_resume, 349 .resume = ata_scsi_device_resume,
349 .suspend = ata_scsi_device_suspend, 350 .suspend = ata_scsi_device_suspend,
351#endif
350}; 352};
351 353
352/* 354/*
@@ -667,11 +669,13 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
667 return ata_pci_init_one(pdev, port_info, 2); 669 return ata_pci_init_one(pdev, port_info, 2);
668} 670}
669 671
672#ifdef CONFIG_PM
670static int ali_reinit_one(struct pci_dev *pdev) 673static int ali_reinit_one(struct pci_dev *pdev)
671{ 674{
672 ali_init_chipset(pdev); 675 ali_init_chipset(pdev);
673 return ata_pci_device_resume(pdev); 676 return ata_pci_device_resume(pdev);
674} 677}
678#endif
675 679
676static const struct pci_device_id ali[] = { 680static const struct pci_device_id ali[] = {
677 { PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5228), }, 681 { PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5228), },
@@ -685,8 +689,10 @@ static struct pci_driver ali_pci_driver = {
685 .id_table = ali, 689 .id_table = ali,
686 .probe = ali_init_one, 690 .probe = ali_init_one,
687 .remove = ata_pci_remove_one, 691 .remove = ata_pci_remove_one,
692#ifdef CONFIG_PM
688 .suspend = ata_pci_device_suspend, 693 .suspend = ata_pci_device_suspend,
689 .resume = ali_reinit_one, 694 .resume = ali_reinit_one,
695#endif
690}; 696};
691 697
692static int __init ali_init(void) 698static int __init ali_init(void)
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 3c760d0f4717..18381762908b 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -334,8 +334,10 @@ static struct scsi_host_template amd_sht = {
334 .slave_configure = ata_scsi_slave_config, 334 .slave_configure = ata_scsi_slave_config,
335 .slave_destroy = ata_scsi_slave_destroy, 335 .slave_destroy = ata_scsi_slave_destroy,
336 .bios_param = ata_std_bios_param, 336 .bios_param = ata_std_bios_param,
337#ifdef CONFIG_PM
337 .resume = ata_scsi_device_resume, 338 .resume = ata_scsi_device_resume,
338 .suspend = ata_scsi_device_suspend, 339 .suspend = ata_scsi_device_suspend,
340#endif
339}; 341};
340 342
341static struct ata_port_operations amd33_port_ops = { 343static struct ata_port_operations amd33_port_ops = {
@@ -663,6 +665,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
663 return ata_pci_init_one(pdev, port_info, 2); 665 return ata_pci_init_one(pdev, port_info, 2);
664} 666}
665 667
668#ifdef CONFIG_PM
666static int amd_reinit_one(struct pci_dev *pdev) 669static int amd_reinit_one(struct pci_dev *pdev)
667{ 670{
668 if (pdev->vendor == PCI_VENDOR_ID_AMD) { 671 if (pdev->vendor == PCI_VENDOR_ID_AMD) {
@@ -679,6 +682,7 @@ static int amd_reinit_one(struct pci_dev *pdev)
679 } 682 }
680 return ata_pci_device_resume(pdev); 683 return ata_pci_device_resume(pdev);
681} 684}
685#endif
682 686
683static const struct pci_device_id amd[] = { 687static const struct pci_device_id amd[] = {
684 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_COBRA_7401), 0 }, 688 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_COBRA_7401), 0 },
@@ -708,8 +712,10 @@ static struct pci_driver amd_pci_driver = {
708 .id_table = amd, 712 .id_table = amd,
709 .probe = amd_init_one, 713 .probe = amd_init_one,
710 .remove = ata_pci_remove_one, 714 .remove = ata_pci_remove_one,
715#ifdef CONFIG_PM
711 .suspend = ata_pci_device_suspend, 716 .suspend = ata_pci_device_suspend,
712 .resume = amd_reinit_one, 717 .resume = amd_reinit_one,
718#endif
713}; 719};
714 720
715static int __init amd_init(void) 721static int __init amd_init(void)
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index c3eb40c91c80..51d9923be02e 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -224,8 +224,10 @@ static struct scsi_host_template atiixp_sht = {
224 .slave_configure = ata_scsi_slave_config, 224 .slave_configure = ata_scsi_slave_config,
225 .slave_destroy = ata_scsi_slave_destroy, 225 .slave_destroy = ata_scsi_slave_destroy,
226 .bios_param = ata_std_bios_param, 226 .bios_param = ata_std_bios_param,
227#ifdef CONFIG_PM
227 .resume = ata_scsi_device_resume, 228 .resume = ata_scsi_device_resume,
228 .suspend = ata_scsi_device_suspend, 229 .suspend = ata_scsi_device_suspend,
230#endif
229}; 231};
230 232
231static struct ata_port_operations atiixp_port_ops = { 233static struct ata_port_operations atiixp_port_ops = {
@@ -290,8 +292,10 @@ static struct pci_driver atiixp_pci_driver = {
290 .id_table = atiixp, 292 .id_table = atiixp,
291 .probe = atiixp_init_one, 293 .probe = atiixp_init_one,
292 .remove = ata_pci_remove_one, 294 .remove = ata_pci_remove_one,
295#ifdef CONFIG_PM
293 .resume = ata_pci_device_resume, 296 .resume = ata_pci_device_resume,
294 .suspend = ata_pci_device_suspend, 297 .suspend = ata_pci_device_suspend,
298#endif
295}; 299};
296 300
297static int __init atiixp_init(void) 301static int __init atiixp_init(void)
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index da098282b5f6..5b13bdd1edc0 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * pata_cmd64x.c - ATI PATA for new ATA layer 2 * pata_cmd64x.c - CMD64x PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@redhat.com>
5 * 5 *
@@ -285,8 +285,10 @@ static struct scsi_host_template cmd64x_sht = {
285 .slave_configure = ata_scsi_slave_config, 285 .slave_configure = ata_scsi_slave_config,
286 .slave_destroy = ata_scsi_slave_destroy, 286 .slave_destroy = ata_scsi_slave_destroy,
287 .bios_param = ata_std_bios_param, 287 .bios_param = ata_std_bios_param,
288#ifdef CONFIG_PM
288 .resume = ata_scsi_device_resume, 289 .resume = ata_scsi_device_resume,
289 .suspend = ata_scsi_device_suspend, 290 .suspend = ata_scsi_device_suspend,
291#endif
290}; 292};
291 293
292static struct ata_port_operations cmd64x_port_ops = { 294static struct ata_port_operations cmd64x_port_ops = {
@@ -479,6 +481,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
479 return ata_pci_init_one(pdev, port_info, 2); 481 return ata_pci_init_one(pdev, port_info, 2);
480} 482}
481 483
484#ifdef CONFIG_PM
482static int cmd64x_reinit_one(struct pci_dev *pdev) 485static int cmd64x_reinit_one(struct pci_dev *pdev)
483{ 486{
484 u8 mrdmode; 487 u8 mrdmode;
@@ -492,6 +495,7 @@ static int cmd64x_reinit_one(struct pci_dev *pdev)
492#endif 495#endif
493 return ata_pci_device_resume(pdev); 496 return ata_pci_device_resume(pdev);
494} 497}
498#endif
495 499
496static const struct pci_device_id cmd64x[] = { 500static const struct pci_device_id cmd64x[] = {
497 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_CMD_643), 0 }, 501 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_CMD_643), 0 },
@@ -507,8 +511,10 @@ static struct pci_driver cmd64x_pci_driver = {
507 .id_table = cmd64x, 511 .id_table = cmd64x,
508 .probe = cmd64x_init_one, 512 .probe = cmd64x_init_one,
509 .remove = ata_pci_remove_one, 513 .remove = ata_pci_remove_one,
514#ifdef CONFIG_PM
510 .suspend = ata_pci_device_suspend, 515 .suspend = ata_pci_device_suspend,
511 .resume = cmd64x_reinit_one, 516 .resume = cmd64x_reinit_one,
517#endif
512}; 518};
513 519
514static int __init cmd64x_init(void) 520static int __init cmd64x_init(void)
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index 8ff2d58c599e..7ef834250a43 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -167,8 +167,10 @@ static struct scsi_host_template cs5520_sht = {
167 .slave_configure = ata_scsi_slave_config, 167 .slave_configure = ata_scsi_slave_config,
168 .slave_destroy = ata_scsi_slave_destroy, 168 .slave_destroy = ata_scsi_slave_destroy,
169 .bios_param = ata_std_bios_param, 169 .bios_param = ata_std_bios_param,
170#ifdef CONFIG_PM
170 .resume = ata_scsi_device_resume, 171 .resume = ata_scsi_device_resume,
171 .suspend = ata_scsi_device_suspend, 172 .suspend = ata_scsi_device_suspend,
173#endif
172}; 174};
173 175
174static struct ata_port_operations cs5520_port_ops = { 176static struct ata_port_operations cs5520_port_ops = {
@@ -308,6 +310,7 @@ static void __devexit cs5520_remove_one(struct pci_dev *pdev)
308 ata_host_detach(host); 310 ata_host_detach(host);
309} 311}
310 312
313#ifdef CONFIG_PM
311/** 314/**
312 * cs5520_reinit_one - device resume 315 * cs5520_reinit_one - device resume
313 * @pdev: PCI device 316 * @pdev: PCI device
@@ -347,6 +350,7 @@ static int cs5520_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
347 pci_save_state(pdev); 350 pci_save_state(pdev);
348 return 0; 351 return 0;
349} 352}
353#endif /* CONFIG_PM */
350 354
351/* For now keep DMA off. We can set it for all but A rev CS5510 once the 355/* For now keep DMA off. We can set it for all but A rev CS5510 once the
352 core ATA code can handle it */ 356 core ATA code can handle it */
@@ -363,8 +367,10 @@ static struct pci_driver cs5520_pci_driver = {
363 .id_table = pata_cs5520, 367 .id_table = pata_cs5520,
364 .probe = cs5520_init_one, 368 .probe = cs5520_init_one,
365 .remove = cs5520_remove_one, 369 .remove = cs5520_remove_one,
370#ifdef CONFIG_PM
366 .suspend = cs5520_pci_device_suspend, 371 .suspend = cs5520_pci_device_suspend,
367 .resume = cs5520_reinit_one, 372 .resume = cs5520_reinit_one,
373#endif
368}; 374};
369 375
370static int __init cs5520_init(void) 376static int __init cs5520_init(void)
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 78c7cdfff69d..db63e80e608b 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -188,8 +188,10 @@ static struct scsi_host_template cs5530_sht = {
188 .slave_configure = ata_scsi_slave_config, 188 .slave_configure = ata_scsi_slave_config,
189 .slave_destroy = ata_scsi_slave_destroy, 189 .slave_destroy = ata_scsi_slave_destroy,
190 .bios_param = ata_std_bios_param, 190 .bios_param = ata_std_bios_param,
191#ifdef CONFIG_PM
191 .resume = ata_scsi_device_resume, 192 .resume = ata_scsi_device_resume,
192 .suspend = ata_scsi_device_suspend, 193 .suspend = ata_scsi_device_suspend,
194#endif
193}; 195};
194 196
195static struct ata_port_operations cs5530_port_ops = { 197static struct ata_port_operations cs5530_port_ops = {
@@ -376,6 +378,7 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
376 return ata_pci_init_one(pdev, port_info, 2); 378 return ata_pci_init_one(pdev, port_info, 2);
377} 379}
378 380
381#ifdef CONFIG_PM
379static int cs5530_reinit_one(struct pci_dev *pdev) 382static int cs5530_reinit_one(struct pci_dev *pdev)
380{ 383{
381 /* If we fail on resume we are doomed */ 384 /* If we fail on resume we are doomed */
@@ -383,6 +386,7 @@ static int cs5530_reinit_one(struct pci_dev *pdev)
383 BUG(); 386 BUG();
384 return ata_pci_device_resume(pdev); 387 return ata_pci_device_resume(pdev);
385} 388}
389#endif /* CONFIG_PM */
386 390
387static const struct pci_device_id cs5530[] = { 391static const struct pci_device_id cs5530[] = {
388 { PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5530_IDE), }, 392 { PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5530_IDE), },
@@ -395,8 +399,10 @@ static struct pci_driver cs5530_pci_driver = {
395 .id_table = cs5530, 399 .id_table = cs5530,
396 .probe = cs5530_init_one, 400 .probe = cs5530_init_one,
397 .remove = ata_pci_remove_one, 401 .remove = ata_pci_remove_one,
402#ifdef CONFIG_PM
398 .suspend = ata_pci_device_suspend, 403 .suspend = ata_pci_device_suspend,
399 .resume = cs5530_reinit_one, 404 .resume = cs5530_reinit_one,
405#endif
400}; 406};
401 407
402static int __init cs5530_init(void) 408static int __init cs5530_init(void)
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c
index 17bc693cc514..1572e5c9031a 100644
--- a/drivers/ata/pata_cs5535.c
+++ b/drivers/ata/pata_cs5535.c
@@ -185,8 +185,10 @@ static struct scsi_host_template cs5535_sht = {
185 .slave_configure = ata_scsi_slave_config, 185 .slave_configure = ata_scsi_slave_config,
186 .slave_destroy = ata_scsi_slave_destroy, 186 .slave_destroy = ata_scsi_slave_destroy,
187 .bios_param = ata_std_bios_param, 187 .bios_param = ata_std_bios_param,
188#ifdef CONFIG_PM
188 .resume = ata_scsi_device_resume, 189 .resume = ata_scsi_device_resume,
189 .suspend = ata_scsi_device_suspend, 190 .suspend = ata_scsi_device_suspend,
191#endif
190}; 192};
191 193
192static struct ata_port_operations cs5535_port_ops = { 194static struct ata_port_operations cs5535_port_ops = {
@@ -270,8 +272,10 @@ static struct pci_driver cs5535_pci_driver = {
270 .id_table = cs5535, 272 .id_table = cs5535,
271 .probe = cs5535_init_one, 273 .probe = cs5535_init_one,
272 .remove = ata_pci_remove_one, 274 .remove = ata_pci_remove_one,
275#ifdef CONFIG_PM
273 .suspend = ata_pci_device_suspend, 276 .suspend = ata_pci_device_suspend,
274 .resume = ata_pci_device_resume, 277 .resume = ata_pci_device_resume,
278#endif
275}; 279};
276 280
277static int __init cs5535_init(void) 281static int __init cs5535_init(void)
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c
index 63f48f08763d..f69dde5f7066 100644
--- a/drivers/ata/pata_cypress.c
+++ b/drivers/ata/pata_cypress.c
@@ -136,8 +136,10 @@ static struct scsi_host_template cy82c693_sht = {
136 .slave_configure = ata_scsi_slave_config, 136 .slave_configure = ata_scsi_slave_config,
137 .slave_destroy = ata_scsi_slave_destroy, 137 .slave_destroy = ata_scsi_slave_destroy,
138 .bios_param = ata_std_bios_param, 138 .bios_param = ata_std_bios_param,
139#ifdef CONFIG_PM
139 .resume = ata_scsi_device_resume, 140 .resume = ata_scsi_device_resume,
140 .suspend = ata_scsi_device_suspend, 141 .suspend = ata_scsi_device_suspend,
142#endif
141}; 143};
142 144
143static struct ata_port_operations cy82c693_port_ops = { 145static struct ata_port_operations cy82c693_port_ops = {
@@ -206,8 +208,10 @@ static struct pci_driver cy82c693_pci_driver = {
206 .id_table = cy82c693, 208 .id_table = cy82c693,
207 .probe = cy82c693_init_one, 209 .probe = cy82c693_init_one,
208 .remove = ata_pci_remove_one, 210 .remove = ata_pci_remove_one,
211#ifdef CONFIG_PM
209 .suspend = ata_pci_device_suspend, 212 .suspend = ata_pci_device_suspend,
210 .resume = ata_pci_device_resume, 213 .resume = ata_pci_device_resume,
214#endif
211}; 215};
212 216
213static int __init cy82c693_init(void) 217static int __init cy82c693_init(void)
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c
index c19b6a8a7dc6..dac7a6554f6c 100644
--- a/drivers/ata/pata_efar.c
+++ b/drivers/ata/pata_efar.c
@@ -234,8 +234,10 @@ static struct scsi_host_template efar_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
237 .resume = ata_scsi_device_resume, 238 .resume = ata_scsi_device_resume,
238 .suspend = ata_scsi_device_suspend, 239 .suspend = ata_scsi_device_suspend,
240#endif
239}; 241};
240 242
241static const struct ata_port_operations efar_ops = { 243static const struct ata_port_operations efar_ops = {
@@ -317,8 +319,10 @@ static struct pci_driver efar_pci_driver = {
317 .id_table = efar_pci_tbl, 319 .id_table = efar_pci_tbl,
318 .probe = efar_init_one, 320 .probe = efar_init_one,
319 .remove = ata_pci_remove_one, 321 .remove = ata_pci_remove_one,
322#ifdef CONFIG_PM
320 .suspend = ata_pci_device_suspend, 323 .suspend = ata_pci_device_suspend,
321 .resume = ata_pci_device_resume, 324 .resume = ata_pci_device_resume,
325#endif
322}; 326};
323 327
324static int __init efar_init(void) 328static int __init efar_init(void)
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index e7d33c628a61..baf35f876030 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -328,8 +328,10 @@ static struct scsi_host_template hpt36x_sht = {
328 .slave_configure = ata_scsi_slave_config, 328 .slave_configure = ata_scsi_slave_config,
329 .slave_destroy = ata_scsi_slave_destroy, 329 .slave_destroy = ata_scsi_slave_destroy,
330 .bios_param = ata_std_bios_param, 330 .bios_param = ata_std_bios_param,
331#ifdef CONFIG_PM
331 .resume = ata_scsi_device_resume, 332 .resume = ata_scsi_device_resume,
332 .suspend = ata_scsi_device_suspend, 333 .suspend = ata_scsi_device_suspend,
334#endif
333}; 335};
334 336
335/* 337/*
@@ -457,12 +459,13 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
457 return ata_pci_init_one(dev, port_info, 2); 459 return ata_pci_init_one(dev, port_info, 2);
458} 460}
459 461
462#ifdef CONFIG_PM
460static int hpt36x_reinit_one(struct pci_dev *dev) 463static int hpt36x_reinit_one(struct pci_dev *dev)
461{ 464{
462 hpt36x_init_chipset(dev); 465 hpt36x_init_chipset(dev);
463 return ata_pci_device_resume(dev); 466 return ata_pci_device_resume(dev);
464} 467}
465 468#endif
466 469
467static const struct pci_device_id hpt36x[] = { 470static const struct pci_device_id hpt36x[] = {
468 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), }, 471 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), },
@@ -474,8 +477,10 @@ static struct pci_driver hpt36x_pci_driver = {
474 .id_table = hpt36x, 477 .id_table = hpt36x,
475 .probe = hpt36x_init_one, 478 .probe = hpt36x_init_one,
476 .remove = ata_pci_remove_one, 479 .remove = ata_pci_remove_one,
480#ifdef CONFIG_PM
477 .suspend = ata_pci_device_suspend, 481 .suspend = ata_pci_device_suspend,
478 .resume = hpt36x_reinit_one, 482 .resume = hpt36x_reinit_one,
483#endif
479}; 484};
480 485
481static int __init hpt36x_init(void) 486static int __init hpt36x_init(void)
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c
index 483ce7c12c9a..813485c8526c 100644
--- a/drivers/ata/pata_hpt3x3.c
+++ b/drivers/ata/pata_hpt3x3.c
@@ -119,8 +119,10 @@ static struct scsi_host_template hpt3x3_sht = {
119 .slave_configure = ata_scsi_slave_config, 119 .slave_configure = ata_scsi_slave_config,
120 .slave_destroy = ata_scsi_slave_destroy, 120 .slave_destroy = ata_scsi_slave_destroy,
121 .bios_param = ata_std_bios_param, 121 .bios_param = ata_std_bios_param,
122#ifdef CONFIG_PM
122 .resume = ata_scsi_device_resume, 123 .resume = ata_scsi_device_resume,
123 .suspend = ata_scsi_device_suspend, 124 .suspend = ata_scsi_device_suspend,
125#endif
124}; 126};
125 127
126static struct ata_port_operations hpt3x3_port_ops = { 128static struct ata_port_operations hpt3x3_port_ops = {
@@ -206,11 +208,13 @@ static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id)
206 return ata_pci_init_one(dev, port_info, 2); 208 return ata_pci_init_one(dev, port_info, 2);
207} 209}
208 210
211#ifdef CONFIG_PM
209static int hpt3x3_reinit_one(struct pci_dev *dev) 212static int hpt3x3_reinit_one(struct pci_dev *dev)
210{ 213{
211 hpt3x3_init_chipset(dev); 214 hpt3x3_init_chipset(dev);
212 return ata_pci_device_resume(dev); 215 return ata_pci_device_resume(dev);
213} 216}
217#endif
214 218
215static const struct pci_device_id hpt3x3[] = { 219static const struct pci_device_id hpt3x3[] = {
216 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT343), }, 220 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT343), },
@@ -223,8 +227,10 @@ static struct pci_driver hpt3x3_pci_driver = {
223 .id_table = hpt3x3, 227 .id_table = hpt3x3,
224 .probe = hpt3x3_init_one, 228 .probe = hpt3x3_init_one,
225 .remove = ata_pci_remove_one, 229 .remove = ata_pci_remove_one,
230#ifdef CONFIG_PM
226 .suspend = ata_pci_device_suspend, 231 .suspend = ata_pci_device_suspend,
227 .resume = hpt3x3_reinit_one, 232 .resume = hpt3x3_reinit_one,
233#endif
228}; 234};
229 235
230static int __init hpt3x3_init(void) 236static int __init hpt3x3_init(void)
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c
index 7eac869dfcd3..ea734701555e 100644
--- a/drivers/ata/pata_it8213.c
+++ b/drivers/ata/pata_it8213.c
@@ -246,8 +246,10 @@ static struct scsi_host_template it8213_sht = {
246 .dma_boundary = ATA_DMA_BOUNDARY, 246 .dma_boundary = ATA_DMA_BOUNDARY,
247 .slave_configure = ata_scsi_slave_config, 247 .slave_configure = ata_scsi_slave_config,
248 .bios_param = ata_std_bios_param, 248 .bios_param = ata_std_bios_param,
249#ifdef CONFIG_PM
249 .resume = ata_scsi_device_resume, 250 .resume = ata_scsi_device_resume,
250 .suspend = ata_scsi_device_suspend, 251 .suspend = ata_scsi_device_suspend,
252#endif
251}; 253};
252 254
253static const struct ata_port_operations it8213_ops = { 255static const struct ata_port_operations it8213_ops = {
@@ -330,8 +332,10 @@ static struct pci_driver it8213_pci_driver = {
330 .id_table = it8213_pci_tbl, 332 .id_table = it8213_pci_tbl,
331 .probe = it8213_init_one, 333 .probe = it8213_init_one,
332 .remove = ata_pci_remove_one, 334 .remove = ata_pci_remove_one,
335#ifdef CONFIG_PM
333 .suspend = ata_pci_device_suspend, 336 .suspend = ata_pci_device_suspend,
334 .resume = ata_pci_device_resume, 337 .resume = ata_pci_device_resume,
338#endif
335}; 339};
336 340
337static int __init it8213_init(void) 341static int __init it8213_init(void)
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 903137a6da5e..35ecb2ba067b 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -646,8 +646,10 @@ static struct scsi_host_template it821x_sht = {
646 .slave_configure = ata_scsi_slave_config, 646 .slave_configure = ata_scsi_slave_config,
647 .slave_destroy = ata_scsi_slave_destroy, 647 .slave_destroy = ata_scsi_slave_destroy,
648 .bios_param = ata_std_bios_param, 648 .bios_param = ata_std_bios_param,
649#ifdef CONFIG_PM
649 .resume = ata_scsi_device_resume, 650 .resume = ata_scsi_device_resume,
650 .suspend = ata_scsi_device_suspend, 651 .suspend = ata_scsi_device_suspend,
652#endif
651}; 653};
652 654
653static struct ata_port_operations it821x_smart_port_ops = { 655static struct ata_port_operations it821x_smart_port_ops = {
@@ -780,6 +782,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
780 return ata_pci_init_one(pdev, port_info, 2); 782 return ata_pci_init_one(pdev, port_info, 2);
781} 783}
782 784
785#ifdef CONFIG_PM
783static int it821x_reinit_one(struct pci_dev *pdev) 786static int it821x_reinit_one(struct pci_dev *pdev)
784{ 787{
785 /* Resume - turn raid back off if need be */ 788 /* Resume - turn raid back off if need be */
@@ -787,6 +790,7 @@ static int it821x_reinit_one(struct pci_dev *pdev)
787 it821x_disable_raid(pdev); 790 it821x_disable_raid(pdev);
788 return ata_pci_device_resume(pdev); 791 return ata_pci_device_resume(pdev);
789} 792}
793#endif
790 794
791static const struct pci_device_id it821x[] = { 795static const struct pci_device_id it821x[] = {
792 { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), }, 796 { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), },
@@ -800,8 +804,10 @@ static struct pci_driver it821x_pci_driver = {
800 .id_table = it821x, 804 .id_table = it821x,
801 .probe = it821x_init_one, 805 .probe = it821x_init_one,
802 .remove = ata_pci_remove_one, 806 .remove = ata_pci_remove_one,
807#ifdef CONFIG_PM
803 .suspend = ata_pci_device_suspend, 808 .suspend = ata_pci_device_suspend,
804 .resume = it821x_reinit_one, 809 .resume = it821x_reinit_one,
810#endif
805}; 811};
806 812
807static int __init it821x_init(void) 813static int __init it821x_init(void)
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 47d0f94fd792..033319e8b6cf 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -137,6 +137,10 @@ static struct scsi_host_template jmicron_sht = {
137 .slave_destroy = ata_scsi_slave_destroy, 137 .slave_destroy = ata_scsi_slave_destroy,
138 /* Use standard CHS mapping rules */ 138 /* Use standard CHS mapping rules */
139 .bios_param = ata_std_bios_param, 139 .bios_param = ata_std_bios_param,
140#ifdef CONFIG_PM
141 .suspend = ata_scsi_device_suspend,
142 .resume = ata_scsi_device_resume,
143#endif
140}; 144};
141 145
142static const struct ata_port_operations jmicron_ops = { 146static const struct ata_port_operations jmicron_ops = {
@@ -225,8 +229,10 @@ static struct pci_driver jmicron_pci_driver = {
225 .id_table = jmicron_pci_tbl, 229 .id_table = jmicron_pci_tbl,
226 .probe = jmicron_init_one, 230 .probe = jmicron_init_one,
227 .remove = ata_pci_remove_one, 231 .remove = ata_pci_remove_one,
232#ifdef CONFIG_PM
228 .suspend = ata_pci_device_suspend, 233 .suspend = ata_pci_device_suspend,
229 .resume = ata_pci_device_resume, 234 .resume = ata_pci_device_resume,
235#endif
230}; 236};
231 237
232static int __init jmicron_init(void) 238static int __init jmicron_init(void)
@@ -238,6 +244,7 @@ static void __exit jmicron_exit(void)
238{ 244{
239 pci_unregister_driver(&jmicron_pci_driver); 245 pci_unregister_driver(&jmicron_pci_driver);
240} 246}
247#endif
241 248
242module_init(jmicron_init); 249module_init(jmicron_init);
243module_exit(jmicron_exit); 250module_exit(jmicron_exit);
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 6ee61c67163a..fc5b73d78e00 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -186,7 +186,10 @@ static struct ata_port_operations legacy_port_ops = {
186 .exec_command = ata_exec_command, 186 .exec_command = ata_exec_command,
187 .dev_select = ata_std_dev_select, 187 .dev_select = ata_std_dev_select,
188 188
189 .freeze = ata_bmdma_freeze,
190 .thaw = ata_bmdma_thaw,
189 .error_handler = ata_bmdma_error_handler, 191 .error_handler = ata_bmdma_error_handler,
192 .post_internal_cmd = ata_bmdma_post_internal_cmd,
190 193
191 .qc_prep = ata_qc_prep, 194 .qc_prep = ata_qc_prep,
192 .qc_issue = ata_qc_issue_prot, 195 .qc_issue = ata_qc_issue_prot,
@@ -298,7 +301,10 @@ static struct ata_port_operations pdc20230_port_ops = {
298 .exec_command = ata_exec_command, 301 .exec_command = ata_exec_command,
299 .dev_select = ata_std_dev_select, 302 .dev_select = ata_std_dev_select,
300 303
304 .freeze = ata_bmdma_freeze,
305 .thaw = ata_bmdma_thaw,
301 .error_handler = ata_bmdma_error_handler, 306 .error_handler = ata_bmdma_error_handler,
307 .post_internal_cmd = ata_bmdma_post_internal_cmd,
302 308
303 .qc_prep = ata_qc_prep, 309 .qc_prep = ata_qc_prep,
304 .qc_issue = ata_qc_issue_prot, 310 .qc_issue = ata_qc_issue_prot,
@@ -350,7 +356,10 @@ static struct ata_port_operations ht6560a_port_ops = {
350 .exec_command = ata_exec_command, 356 .exec_command = ata_exec_command,
351 .dev_select = ata_std_dev_select, 357 .dev_select = ata_std_dev_select,
352 358
359 .freeze = ata_bmdma_freeze,
360 .thaw = ata_bmdma_thaw,
353 .error_handler = ata_bmdma_error_handler, 361 .error_handler = ata_bmdma_error_handler,
362 .post_internal_cmd = ata_bmdma_post_internal_cmd,
354 363
355 .qc_prep = ata_qc_prep, 364 .qc_prep = ata_qc_prep,
356 .qc_issue = ata_qc_issue_prot, 365 .qc_issue = ata_qc_issue_prot,
@@ -413,7 +422,10 @@ static struct ata_port_operations ht6560b_port_ops = {
413 .exec_command = ata_exec_command, 422 .exec_command = ata_exec_command,
414 .dev_select = ata_std_dev_select, 423 .dev_select = ata_std_dev_select,
415 424
425 .freeze = ata_bmdma_freeze,
426 .thaw = ata_bmdma_thaw,
416 .error_handler = ata_bmdma_error_handler, 427 .error_handler = ata_bmdma_error_handler,
428 .post_internal_cmd = ata_bmdma_post_internal_cmd,
417 429
418 .qc_prep = ata_qc_prep, 430 .qc_prep = ata_qc_prep,
419 .qc_issue = ata_qc_issue_prot, 431 .qc_issue = ata_qc_issue_prot,
@@ -531,7 +543,10 @@ static struct ata_port_operations opti82c611a_port_ops = {
531 .exec_command = ata_exec_command, 543 .exec_command = ata_exec_command,
532 .dev_select = ata_std_dev_select, 544 .dev_select = ata_std_dev_select,
533 545
546 .freeze = ata_bmdma_freeze,
547 .thaw = ata_bmdma_thaw,
534 .error_handler = ata_bmdma_error_handler, 548 .error_handler = ata_bmdma_error_handler,
549 .post_internal_cmd = ata_bmdma_post_internal_cmd,
535 550
536 .qc_prep = ata_qc_prep, 551 .qc_prep = ata_qc_prep,
537 .qc_issue = ata_qc_issue_prot, 552 .qc_issue = ata_qc_issue_prot,
@@ -661,7 +676,10 @@ static struct ata_port_operations opti82c46x_port_ops = {
661 .exec_command = ata_exec_command, 676 .exec_command = ata_exec_command,
662 .dev_select = ata_std_dev_select, 677 .dev_select = ata_std_dev_select,
663 678
679 .freeze = ata_bmdma_freeze,
680 .thaw = ata_bmdma_thaw,
664 .error_handler = ata_bmdma_error_handler, 681 .error_handler = ata_bmdma_error_handler,
682 .post_internal_cmd = ata_bmdma_post_internal_cmd,
665 683
666 .qc_prep = ata_qc_prep, 684 .qc_prep = ata_qc_prep,
667 .qc_issue = opti82c46x_qc_issue_prot, 685 .qc_issue = opti82c46x_qc_issue_prot,
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 13a70ac6f1dc..6dd7c4ef3e66 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -103,8 +103,10 @@ static struct scsi_host_template marvell_sht = {
103 .slave_destroy = ata_scsi_slave_destroy, 103 .slave_destroy = ata_scsi_slave_destroy,
104 /* Use standard CHS mapping rules */ 104 /* Use standard CHS mapping rules */
105 .bios_param = ata_std_bios_param, 105 .bios_param = ata_std_bios_param,
106#ifdef CONFIG_PM
106 .resume = ata_scsi_device_resume, 107 .resume = ata_scsi_device_resume,
107 .suspend = ata_scsi_device_suspend, 108 .suspend = ata_scsi_device_suspend,
109#endif
108}; 110};
109 111
110static const struct ata_port_operations marvell_ops = { 112static const struct ata_port_operations marvell_ops = {
@@ -199,8 +201,10 @@ static struct pci_driver marvell_pci_driver = {
199 .id_table = marvell_pci_tbl, 201 .id_table = marvell_pci_tbl,
200 .probe = marvell_init_one, 202 .probe = marvell_init_one,
201 .remove = ata_pci_remove_one, 203 .remove = ata_pci_remove_one,
204#ifdef CONFIG_PM
202 .suspend = ata_pci_device_suspend, 205 .suspend = ata_pci_device_suspend,
203 .resume = ata_pci_device_resume, 206 .resume = ata_pci_device_resume,
207#endif
204}; 208};
205 209
206static int __init marvell_init(void) 210static int __init marvell_init(void)
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index 29e1809e5ecf..f5d88729ca79 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -280,6 +280,10 @@ 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
283}; 287};
284 288
285static struct ata_port_operations mpc52xx_ata_port_ops = { 289static struct ata_port_operations mpc52xx_ata_port_ops = {
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index f2e7115f7ab9..4abe45ac19a2 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -165,8 +165,10 @@ 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
168 .resume = ata_scsi_device_resume, 169 .resume = ata_scsi_device_resume,
169 .suspend = ata_scsi_device_suspend, 170 .suspend = ata_scsi_device_suspend,
171#endif
170}; 172};
171 173
172static struct ata_port_operations mpiix_port_ops = { 174static struct ata_port_operations mpiix_port_ops = {
@@ -270,8 +272,10 @@ static struct pci_driver mpiix_pci_driver = {
270 .id_table = mpiix, 272 .id_table = mpiix,
271 .probe = mpiix_init_one, 273 .probe = mpiix_init_one,
272 .remove = ata_pci_remove_one, 274 .remove = ata_pci_remove_one,
275#ifdef CONFIG_PM
273 .suspend = ata_pci_device_suspend, 276 .suspend = ata_pci_device_suspend,
274 .resume = ata_pci_device_resume, 277 .resume = ata_pci_device_resume,
278#endif
275}; 279};
276 280
277static int __init mpiix_init(void) 281static int __init mpiix_init(void)
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c
index e8393e19be47..38f99b38a5ea 100644
--- a/drivers/ata/pata_netcell.c
+++ b/drivers/ata/pata_netcell.c
@@ -63,8 +63,10 @@ static struct scsi_host_template netcell_sht = {
63 .slave_destroy = ata_scsi_slave_destroy, 63 .slave_destroy = ata_scsi_slave_destroy,
64 /* Use standard CHS mapping rules */ 64 /* Use standard CHS mapping rules */
65 .bios_param = ata_std_bios_param, 65 .bios_param = ata_std_bios_param,
66#ifdef CONFIG_PM
66 .resume = ata_scsi_device_resume, 67 .resume = ata_scsi_device_resume,
67 .suspend = ata_scsi_device_suspend, 68 .suspend = ata_scsi_device_suspend,
69#endif
68}; 70};
69 71
70static const struct ata_port_operations netcell_ops = { 72static const struct ata_port_operations netcell_ops = {
@@ -153,8 +155,10 @@ static struct pci_driver netcell_pci_driver = {
153 .id_table = netcell_pci_tbl, 155 .id_table = netcell_pci_tbl,
154 .probe = netcell_init_one, 156 .probe = netcell_init_one,
155 .remove = ata_pci_remove_one, 157 .remove = ata_pci_remove_one,
158#ifdef CONFIG_PM
156 .suspend = ata_pci_device_suspend, 159 .suspend = ata_pci_device_suspend,
157 .resume = ata_pci_device_resume, 160 .resume = ata_pci_device_resume,
161#endif
158}; 162};
159 163
160static int __init netcell_init(void) 164static int __init netcell_init(void)
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index 3d1fa487c486..9944a28daa9c 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -157,8 +157,10 @@ static struct scsi_host_template ns87410_sht = {
157 .slave_configure = ata_scsi_slave_config, 157 .slave_configure = ata_scsi_slave_config,
158 .slave_destroy = ata_scsi_slave_destroy, 158 .slave_destroy = ata_scsi_slave_destroy,
159 .bios_param = ata_std_bios_param, 159 .bios_param = ata_std_bios_param,
160#ifdef CONFIG_PM
160 .resume = ata_scsi_device_resume, 161 .resume = ata_scsi_device_resume,
161 .suspend = ata_scsi_device_suspend, 162 .suspend = ata_scsi_device_suspend,
163#endif
162}; 164};
163 165
164static struct ata_port_operations ns87410_port_ops = { 166static struct ata_port_operations ns87410_port_ops = {
@@ -212,8 +214,10 @@ static struct pci_driver ns87410_pci_driver = {
212 .id_table = ns87410, 214 .id_table = ns87410,
213 .probe = ns87410_init_one, 215 .probe = ns87410_init_one,
214 .remove = ata_pci_remove_one, 216 .remove = ata_pci_remove_one,
217#ifdef CONFIG_PM
215 .suspend = ata_pci_device_suspend, 218 .suspend = ata_pci_device_suspend,
216 .resume = ata_pci_device_resume, 219 .resume = ata_pci_device_resume,
220#endif
217}; 221};
218 222
219static int __init ns87410_init(void) 223static int __init ns87410_init(void)
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index 2389107a2006..da68cd19efd6 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -233,8 +233,10 @@ static struct scsi_host_template oldpiix_sht = {
233 .slave_configure = ata_scsi_slave_config, 233 .slave_configure = ata_scsi_slave_config,
234 .slave_destroy = ata_scsi_slave_destroy, 234 .slave_destroy = ata_scsi_slave_destroy,
235 .bios_param = ata_std_bios_param, 235 .bios_param = ata_std_bios_param,
236#ifdef CONFIG_PM
236 .resume = ata_scsi_device_resume, 237 .resume = ata_scsi_device_resume,
237 .suspend = ata_scsi_device_suspend, 238 .suspend = ata_scsi_device_suspend,
239#endif
238}; 240};
239 241
240static const struct ata_port_operations oldpiix_pata_ops = { 242static const struct ata_port_operations oldpiix_pata_ops = {
@@ -316,8 +318,10 @@ static struct pci_driver oldpiix_pci_driver = {
316 .id_table = oldpiix_pci_tbl, 318 .id_table = oldpiix_pci_tbl,
317 .probe = oldpiix_init_one, 319 .probe = oldpiix_init_one,
318 .remove = ata_pci_remove_one, 320 .remove = ata_pci_remove_one,
321#ifdef CONFIG_PM
319 .suspend = ata_pci_device_suspend, 322 .suspend = ata_pci_device_suspend,
320 .resume = ata_pci_device_resume, 323 .resume = ata_pci_device_resume,
324#endif
321}; 325};
322 326
323static int __init oldpiix_init(void) 327static int __init oldpiix_init(void)
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c
index 1b3cd5369f03..3fd3a35c2241 100644
--- a/drivers/ata/pata_opti.c
+++ b/drivers/ata/pata_opti.c
@@ -179,8 +179,10 @@ 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
182 .resume = ata_scsi_device_resume, 183 .resume = ata_scsi_device_resume,
183 .suspend = ata_scsi_device_suspend, 184 .suspend = ata_scsi_device_suspend,
185#endif
184}; 186};
185 187
186static struct ata_port_operations opti_port_ops = { 188static struct ata_port_operations opti_port_ops = {
@@ -244,8 +246,10 @@ static struct pci_driver opti_pci_driver = {
244 .id_table = opti, 246 .id_table = opti,
245 .probe = opti_init_one, 247 .probe = opti_init_one,
246 .remove = ata_pci_remove_one, 248 .remove = ata_pci_remove_one,
249#ifdef CONFIG_PM
247 .suspend = ata_pci_device_suspend, 250 .suspend = ata_pci_device_suspend,
248 .resume = ata_pci_device_resume, 251 .resume = ata_pci_device_resume,
252#endif
249}; 253};
250 254
251static int __init opti_init(void) 255static int __init opti_init(void)
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c
index b76c976e505c..9764907e8a13 100644
--- a/drivers/ata/pata_optidma.c
+++ b/drivers/ata/pata_optidma.c
@@ -360,8 +360,10 @@ static struct scsi_host_template optidma_sht = {
360 .slave_configure = ata_scsi_slave_config, 360 .slave_configure = ata_scsi_slave_config,
361 .slave_destroy = ata_scsi_slave_destroy, 361 .slave_destroy = ata_scsi_slave_destroy,
362 .bios_param = ata_std_bios_param, 362 .bios_param = ata_std_bios_param,
363#ifdef CONFIG_PM
363 .resume = ata_scsi_device_resume, 364 .resume = ata_scsi_device_resume,
364 .suspend = ata_scsi_device_suspend, 365 .suspend = ata_scsi_device_suspend,
366#endif
365}; 367};
366 368
367static struct ata_port_operations optidma_port_ops = { 369static struct ata_port_operations optidma_port_ops = {
@@ -524,8 +526,10 @@ static struct pci_driver optidma_pci_driver = {
524 .id_table = optidma, 526 .id_table = optidma,
525 .probe = optidma_init_one, 527 .probe = optidma_init_one,
526 .remove = ata_pci_remove_one, 528 .remove = ata_pci_remove_one,
529#ifdef CONFIG_PM
527 .suspend = ata_pci_device_suspend, 530 .suspend = ata_pci_device_suspend,
528 .resume = ata_pci_device_resume, 531 .resume = ata_pci_device_resume,
532#endif
529}; 533};
530 534
531static int __init optidma_init(void) 535static int __init optidma_init(void)
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index 80685388c2bd..3fb417780166 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -267,8 +267,10 @@ static struct scsi_host_template pdc202xx_sht = {
267 .slave_configure = ata_scsi_slave_config, 267 .slave_configure = ata_scsi_slave_config,
268 .slave_destroy = ata_scsi_slave_destroy, 268 .slave_destroy = ata_scsi_slave_destroy,
269 .bios_param = ata_std_bios_param, 269 .bios_param = ata_std_bios_param,
270#ifdef CONFIG_PM
270 .resume = ata_scsi_device_resume, 271 .resume = ata_scsi_device_resume,
271 .suspend = ata_scsi_device_suspend, 272 .suspend = ata_scsi_device_suspend,
273#endif
272}; 274};
273 275
274static struct ata_port_operations pdc2024x_port_ops = { 276static struct ata_port_operations pdc2024x_port_ops = {
@@ -399,8 +401,10 @@ static struct pci_driver pdc202xx_pci_driver = {
399 .id_table = pdc202xx, 401 .id_table = pdc202xx,
400 .probe = pdc202xx_init_one, 402 .probe = pdc202xx_init_one,
401 .remove = ata_pci_remove_one, 403 .remove = ata_pci_remove_one,
404#ifdef CONFIG_PM
402 .suspend = ata_pci_device_suspend, 405 .suspend = ata_pci_device_suspend,
403 .resume = ata_pci_device_resume, 406 .resume = ata_pci_device_resume,
407#endif
404}; 408};
405 409
406static int __init pdc202xx_init(void) 410static int __init pdc202xx_init(void)
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index c2f87da60336..c3810012f3f4 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -363,7 +363,8 @@ static __init int qdi_init(void)
363 release_region(port, 2); 363 release_region(port, 2);
364 continue; 364 continue;
365 } 365 }
366 ct += qdi_init_one(port, 6500, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04); 366 if (qdi_init_one(port, 6500, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04) == 0)
367 ct++;
367 } 368 }
368 if (((r & 0xF0) == 0xA0) || (r & 0xF0) == 0x50) { 369 if (((r & 0xF0) == 0xA0) || (r & 0xF0) == 0x50) {
369 /* QD6580: dual channel */ 370 /* QD6580: dual channel */
@@ -375,11 +376,14 @@ static __init int qdi_init(void)
375 res = inb(port + 3); 376 res = inb(port + 3);
376 if (res & 1) { 377 if (res & 1) {
377 /* Single channel mode */ 378 /* Single channel mode */
378 ct += qdi_init_one(port, 6580, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04); 379 if (qdi_init_one(port, 6580, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04))
380 ct++;
379 } else { 381 } else {
380 /* Dual channel mode */ 382 /* Dual channel mode */
381 ct += qdi_init_one(port, 6580, 0x1F0, 14, r & 0x04); 383 if (qdi_init_one(port, 6580, 0x1F0, 14, r & 0x04) == 0)
382 ct += qdi_init_one(port + 2, 6580, 0x170, 15, r & 0x04); 384 ct++;
385 if (qdi_init_one(port + 2, 6580, 0x170, 15, r & 0x04) == 0)
386 ct++;
383 } 387 }
384 } 388 }
385 } 389 }
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c
index 0d1e571ef633..9a9132c9e331 100644
--- a/drivers/ata/pata_radisys.c
+++ b/drivers/ata/pata_radisys.c
@@ -228,8 +228,10 @@ static struct scsi_host_template radisys_sht = {
228 .slave_configure = ata_scsi_slave_config, 228 .slave_configure = ata_scsi_slave_config,
229 .slave_destroy = ata_scsi_slave_destroy, 229 .slave_destroy = ata_scsi_slave_destroy,
230 .bios_param = ata_std_bios_param, 230 .bios_param = ata_std_bios_param,
231#ifdef CONFIG_PM
231 .resume = ata_scsi_device_resume, 232 .resume = ata_scsi_device_resume,
232 .suspend = ata_scsi_device_suspend, 233 .suspend = ata_scsi_device_suspend,
234#endif
233}; 235};
234 236
235static const struct ata_port_operations radisys_pata_ops = { 237static const struct ata_port_operations radisys_pata_ops = {
@@ -312,8 +314,10 @@ static struct pci_driver radisys_pci_driver = {
312 .id_table = radisys_pci_tbl, 314 .id_table = radisys_pci_tbl,
313 .probe = radisys_init_one, 315 .probe = radisys_init_one,
314 .remove = ata_pci_remove_one, 316 .remove = ata_pci_remove_one,
317#ifdef CONFIG_PM
315 .suspend = ata_pci_device_suspend, 318 .suspend = ata_pci_device_suspend,
316 .resume = ata_pci_device_resume, 319 .resume = ata_pci_device_resume,
320#endif
317}; 321};
318 322
319static int __init radisys_init(void) 323static int __init radisys_init(void)
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c
index 60fc598f765d..f522daa2a6aa 100644
--- a/drivers/ata/pata_rz1000.c
+++ b/drivers/ata/pata_rz1000.c
@@ -94,8 +94,10 @@ static struct scsi_host_template rz1000_sht = {
94 .slave_configure = ata_scsi_slave_config, 94 .slave_configure = ata_scsi_slave_config,
95 .slave_destroy = ata_scsi_slave_destroy, 95 .slave_destroy = ata_scsi_slave_destroy,
96 .bios_param = ata_std_bios_param, 96 .bios_param = ata_std_bios_param,
97#ifdef CONFIG_PM
97 .resume = ata_scsi_device_resume, 98 .resume = ata_scsi_device_resume,
98 .suspend = ata_scsi_device_suspend, 99 .suspend = ata_scsi_device_suspend,
100#endif
99}; 101};
100 102
101static struct ata_port_operations rz1000_port_ops = { 103static struct ata_port_operations rz1000_port_ops = {
@@ -178,6 +180,7 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en
178 return -ENODEV; 180 return -ENODEV;
179} 181}
180 182
183#ifdef CONFIG_PM
181static int rz1000_reinit_one(struct pci_dev *pdev) 184static int rz1000_reinit_one(struct pci_dev *pdev)
182{ 185{
183 /* If this fails on resume (which is a "cant happen" case), we 186 /* If this fails on resume (which is a "cant happen" case), we
@@ -186,6 +189,7 @@ static int rz1000_reinit_one(struct pci_dev *pdev)
186 panic("rz1000 fifo"); 189 panic("rz1000 fifo");
187 return ata_pci_device_resume(pdev); 190 return ata_pci_device_resume(pdev);
188} 191}
192#endif
189 193
190static const struct pci_device_id pata_rz1000[] = { 194static const struct pci_device_id pata_rz1000[] = {
191 { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), }, 195 { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), },
@@ -199,8 +203,10 @@ static struct pci_driver rz1000_pci_driver = {
199 .id_table = pata_rz1000, 203 .id_table = pata_rz1000,
200 .probe = rz1000_init_one, 204 .probe = rz1000_init_one,
201 .remove = ata_pci_remove_one, 205 .remove = ata_pci_remove_one,
206#ifdef CONFIG_PM
202 .suspend = ata_pci_device_suspend, 207 .suspend = ata_pci_device_suspend,
203 .resume = rz1000_reinit_one, 208 .resume = rz1000_reinit_one,
209#endif
204}; 210};
205 211
206static int __init rz1000_init(void) 212static int __init rz1000_init(void)
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index 58e42fbd14f9..93b3ed0f9e8a 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -194,8 +194,10 @@ 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
197 .resume = ata_scsi_device_resume, 198 .resume = ata_scsi_device_resume,
198 .suspend = ata_scsi_device_suspend, 199 .suspend = ata_scsi_device_suspend,
200#endif
199}; 201};
200 202
201static struct ata_port_operations sc1200_port_ops = { 203static struct ata_port_operations sc1200_port_ops = {
@@ -210,7 +212,10 @@ static struct ata_port_operations sc1200_port_ops = {
210 .exec_command = ata_exec_command, 212 .exec_command = ata_exec_command,
211 .dev_select = ata_std_dev_select, 213 .dev_select = ata_std_dev_select,
212 214
215 .freeze = ata_bmdma_freeze,
216 .thaw = ata_bmdma_thaw,
213 .error_handler = ata_bmdma_error_handler, 217 .error_handler = ata_bmdma_error_handler,
218 .post_internal_cmd = ata_bmdma_post_internal_cmd,
214 219
215 .bmdma_setup = ata_bmdma_setup, 220 .bmdma_setup = ata_bmdma_setup,
216 .bmdma_start = ata_bmdma_start, 221 .bmdma_start = ata_bmdma_start,
@@ -266,8 +271,10 @@ static struct pci_driver sc1200_pci_driver = {
266 .id_table = sc1200, 271 .id_table = sc1200,
267 .probe = sc1200_init_one, 272 .probe = sc1200_init_one,
268 .remove = ata_pci_remove_one, 273 .remove = ata_pci_remove_one,
274#ifdef CONFIG_PM
269 .suspend = ata_pci_device_suspend, 275 .suspend = ata_pci_device_suspend,
270 .resume = ata_pci_device_resume, 276 .resume = ata_pci_device_resume,
277#endif
271}; 278};
272 279
273static int __init sc1200_init(void) 280static int __init sc1200_init(void)
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 45866098fbf9..f3ed141fdc0e 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -984,8 +984,10 @@ 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
987 .resume = ata_scsi_device_resume, 988 .resume = ata_scsi_device_resume,
988 .suspend = ata_scsi_device_suspend, 989 .suspend = ata_scsi_device_suspend,
990#endif
989}; 991};
990 992
991static const struct ata_port_operations scc_pata_ops = { 993static const struct ata_port_operations scc_pata_ops = {
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index dde7eb9f72bb..598eef810a74 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -319,8 +319,10 @@ static struct scsi_host_template serverworks_sht = {
319 .slave_configure = ata_scsi_slave_config, 319 .slave_configure = ata_scsi_slave_config,
320 .slave_destroy = ata_scsi_slave_destroy, 320 .slave_destroy = ata_scsi_slave_destroy,
321 .bios_param = ata_std_bios_param, 321 .bios_param = ata_std_bios_param,
322#ifdef CONFIG_PM
322 .resume = ata_scsi_device_resume, 323 .resume = ata_scsi_device_resume,
323 .suspend = ata_scsi_device_suspend, 324 .suspend = ata_scsi_device_suspend,
325#endif
324}; 326};
325 327
326static struct ata_port_operations serverworks_osb4_port_ops = { 328static struct ata_port_operations serverworks_osb4_port_ops = {
@@ -548,6 +550,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
548 return ata_pci_init_one(pdev, port_info, ports); 550 return ata_pci_init_one(pdev, port_info, ports);
549} 551}
550 552
553#ifdef CONFIG_PM
551static int serverworks_reinit_one(struct pci_dev *pdev) 554static int serverworks_reinit_one(struct pci_dev *pdev)
552{ 555{
553 /* Force master latency timer to 64 PCI clocks */ 556 /* Force master latency timer to 64 PCI clocks */
@@ -571,6 +574,7 @@ static int serverworks_reinit_one(struct pci_dev *pdev)
571 } 574 }
572 return ata_pci_device_resume(pdev); 575 return ata_pci_device_resume(pdev);
573} 576}
577#endif
574 578
575static const struct pci_device_id serverworks[] = { 579static const struct pci_device_id serverworks[] = {
576 { PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0}, 580 { PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0},
@@ -587,8 +591,10 @@ static struct pci_driver serverworks_pci_driver = {
587 .id_table = serverworks, 591 .id_table = serverworks,
588 .probe = serverworks_init_one, 592 .probe = serverworks_init_one,
589 .remove = ata_pci_remove_one, 593 .remove = ata_pci_remove_one,
594#ifdef CONFIG_PM
590 .suspend = ata_pci_device_suspend, 595 .suspend = ata_pci_device_suspend,
591 .resume = serverworks_reinit_one, 596 .resume = serverworks_reinit_one,
597#endif
592}; 598};
593 599
594static int __init serverworks_init(void) 600static int __init serverworks_init(void)
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 1cb67b221c28..dab2889a556f 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -236,6 +236,10 @@ static struct scsi_host_template sil680_sht = {
236 .slave_configure = ata_scsi_slave_config, 236 .slave_configure = ata_scsi_slave_config,
237 .slave_destroy = ata_scsi_slave_destroy, 237 .slave_destroy = ata_scsi_slave_destroy,
238 .bios_param = ata_std_bios_param, 238 .bios_param = ata_std_bios_param,
239#ifdef CONFIG_PM
240 .suspend = ata_scsi_device_suspend,
241 .resume = ata_scsi_device_resume,
242#endif
239}; 243};
240 244
241static struct ata_port_operations sil680_port_ops = { 245static struct ata_port_operations sil680_port_ops = {
@@ -377,11 +381,13 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
377 return ata_pci_init_one(pdev, port_info, 2); 381 return ata_pci_init_one(pdev, port_info, 2);
378} 382}
379 383
384#ifdef CONFIG_PM
380static int sil680_reinit_one(struct pci_dev *pdev) 385static int sil680_reinit_one(struct pci_dev *pdev)
381{ 386{
382 sil680_init_chip(pdev); 387 sil680_init_chip(pdev);
383 return ata_pci_device_resume(pdev); 388 return ata_pci_device_resume(pdev);
384} 389}
390#endif
385 391
386static const struct pci_device_id sil680[] = { 392static const struct pci_device_id sil680[] = {
387 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), }, 393 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), },
@@ -394,8 +400,10 @@ static struct pci_driver sil680_pci_driver = {
394 .id_table = sil680, 400 .id_table = sil680,
395 .probe = sil680_init_one, 401 .probe = sil680_init_one,
396 .remove = ata_pci_remove_one, 402 .remove = ata_pci_remove_one,
403#ifdef CONFIG_PM
397 .suspend = ata_pci_device_suspend, 404 .suspend = ata_pci_device_suspend,
398 .resume = sil680_reinit_one, 405 .resume = sil680_reinit_one,
406#endif
399}; 407};
400 408
401static int __init sil680_init(void) 409static int __init sil680_init(void)
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index be300923b27e..f48207865930 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -575,8 +575,10 @@ static struct scsi_host_template sis_sht = {
575 .slave_configure = ata_scsi_slave_config, 575 .slave_configure = ata_scsi_slave_config,
576 .slave_destroy = ata_scsi_slave_destroy, 576 .slave_destroy = ata_scsi_slave_destroy,
577 .bios_param = ata_std_bios_param, 577 .bios_param = ata_std_bios_param,
578#ifdef CONFIG_PM
578 .resume = ata_scsi_device_resume, 579 .resume = ata_scsi_device_resume,
579 .suspend = ata_scsi_device_suspend, 580 .suspend = ata_scsi_device_suspend,
581#endif
580}; 582};
581 583
582static const struct ata_port_operations sis_133_ops = { 584static const struct ata_port_operations sis_133_ops = {
@@ -1032,8 +1034,10 @@ static struct pci_driver sis_pci_driver = {
1032 .id_table = sis_pci_tbl, 1034 .id_table = sis_pci_tbl,
1033 .probe = sis_init_one, 1035 .probe = sis_init_one,
1034 .remove = ata_pci_remove_one, 1036 .remove = ata_pci_remove_one,
1037#ifdef CONFIG_PM
1035 .suspend = ata_pci_device_suspend, 1038 .suspend = ata_pci_device_suspend,
1036 .resume = ata_pci_device_resume, 1039 .resume = ata_pci_device_resume,
1040#endif
1037}; 1041};
1038 1042
1039static int __init sis_init(void) 1043static int __init sis_init(void)
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index 13e81f0ef1f7..b681441cfcb9 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -234,7 +234,10 @@ static struct ata_port_operations sl82c105_port_ops = {
234 .exec_command = ata_exec_command, 234 .exec_command = ata_exec_command,
235 .dev_select = ata_std_dev_select, 235 .dev_select = ata_std_dev_select,
236 236
237 .freeze = ata_bmdma_freeze,
238 .thaw = ata_bmdma_thaw,
237 .error_handler = sl82c105_error_handler, 239 .error_handler = sl82c105_error_handler,
240 .post_internal_cmd = ata_bmdma_post_internal_cmd,
238 241
239 .bmdma_setup = ata_bmdma_setup, 242 .bmdma_setup = ata_bmdma_setup,
240 .bmdma_start = sl82c105_bmdma_start, 243 .bmdma_start = sl82c105_bmdma_start,
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c
index 453ab90b721e..71418f2a0cdb 100644
--- a/drivers/ata/pata_triflex.c
+++ b/drivers/ata/pata_triflex.c
@@ -193,8 +193,10 @@ static struct scsi_host_template triflex_sht = {
193 .slave_configure = ata_scsi_slave_config, 193 .slave_configure = ata_scsi_slave_config,
194 .slave_destroy = ata_scsi_slave_destroy, 194 .slave_destroy = ata_scsi_slave_destroy,
195 .bios_param = ata_std_bios_param, 195 .bios_param = ata_std_bios_param,
196#ifdef CONFIG_PM
196 .resume = ata_scsi_device_resume, 197 .resume = ata_scsi_device_resume,
197 .suspend = ata_scsi_device_suspend, 198 .suspend = ata_scsi_device_suspend,
199#endif
198}; 200};
199 201
200static struct ata_port_operations triflex_port_ops = { 202static struct ata_port_operations triflex_port_ops = {
@@ -260,8 +262,10 @@ static struct pci_driver triflex_pci_driver = {
260 .id_table = triflex, 262 .id_table = triflex,
261 .probe = triflex_init_one, 263 .probe = triflex_init_one,
262 .remove = ata_pci_remove_one, 264 .remove = ata_pci_remove_one,
265#ifdef CONFIG_PM
263 .suspend = ata_pci_device_suspend, 266 .suspend = ata_pci_device_suspend,
264 .resume = ata_pci_device_resume, 267 .resume = ata_pci_device_resume,
268#endif
265}; 269};
266 270
267static int __init triflex_init(void) 271static int __init triflex_init(void)
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 20fc2d0dcfa1..946ade0e1f1b 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -305,8 +305,10 @@ static struct scsi_host_template via_sht = {
305 .slave_configure = ata_scsi_slave_config, 305 .slave_configure = ata_scsi_slave_config,
306 .slave_destroy = ata_scsi_slave_destroy, 306 .slave_destroy = ata_scsi_slave_destroy,
307 .bios_param = ata_std_bios_param, 307 .bios_param = ata_std_bios_param,
308#ifdef CONFIG_PM
308 .resume = ata_scsi_device_resume, 309 .resume = ata_scsi_device_resume,
309 .suspend = ata_scsi_device_suspend, 310 .suspend = ata_scsi_device_suspend,
311#endif
310}; 312};
311 313
312static struct ata_port_operations via_port_ops = { 314static struct ata_port_operations via_port_ops = {
@@ -560,6 +562,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
560 return ata_pci_init_one(pdev, port_info, 2); 562 return ata_pci_init_one(pdev, port_info, 2);
561} 563}
562 564
565#ifdef CONFIG_PM
563/** 566/**
564 * via_reinit_one - reinit after resume 567 * via_reinit_one - reinit after resume
565 * @pdev; PCI device 568 * @pdev; PCI device
@@ -592,6 +595,7 @@ static int via_reinit_one(struct pci_dev *pdev)
592 } 595 }
593 return ata_pci_device_resume(pdev); 596 return ata_pci_device_resume(pdev);
594} 597}
598#endif
595 599
596static const struct pci_device_id via[] = { 600static const struct pci_device_id via[] = {
597 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C576_1), }, 601 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C576_1), },
@@ -607,8 +611,10 @@ static struct pci_driver via_pci_driver = {
607 .id_table = via, 611 .id_table = via,
608 .probe = via_init_one, 612 .probe = via_init_one,
609 .remove = ata_pci_remove_one, 613 .remove = ata_pci_remove_one,
614#ifdef CONFIG_PM
610 .suspend = ata_pci_device_suspend, 615 .suspend = ata_pci_device_suspend,
611 .resume = via_reinit_one, 616 .resume = via_reinit_one,
617#endif
612}; 618};
613 619
614static int __init via_init(void) 620static int __init via_init(void)
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 31b636fac98e..3193a603d1a1 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -135,8 +135,10 @@ 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
138 .suspend = ata_scsi_device_suspend, 139 .suspend = ata_scsi_device_suspend,
139 .resume = ata_scsi_device_resume, 140 .resume = ata_scsi_device_resume,
141#endif
140}; 142};
141 143
142static const int scr_map[] = { 144static const int scr_map[] = {
@@ -632,6 +634,7 @@ static int init_controller(void __iomem *mmio_base, u16 hctl)
632 return 0; 634 return 0;
633} 635}
634 636
637#ifdef CONFIG_PM
635static int inic_pci_device_resume(struct pci_dev *pdev) 638static int inic_pci_device_resume(struct pci_dev *pdev)
636{ 639{
637 struct ata_host *host = dev_get_drvdata(&pdev->dev); 640 struct ata_host *host = dev_get_drvdata(&pdev->dev);
@@ -642,7 +645,6 @@ static int inic_pci_device_resume(struct pci_dev *pdev)
642 ata_pci_device_do_resume(pdev); 645 ata_pci_device_do_resume(pdev);
643 646
644 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { 647 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
645 printk("XXX\n");
646 rc = init_controller(mmio_base, hpriv->cached_hctl); 648 rc = init_controller(mmio_base, hpriv->cached_hctl);
647 if (rc) 649 if (rc)
648 return rc; 650 return rc;
@@ -652,6 +654,7 @@ static int inic_pci_device_resume(struct pci_dev *pdev)
652 654
653 return 0; 655 return 0;
654} 656}
657#endif
655 658
656static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 659static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
657{ 660{
@@ -755,8 +758,10 @@ static const struct pci_device_id inic_pci_tbl[] = {
755static struct pci_driver inic_pci_driver = { 758static struct pci_driver inic_pci_driver = {
756 .name = DRV_NAME, 759 .name = DRV_NAME,
757 .id_table = inic_pci_tbl, 760 .id_table = inic_pci_tbl,
761#ifdef CONFIG_PM
758 .suspend = ata_pci_device_suspend, 762 .suspend = ata_pci_device_suspend,
759 .resume = inic_pci_device_resume, 763 .resume = inic_pci_device_resume,
764#endif
760 .probe = inic_init_one, 765 .probe = inic_init_one,
761 .remove = ata_pci_remove_one, 766 .remove = ata_pci_remove_one,
762}; 767};
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 30eed12b3631..388d07fab5f7 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -230,7 +230,9 @@ struct nv_host_priv {
230 230
231static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 231static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
232static void nv_remove_one (struct pci_dev *pdev); 232static void nv_remove_one (struct pci_dev *pdev);
233#ifdef CONFIG_PM
233static int nv_pci_device_resume(struct pci_dev *pdev); 234static int nv_pci_device_resume(struct pci_dev *pdev);
235#endif
234static void nv_ck804_host_stop(struct ata_host *host); 236static void nv_ck804_host_stop(struct ata_host *host);
235static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance); 237static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance);
236static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance); 238static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance);
@@ -251,8 +253,10 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance);
251static void nv_adma_irq_clear(struct ata_port *ap); 253static void nv_adma_irq_clear(struct ata_port *ap);
252static int nv_adma_port_start(struct ata_port *ap); 254static int nv_adma_port_start(struct ata_port *ap);
253static void nv_adma_port_stop(struct ata_port *ap); 255static void nv_adma_port_stop(struct ata_port *ap);
256#ifdef CONFIG_PM
254static int nv_adma_port_suspend(struct ata_port *ap, pm_message_t mesg); 257static int nv_adma_port_suspend(struct ata_port *ap, pm_message_t mesg);
255static int nv_adma_port_resume(struct ata_port *ap); 258static int nv_adma_port_resume(struct ata_port *ap);
259#endif
256static void nv_adma_error_handler(struct ata_port *ap); 260static void nv_adma_error_handler(struct ata_port *ap);
257static void nv_adma_host_stop(struct ata_host *host); 261static void nv_adma_host_stop(struct ata_host *host);
258static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc); 262static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc);
@@ -295,8 +299,10 @@ static struct pci_driver nv_pci_driver = {
295 .name = DRV_NAME, 299 .name = DRV_NAME,
296 .id_table = nv_pci_tbl, 300 .id_table = nv_pci_tbl,
297 .probe = nv_init_one, 301 .probe = nv_init_one,
302#ifdef CONFIG_PM
298 .suspend = ata_pci_device_suspend, 303 .suspend = ata_pci_device_suspend,
299 .resume = nv_pci_device_resume, 304 .resume = nv_pci_device_resume,
305#endif
300 .remove = nv_remove_one, 306 .remove = nv_remove_one,
301}; 307};
302 308
@@ -316,8 +322,10 @@ static struct scsi_host_template nv_sht = {
316 .slave_configure = ata_scsi_slave_config, 322 .slave_configure = ata_scsi_slave_config,
317 .slave_destroy = ata_scsi_slave_destroy, 323 .slave_destroy = ata_scsi_slave_destroy,
318 .bios_param = ata_std_bios_param, 324 .bios_param = ata_std_bios_param,
325#ifdef CONFIG_PM
319 .suspend = ata_scsi_device_suspend, 326 .suspend = ata_scsi_device_suspend,
320 .resume = ata_scsi_device_resume, 327 .resume = ata_scsi_device_resume,
328#endif
321}; 329};
322 330
323static struct scsi_host_template nv_adma_sht = { 331static struct scsi_host_template nv_adma_sht = {
@@ -336,8 +344,10 @@ static struct scsi_host_template nv_adma_sht = {
336 .slave_configure = nv_adma_slave_config, 344 .slave_configure = nv_adma_slave_config,
337 .slave_destroy = ata_scsi_slave_destroy, 345 .slave_destroy = ata_scsi_slave_destroy,
338 .bios_param = ata_std_bios_param, 346 .bios_param = ata_std_bios_param,
347#ifdef CONFIG_PM
339 .suspend = ata_scsi_device_suspend, 348 .suspend = ata_scsi_device_suspend,
340 .resume = ata_scsi_device_resume, 349 .resume = ata_scsi_device_resume,
350#endif
341}; 351};
342 352
343static const struct ata_port_operations nv_generic_ops = { 353static const struct ata_port_operations nv_generic_ops = {
@@ -449,8 +459,10 @@ static const struct ata_port_operations nv_adma_ops = {
449 .scr_write = nv_scr_write, 459 .scr_write = nv_scr_write,
450 .port_start = nv_adma_port_start, 460 .port_start = nv_adma_port_start,
451 .port_stop = nv_adma_port_stop, 461 .port_stop = nv_adma_port_stop,
462#ifdef CONFIG_PM
452 .port_suspend = nv_adma_port_suspend, 463 .port_suspend = nv_adma_port_suspend,
453 .port_resume = nv_adma_port_resume, 464 .port_resume = nv_adma_port_resume,
465#endif
454 .host_stop = nv_adma_host_stop, 466 .host_stop = nv_adma_host_stop,
455}; 467};
456 468
@@ -1003,6 +1015,7 @@ static void nv_adma_port_stop(struct ata_port *ap)
1003 writew(0, mmio + NV_ADMA_CTL); 1015 writew(0, mmio + NV_ADMA_CTL);
1004} 1016}
1005 1017
1018#ifdef CONFIG_PM
1006static int nv_adma_port_suspend(struct ata_port *ap, pm_message_t mesg) 1019static int nv_adma_port_suspend(struct ata_port *ap, pm_message_t mesg)
1007{ 1020{
1008 struct nv_adma_port_priv *pp = ap->private_data; 1021 struct nv_adma_port_priv *pp = ap->private_data;
@@ -1053,6 +1066,7 @@ static int nv_adma_port_resume(struct ata_port *ap)
1053 1066
1054 return 0; 1067 return 0;
1055} 1068}
1069#endif
1056 1070
1057static void nv_adma_setup_port(struct ata_probe_ent *probe_ent, unsigned int port) 1071static void nv_adma_setup_port(struct ata_probe_ent *probe_ent, unsigned int port)
1058{ 1072{
@@ -1555,6 +1569,7 @@ static void nv_remove_one (struct pci_dev *pdev)
1555 kfree(hpriv); 1569 kfree(hpriv);
1556} 1570}
1557 1571
1572#ifdef CONFIG_PM
1558static int nv_pci_device_resume(struct pci_dev *pdev) 1573static int nv_pci_device_resume(struct pci_dev *pdev)
1559{ 1574{
1560 struct ata_host *host = dev_get_drvdata(&pdev->dev); 1575 struct ata_host *host = dev_get_drvdata(&pdev->dev);
@@ -1602,6 +1617,7 @@ static int nv_pci_device_resume(struct pci_dev *pdev)
1602 1617
1603 return 0; 1618 return 0;
1604} 1619}
1620#endif
1605 1621
1606static void nv_ck804_host_stop(struct ata_host *host) 1622static void nv_ck804_host_stop(struct ata_host *host)
1607{ 1623{
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index f7179c646bef..917b7ea4ef7c 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -183,8 +183,10 @@ static struct scsi_host_template sil_sht = {
183 .slave_configure = ata_scsi_slave_config, 183 .slave_configure = ata_scsi_slave_config,
184 .slave_destroy = ata_scsi_slave_destroy, 184 .slave_destroy = ata_scsi_slave_destroy,
185 .bios_param = ata_std_bios_param, 185 .bios_param = ata_std_bios_param,
186#ifdef CONFIG_PM
186 .suspend = ata_scsi_device_suspend, 187 .suspend = ata_scsi_device_suspend,
187 .resume = ata_scsi_device_resume, 188 .resume = ata_scsi_device_resume,
189#endif
188}; 190};
189 191
190static const struct ata_port_operations sil_ops = { 192static const struct ata_port_operations sil_ops = {
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index b1bab82b16de..75d961599651 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -380,8 +380,10 @@ 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
383 .suspend = ata_scsi_device_suspend, 384 .suspend = ata_scsi_device_suspend,
384 .resume = ata_scsi_device_resume, 385 .resume = ata_scsi_device_resume,
386#endif
385}; 387};
386 388
387static const struct ata_port_operations sil24_ops = { 389static const struct ata_port_operations sil24_ops = {