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>

authored by Tejun Heo and committed by Jeff Garzik 6ffa01d8 438ac6d5

+46
+11
drivers/ata/libata-core.c
··· 5354 5354 return 0; 5355 5355 } 5356 5356 5357 + #ifdef CONFIG_PM 5357 5358 static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, 5358 5359 unsigned int action, unsigned int ehi_flags, 5359 5360 int wait) ··· 5470 5469 ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); 5471 5470 host->dev->power.power_state = PMSG_ON; 5472 5471 } 5472 + #endif 5473 5473 5474 5474 /** 5475 5475 * ata_port_start - Set port up for dma. ··· 6106 6104 return (tmp == bits->val) ? 1 : 0; 6107 6105 } 6108 6106 6107 + #ifdef CONFIG_PM 6109 6108 void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg) 6110 6109 { 6111 6110 pci_save_state(pdev); ··· 6158 6155 ata_host_resume(host); 6159 6156 return rc; 6160 6157 } 6158 + #endif /* CONFIG_PM */ 6159 + 6161 6160 #endif /* CONFIG_PCI */ 6162 6161 6163 6162 ··· 6368 6363 EXPORT_SYMBOL_GPL(sata_scr_write_flush); 6369 6364 EXPORT_SYMBOL_GPL(ata_port_online); 6370 6365 EXPORT_SYMBOL_GPL(ata_port_offline); 6366 + #ifdef CONFIG_PM 6371 6367 EXPORT_SYMBOL_GPL(ata_host_suspend); 6372 6368 EXPORT_SYMBOL_GPL(ata_host_resume); 6369 + #endif /* CONFIG_PM */ 6373 6370 EXPORT_SYMBOL_GPL(ata_id_string); 6374 6371 EXPORT_SYMBOL_GPL(ata_id_c_string); 6375 6372 EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); ··· 6387 6380 EXPORT_SYMBOL_GPL(ata_pci_init_native_mode); 6388 6381 EXPORT_SYMBOL_GPL(ata_pci_init_one); 6389 6382 EXPORT_SYMBOL_GPL(ata_pci_remove_one); 6383 + #ifdef CONFIG_PM 6390 6384 EXPORT_SYMBOL_GPL(ata_pci_device_do_suspend); 6391 6385 EXPORT_SYMBOL_GPL(ata_pci_device_do_resume); 6392 6386 EXPORT_SYMBOL_GPL(ata_pci_device_suspend); 6393 6387 EXPORT_SYMBOL_GPL(ata_pci_device_resume); 6388 + #endif /* CONFIG_PM */ 6394 6389 EXPORT_SYMBOL_GPL(ata_pci_default_filter); 6395 6390 EXPORT_SYMBOL_GPL(ata_pci_clear_simplex); 6396 6391 #endif /* CONFIG_PCI */ 6397 6392 6393 + #ifdef CONFIG_PM 6398 6394 EXPORT_SYMBOL_GPL(ata_scsi_device_suspend); 6399 6395 EXPORT_SYMBOL_GPL(ata_scsi_device_resume); 6396 + #endif /* CONFIG_PM */ 6400 6397 6401 6398 EXPORT_SYMBOL_GPL(ata_eng_timeout); 6402 6399 EXPORT_SYMBOL_GPL(ata_port_schedule_eh);
+29
drivers/ata/libata-eh.c
··· 52 52 53 53 static void __ata_port_freeze(struct ata_port *ap); 54 54 static void ata_eh_finish(struct ata_port *ap); 55 + #ifdef CONFIG_PM 55 56 static void ata_eh_handle_port_suspend(struct ata_port *ap); 56 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 83 static void ata_ering_record(struct ata_ering *ering, int is_io, 59 84 unsigned int err_mask) ··· 1815 1790 return rc; 1816 1791 } 1817 1792 1793 + #ifdef CONFIG_PM 1818 1794 /** 1819 1795 * ata_eh_suspend - handle suspend EH action 1820 1796 * @ap: target host port ··· 1973 1947 DPRINTK("EXIT\n"); 1974 1948 return 0; 1975 1949 } 1950 + #endif /* CONFIG_PM */ 1976 1951 1977 1952 static int ata_port_nr_enabled(struct ata_port *ap) 1978 1953 { ··· 2276 2249 ata_eh_finish(ap); 2277 2250 } 2278 2251 2252 + #ifdef CONFIG_PM 2279 2253 /** 2280 2254 * ata_eh_handle_port_suspend - perform port suspend operation 2281 2255 * @ap: port to suspend ··· 2392 2364 } 2393 2365 spin_unlock_irqrestore(ap->lock, flags); 2394 2366 } 2367 + #endif /* CONFIG_PM */
+2
drivers/ata/libata-scsi.c
··· 510 510 } 511 511 } 512 512 513 + #ifdef CONFIG_PM 513 514 /** 514 515 * ata_scsi_device_suspend - suspend ATA device associated with sdev 515 516 * @sdev: the SCSI device to suspend ··· 635 634 sdev->sdev_gendev.power.power_state = PMSG_ON; 636 635 return 0; 637 636 } 637 + #endif /* CONFIG_PM */ 638 638 639 639 /** 640 640 * ata_to_sense_error - convert ATA error to SCSI error
+4
include/linux/libata.h
··· 718 718 extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, 719 719 unsigned int n_ports); 720 720 extern void ata_pci_remove_one (struct pci_dev *pdev); 721 + #ifdef CONFIG_PM 721 722 extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); 722 723 extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev); 723 724 extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 724 725 extern int ata_pci_device_resume(struct pci_dev *pdev); 726 + #endif 725 727 extern int ata_pci_clear_simplex(struct pci_dev *pdev); 726 728 #endif /* CONFIG_PCI */ 727 729 extern int ata_device_add(const struct ata_probe_ent *ent); ··· 749 747 extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val); 750 748 extern int ata_port_online(struct ata_port *ap); 751 749 extern int ata_port_offline(struct ata_port *ap); 750 + #ifdef CONFIG_PM 752 751 extern int ata_scsi_device_resume(struct scsi_device *); 753 752 extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg); 754 753 extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 755 754 extern void ata_host_resume(struct ata_host *host); 755 + #endif 756 756 extern int ata_ratelimit(void); 757 757 extern int ata_busy_sleep(struct ata_port *ap, 758 758 unsigned long timeout_pat, unsigned long timeout);