diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:32 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:32 -0400 |
commit | feb22b7f8e62b1b987a3a1dbad95af767a1df832 (patch) | |
tree | 428e5294a077fc629caa3706396e835b164eee7c /drivers/ide/setup-pci.c | |
parent | 1785192b5310ee25165768f5bb80f13146788e3e (diff) |
ide: add proper PCI PM support (v2)
* Keep pointer to ->init_chipset method also in
struct ide_host and set it in ide_host_alloc_all().
* Add ide_pci_suspend() and ide_pci_resume() helpers
(default ->suspend and ->resume implementations).
* ->init_chipset can no longer be marked __devinit.
* Add proper PCI PM support to IDE PCI host drivers
(rz1000.c and tc86c001.c are skipped for now since
they need to be converted from using ->init_hwif
to use ->init_chipset instead).
v2:
* Cleanup CONFIG_PM #ifdef-s per akpm's suggestion.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/setup-pci.c')
-rw-r--r-- | drivers/ide/setup-pci.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index a8e9e8a69a52..9f1f9163a136 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -659,3 +659,36 @@ void ide_pci_remove(struct pci_dev *dev) | |||
659 | pci_disable_device(dev); | 659 | pci_disable_device(dev); |
660 | } | 660 | } |
661 | EXPORT_SYMBOL_GPL(ide_pci_remove); | 661 | EXPORT_SYMBOL_GPL(ide_pci_remove); |
662 | |||
663 | #ifdef CONFIG_PM | ||
664 | int ide_pci_suspend(struct pci_dev *dev, pm_message_t state) | ||
665 | { | ||
666 | pci_save_state(dev); | ||
667 | pci_disable_device(dev); | ||
668 | pci_set_power_state(dev, pci_choose_state(dev, state)); | ||
669 | |||
670 | return 0; | ||
671 | } | ||
672 | EXPORT_SYMBOL_GPL(ide_pci_suspend); | ||
673 | |||
674 | int ide_pci_resume(struct pci_dev *dev) | ||
675 | { | ||
676 | struct ide_host *host = pci_get_drvdata(dev); | ||
677 | int rc; | ||
678 | |||
679 | pci_set_power_state(dev, PCI_D0); | ||
680 | |||
681 | rc = pci_enable_device(dev); | ||
682 | if (rc) | ||
683 | return rc; | ||
684 | |||
685 | pci_restore_state(dev); | ||
686 | pci_set_master(dev); | ||
687 | |||
688 | if (host->init_chipset) | ||
689 | host->init_chipset(dev); | ||
690 | |||
691 | return 0; | ||
692 | } | ||
693 | EXPORT_SYMBOL_GPL(ide_pci_resume); | ||
694 | #endif | ||