diff options
author | Tejun Heo <htejun@gmail.com> | 2007-03-02 03:32:47 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-03-02 18:30:35 -0500 |
commit | 6ffa01d88c9dd45e2ed917b5eeeb494d07efb1ab (patch) | |
tree | 3fe262ccaa1c0f8c5e5d187216d8bfc70db34d95 /drivers/ata | |
parent | 438ac6d5e3f8106a6bd1a5682c508d660294a85d (diff) |
libata: add CONFIG_PM to libata core layer
Conditionalize all PM related stuff in libata core layer using
CONFIG_PM.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 11 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 29 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 2 |
3 files changed, 42 insertions, 0 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 606145eeba44..dc362fa01ca4 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -5354,6 +5354,7 @@ int ata_flush_cache(struct ata_device *dev) | |||
5354 | return 0; | 5354 | return 0; |
5355 | } | 5355 | } |
5356 | 5356 | ||
5357 | #ifdef CONFIG_PM | ||
5357 | static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, | 5358 | static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, |
5358 | unsigned int action, unsigned int ehi_flags, | 5359 | unsigned int action, unsigned int ehi_flags, |
5359 | int wait) | 5360 | int wait) |
@@ -5469,6 +5470,7 @@ void ata_host_resume(struct ata_host *host) | |||
5469 | ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); | 5470 | ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); |
5470 | host->dev->power.power_state = PMSG_ON; | 5471 | host->dev->power.power_state = PMSG_ON; |
5471 | } | 5472 | } |
5473 | #endif | ||
5472 | 5474 | ||
5473 | /** | 5475 | /** |
5474 | * ata_port_start - Set port up for dma. | 5476 | * ata_port_start - Set port up for dma. |
@@ -6104,6 +6106,7 @@ int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits) | |||
6104 | return (tmp == bits->val) ? 1 : 0; | 6106 | return (tmp == bits->val) ? 1 : 0; |
6105 | } | 6107 | } |
6106 | 6108 | ||
6109 | #ifdef CONFIG_PM | ||
6107 | void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg) | 6110 | void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg) |
6108 | { | 6111 | { |
6109 | pci_save_state(pdev); | 6112 | pci_save_state(pdev); |
@@ -6155,6 +6158,8 @@ int ata_pci_device_resume(struct pci_dev *pdev) | |||
6155 | ata_host_resume(host); | 6158 | ata_host_resume(host); |
6156 | return rc; | 6159 | return rc; |
6157 | } | 6160 | } |
6161 | #endif /* CONFIG_PM */ | ||
6162 | |||
6158 | #endif /* CONFIG_PCI */ | 6163 | #endif /* CONFIG_PCI */ |
6159 | 6164 | ||
6160 | 6165 | ||
@@ -6363,8 +6368,10 @@ EXPORT_SYMBOL_GPL(sata_scr_write); | |||
6363 | EXPORT_SYMBOL_GPL(sata_scr_write_flush); | 6368 | EXPORT_SYMBOL_GPL(sata_scr_write_flush); |
6364 | EXPORT_SYMBOL_GPL(ata_port_online); | 6369 | EXPORT_SYMBOL_GPL(ata_port_online); |
6365 | EXPORT_SYMBOL_GPL(ata_port_offline); | 6370 | EXPORT_SYMBOL_GPL(ata_port_offline); |
6371 | #ifdef CONFIG_PM | ||
6366 | EXPORT_SYMBOL_GPL(ata_host_suspend); | 6372 | EXPORT_SYMBOL_GPL(ata_host_suspend); |
6367 | EXPORT_SYMBOL_GPL(ata_host_resume); | 6373 | EXPORT_SYMBOL_GPL(ata_host_resume); |
6374 | #endif /* CONFIG_PM */ | ||
6368 | EXPORT_SYMBOL_GPL(ata_id_string); | 6375 | EXPORT_SYMBOL_GPL(ata_id_string); |
6369 | EXPORT_SYMBOL_GPL(ata_id_c_string); | 6376 | EXPORT_SYMBOL_GPL(ata_id_c_string); |
6370 | EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); | 6377 | EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); |
@@ -6380,16 +6387,20 @@ EXPORT_SYMBOL_GPL(pci_test_config_bits); | |||
6380 | EXPORT_SYMBOL_GPL(ata_pci_init_native_mode); | 6387 | EXPORT_SYMBOL_GPL(ata_pci_init_native_mode); |
6381 | EXPORT_SYMBOL_GPL(ata_pci_init_one); | 6388 | EXPORT_SYMBOL_GPL(ata_pci_init_one); |
6382 | EXPORT_SYMBOL_GPL(ata_pci_remove_one); | 6389 | EXPORT_SYMBOL_GPL(ata_pci_remove_one); |
6390 | #ifdef CONFIG_PM | ||
6383 | EXPORT_SYMBOL_GPL(ata_pci_device_do_suspend); | 6391 | EXPORT_SYMBOL_GPL(ata_pci_device_do_suspend); |
6384 | EXPORT_SYMBOL_GPL(ata_pci_device_do_resume); | 6392 | EXPORT_SYMBOL_GPL(ata_pci_device_do_resume); |
6385 | EXPORT_SYMBOL_GPL(ata_pci_device_suspend); | 6393 | EXPORT_SYMBOL_GPL(ata_pci_device_suspend); |
6386 | EXPORT_SYMBOL_GPL(ata_pci_device_resume); | 6394 | EXPORT_SYMBOL_GPL(ata_pci_device_resume); |
6395 | #endif /* CONFIG_PM */ | ||
6387 | EXPORT_SYMBOL_GPL(ata_pci_default_filter); | 6396 | EXPORT_SYMBOL_GPL(ata_pci_default_filter); |
6388 | EXPORT_SYMBOL_GPL(ata_pci_clear_simplex); | 6397 | EXPORT_SYMBOL_GPL(ata_pci_clear_simplex); |
6389 | #endif /* CONFIG_PCI */ | 6398 | #endif /* CONFIG_PCI */ |
6390 | 6399 | ||
6400 | #ifdef CONFIG_PM | ||
6391 | EXPORT_SYMBOL_GPL(ata_scsi_device_suspend); | 6401 | EXPORT_SYMBOL_GPL(ata_scsi_device_suspend); |
6392 | EXPORT_SYMBOL_GPL(ata_scsi_device_resume); | 6402 | EXPORT_SYMBOL_GPL(ata_scsi_device_resume); |
6403 | #endif /* CONFIG_PM */ | ||
6393 | 6404 | ||
6394 | EXPORT_SYMBOL_GPL(ata_eng_timeout); | 6405 | EXPORT_SYMBOL_GPL(ata_eng_timeout); |
6395 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); | 6406 | EXPORT_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 | ||
53 | static void __ata_port_freeze(struct ata_port *ap); | 53 | static void __ata_port_freeze(struct ata_port *ap); |
54 | static void ata_eh_finish(struct ata_port *ap); | 54 | static void ata_eh_finish(struct ata_port *ap); |
55 | #ifdef CONFIG_PM | ||
55 | static void ata_eh_handle_port_suspend(struct ata_port *ap); | 56 | static void ata_eh_handle_port_suspend(struct ata_port *ap); |
56 | static void ata_eh_handle_port_resume(struct ata_port *ap); | 57 | static void ata_eh_handle_port_resume(struct ata_port *ap); |
58 | static int ata_eh_suspend(struct ata_port *ap, | ||
59 | struct ata_device **r_failed_dev); | ||
60 | static void ata_eh_prep_resume(struct ata_port *ap); | ||
61 | static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev); | ||
62 | #else /* CONFIG_PM */ | ||
63 | static void ata_eh_handle_port_suspend(struct ata_port *ap) | ||
64 | { } | ||
65 | |||
66 | static void ata_eh_handle_port_resume(struct ata_port *ap) | ||
67 | { } | ||
68 | |||
69 | static int ata_eh_suspend(struct ata_port *ap, struct ata_device **r_failed_dev) | ||
70 | { | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static void ata_eh_prep_resume(struct ata_port *ap) | ||
75 | { } | ||
76 | |||
77 | static 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 | ||
58 | static void ata_ering_record(struct ata_ering *ering, int is_io, | 83 | static 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 | ||
1951 | static int ata_port_nr_enabled(struct ata_port *ap) | 1978 | static 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 |