aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:32 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:32 -0400
commitfeb22b7f8e62b1b987a3a1dbad95af767a1df832 (patch)
tree428e5294a077fc629caa3706396e835b164eee7c
parent1785192b5310ee25165768f5bb80f13146788e3e (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>
-rw-r--r--drivers/ide/ide-probe.c4
-rw-r--r--drivers/ide/pci/aec62xx.c4
-rw-r--r--drivers/ide/pci/alim15x3.c4
-rw-r--r--drivers/ide/pci/amd74xx.c8
-rw-r--r--drivers/ide/pci/atiixp.c2
-rw-r--r--drivers/ide/pci/cmd64x.c4
-rw-r--r--drivers/ide/pci/cs5520.c2
-rw-r--r--drivers/ide/pci/cs5530.c4
-rw-r--r--drivers/ide/pci/cs5535.c10
-rw-r--r--drivers/ide/pci/cy82c693.c4
-rw-r--r--drivers/ide/pci/generic.c2
-rw-r--r--drivers/ide/pci/hpt34x.c4
-rw-r--r--drivers/ide/pci/hpt366.c8
-rw-r--r--drivers/ide/pci/it8213.c2
-rw-r--r--drivers/ide/pci/it821x.c6
-rw-r--r--drivers/ide/pci/jmicron.c2
-rw-r--r--drivers/ide/pci/ns87415.c2
-rw-r--r--drivers/ide/pci/opti621.c2
-rw-r--r--drivers/ide/pci/pdc202xx_new.c10
-rw-r--r--drivers/ide/pci/pdc202xx_old.c4
-rw-r--r--drivers/ide/pci/piix.c4
-rw-r--r--drivers/ide/pci/serverworks.c4
-rw-r--r--drivers/ide/pci/siimage.c4
-rw-r--r--drivers/ide/pci/sis5513.c4
-rw-r--r--drivers/ide/pci/sl82c105.c4
-rw-r--r--drivers/ide/pci/slc90e66.c2
-rw-r--r--drivers/ide/pci/triflex.c2
-rw-r--r--drivers/ide/pci/via82cxxx.c6
-rw-r--r--drivers/ide/setup-pci.c33
-rw-r--r--include/linux/ide.h10
30 files changed, 130 insertions, 31 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index e526f4967148..06575a12b635 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1586,8 +1586,10 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d,
1586 if (hws[0]) 1586 if (hws[0])
1587 host->dev[0] = hws[0]->dev; 1587 host->dev[0] = hws[0]->dev;
1588 1588
1589 if (d) 1589 if (d) {
1590 host->init_chipset = d->init_chipset;
1590 host->host_flags = d->host_flags; 1591 host->host_flags = d->host_flags;
1592 }
1591 1593
1592 return host; 1594 return host;
1593} 1595}
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index f65828da65d0..e7475ba559c7 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -139,7 +139,7 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio)
139 drive->hwif->port_ops->set_dma_mode(drive, pio + XFER_PIO_0); 139 drive->hwif->port_ops->set_dma_mode(drive, pio + XFER_PIO_0);
140} 140}
141 141
142static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev) 142static unsigned int init_chipset_aec62xx(struct pci_dev *dev)
143{ 143{
144 /* These are necessary to get AEC6280 Macintosh cards to work */ 144 /* These are necessary to get AEC6280 Macintosh cards to work */
145 if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP865) || 145 if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP865) ||
@@ -307,6 +307,8 @@ static struct pci_driver driver = {
307 .id_table = aec62xx_pci_tbl, 307 .id_table = aec62xx_pci_tbl,
308 .probe = aec62xx_init_one, 308 .probe = aec62xx_init_one,
309 .remove = __devexit_p(aec62xx_remove), 309 .remove = __devexit_p(aec62xx_remove),
310 .suspend = ide_pci_suspend,
311 .resume = ide_pci_resume,
310}; 312};
311 313
312static int __init aec62xx_ide_init(void) 314static int __init aec62xx_ide_init(void)
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index ef41e2677a56..053c75263918 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -213,7 +213,7 @@ static int ali15x3_dma_setup(ide_drive_t *drive)
213 * appropriate also sets up the 1533 southbridge. 213 * appropriate also sets up the 1533 southbridge.
214 */ 214 */
215 215
216static unsigned int __devinit init_chipset_ali15x3(struct pci_dev *dev) 216static unsigned int init_chipset_ali15x3(struct pci_dev *dev)
217{ 217{
218 unsigned long flags; 218 unsigned long flags;
219 u8 tmpbyte; 219 u8 tmpbyte;
@@ -581,6 +581,8 @@ static struct pci_driver driver = {
581 .id_table = alim15x3_pci_tbl, 581 .id_table = alim15x3_pci_tbl,
582 .probe = alim15x3_init_one, 582 .probe = alim15x3_init_one,
583 .remove = ide_pci_remove, 583 .remove = ide_pci_remove,
584 .suspend = ide_pci_suspend,
585 .resume = ide_pci_resume,
584}; 586};
585 587
586static int __init ali15x3_ide_init(void) 588static int __init ali15x3_ide_init(void)
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 1e66a960a96a..824471f91bf5 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -112,13 +112,13 @@ static void amd_set_pio_mode(ide_drive_t *drive, const u8 pio)
112 amd_set_drive(drive, XFER_PIO_0 + pio); 112 amd_set_drive(drive, XFER_PIO_0 + pio);
113} 113}
114 114
115static void __devinit amd7409_cable_detect(struct pci_dev *dev) 115static void amd7409_cable_detect(struct pci_dev *dev)
116{ 116{
117 /* no host side cable detection */ 117 /* no host side cable detection */
118 amd_80w = 0x03; 118 amd_80w = 0x03;
119} 119}
120 120
121static void __devinit amd7411_cable_detect(struct pci_dev *dev) 121static void amd7411_cable_detect(struct pci_dev *dev)
122{ 122{
123 int i; 123 int i;
124 u32 u = 0; 124 u32 u = 0;
@@ -140,7 +140,7 @@ static void __devinit amd7411_cable_detect(struct pci_dev *dev)
140 * The initialization callback. Initialize drive independent registers. 140 * The initialization callback. Initialize drive independent registers.
141 */ 141 */
142 142
143static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev) 143static unsigned int init_chipset_amd74xx(struct pci_dev *dev)
144{ 144{
145 u8 t = 0, offset = amd_offset(dev); 145 u8 t = 0, offset = amd_offset(dev);
146 146
@@ -324,6 +324,8 @@ static struct pci_driver driver = {
324 .id_table = amd74xx_pci_tbl, 324 .id_table = amd74xx_pci_tbl,
325 .probe = amd74xx_probe, 325 .probe = amd74xx_probe,
326 .remove = ide_pci_remove, 326 .remove = ide_pci_remove,
327 .suspend = ide_pci_suspend,
328 .resume = ide_pci_resume,
327}; 329};
328 330
329static int __init amd74xx_ide_init(void) 331static int __init amd74xx_ide_init(void)
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index 86e3120cb7c1..e4437034dd08 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -187,6 +187,8 @@ static struct pci_driver driver = {
187 .id_table = atiixp_pci_tbl, 187 .id_table = atiixp_pci_tbl,
188 .probe = atiixp_init_one, 188 .probe = atiixp_init_one,
189 .remove = ide_pci_remove, 189 .remove = ide_pci_remove,
190 .suspend = ide_pci_suspend,
191 .resume = ide_pci_resume,
190}; 192};
191 193
192static int __init atiixp_ide_init(void) 194static int __init atiixp_ide_init(void)
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 13dfeab1d19f..456dee18b660 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -331,7 +331,7 @@ static int cmd646_1_dma_end(ide_drive_t *drive)
331 return (dma_stat & 7) != 4; 331 return (dma_stat & 7) != 4;
332} 332}
333 333
334static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev) 334static unsigned int init_chipset_cmd64x(struct pci_dev *dev)
335{ 335{
336 u8 mrdmode = 0; 336 u8 mrdmode = 0;
337 337
@@ -510,6 +510,8 @@ static struct pci_driver driver = {
510 .id_table = cmd64x_pci_tbl, 510 .id_table = cmd64x_pci_tbl,
511 .probe = cmd64x_init_one, 511 .probe = cmd64x_init_one,
512 .remove = ide_pci_remove, 512 .remove = ide_pci_remove,
513 .suspend = ide_pci_suspend,
514 .resume = ide_pci_resume,
513}; 515};
514 516
515static int __init cmd64x_ide_init(void) 517static int __init cmd64x_ide_init(void)
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index 27163147896b..d6341f7c4144 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -149,6 +149,8 @@ static struct pci_driver driver = {
149 .name = "Cyrix_IDE", 149 .name = "Cyrix_IDE",
150 .id_table = cs5520_pci_tbl, 150 .id_table = cs5520_pci_tbl,
151 .probe = cs5520_init_one, 151 .probe = cs5520_init_one,
152 .suspend = ide_pci_suspend,
153 .resume = ide_pci_resume,
152}; 154};
153 155
154static int __init cs5520_ide_init(void) 156static int __init cs5520_ide_init(void)
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index d60806bd7dba..da42fa7e9f97 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -134,7 +134,7 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode)
134 * Initialize the cs5530 bridge for reliable IDE DMA operation. 134 * Initialize the cs5530 bridge for reliable IDE DMA operation.
135 */ 135 */
136 136
137static unsigned int __devinit init_chipset_cs5530(struct pci_dev *dev) 137static unsigned int init_chipset_cs5530(struct pci_dev *dev)
138{ 138{
139 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; 139 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
140 140
@@ -272,6 +272,8 @@ static struct pci_driver driver = {
272 .id_table = cs5530_pci_tbl, 272 .id_table = cs5530_pci_tbl,
273 .probe = cs5530_init_one, 273 .probe = cs5530_init_one,
274 .remove = ide_pci_remove, 274 .remove = ide_pci_remove,
275 .suspend = ide_pci_suspend,
276 .resume = ide_pci_resume,
275}; 277};
276 278
277static int __init cs5530_ide_init(void) 279static int __init cs5530_ide_init(void)
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 707d2e182552..1e5bc59ea2fb 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -193,10 +193,12 @@ static const struct pci_device_id cs5535_pci_tbl[] = {
193MODULE_DEVICE_TABLE(pci, cs5535_pci_tbl); 193MODULE_DEVICE_TABLE(pci, cs5535_pci_tbl);
194 194
195static struct pci_driver driver = { 195static struct pci_driver driver = {
196 .name = "CS5535_IDE", 196 .name = "CS5535_IDE",
197 .id_table = cs5535_pci_tbl, 197 .id_table = cs5535_pci_tbl,
198 .probe = cs5535_init_one, 198 .probe = cs5535_init_one,
199 .remove = ide_pci_remove, 199 .remove = ide_pci_remove,
200 .suspend = ide_pci_suspend,
201 .resume = ide_pci_resume,
200}; 202};
201 203
202static int __init cs5535_ide_init(void) 204static int __init cs5535_ide_init(void)
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index e6d8ee88d56d..69820e9224d1 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -332,7 +332,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
332/* 332/*
333 * this function is called during init and is used to setup the cy82c693 chip 333 * this function is called during init and is used to setup the cy82c693 chip
334 */ 334 */
335static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev) 335static unsigned int init_chipset_cy82c693(struct pci_dev *dev)
336{ 336{
337 if (PCI_FUNC(dev->devfn) != 1) 337 if (PCI_FUNC(dev->devfn) != 1)
338 return 0; 338 return 0;
@@ -448,6 +448,8 @@ static struct pci_driver driver = {
448 .id_table = cy82c693_pci_tbl, 448 .id_table = cy82c693_pci_tbl,
449 .probe = cy82c693_init_one, 449 .probe = cy82c693_init_one,
450 .remove = __devexit_p(cy82c693_remove), 450 .remove = __devexit_p(cy82c693_remove),
451 .suspend = ide_pci_suspend,
452 .resume = ide_pci_resume,
451}; 453};
452 454
453static int __init cy82c693_ide_init(void) 455static int __init cy82c693_ide_init(void)
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index bdc539868701..092b238cb250 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -171,6 +171,8 @@ static struct pci_driver driver = {
171 .id_table = generic_pci_tbl, 171 .id_table = generic_pci_tbl,
172 .probe = generic_init_one, 172 .probe = generic_init_one,
173 .remove = ide_pci_remove, 173 .remove = ide_pci_remove,
174 .suspend = ide_pci_suspend,
175 .resume = ide_pci_resume,
174}; 176};
175 177
176static int __init generic_ide_init(void) 178static int __init generic_ide_init(void)
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index 4f624899f44a..644de29f8fe4 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -78,7 +78,7 @@ static void hpt34x_set_pio_mode(ide_drive_t *drive, const u8 pio)
78 */ 78 */
79#define HPT34X_PCI_INIT_REG 0x80 79#define HPT34X_PCI_INIT_REG 0x80
80 80
81static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev) 81static unsigned int init_chipset_hpt34x(struct pci_dev *dev)
82{ 82{
83 int i = 0; 83 int i = 0;
84 unsigned long hpt34xIoBase = pci_resource_start(dev, 4); 84 unsigned long hpt34xIoBase = pci_resource_start(dev, 4);
@@ -171,6 +171,8 @@ static struct pci_driver driver = {
171 .id_table = hpt34x_pci_tbl, 171 .id_table = hpt34x_pci_tbl,
172 .probe = hpt34x_init_one, 172 .probe = hpt34x_init_one,
173 .remove = ide_pci_remove, 173 .remove = ide_pci_remove,
174 .suspend = ide_pci_suspend,
175 .resume = ide_pci_resume,
174}; 176};
175 177
176static int __init hpt34x_ide_init(void) 178static int __init hpt34x_ide_init(void)
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index ab6c217f104e..a194022b6a61 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -943,7 +943,7 @@ static void hpt3xxn_rw_disk(ide_drive_t *drive, struct request *rq)
943 * Perform a calibration cycle on the DPLL. 943 * Perform a calibration cycle on the DPLL.
944 * Returns 1 if this succeeds 944 * Returns 1 if this succeeds
945 */ 945 */
946static int __devinit hpt37x_calibrate_dpll(struct pci_dev *dev, u16 f_low, u16 f_high) 946static int hpt37x_calibrate_dpll(struct pci_dev *dev, u16 f_low, u16 f_high)
947{ 947{
948 u32 dpll = (f_high << 16) | f_low | 0x100; 948 u32 dpll = (f_high << 16) | f_low | 0x100;
949 u8 scr2; 949 u8 scr2;
@@ -971,7 +971,7 @@ static int __devinit hpt37x_calibrate_dpll(struct pci_dev *dev, u16 f_low, u16 f
971 return 1; 971 return 1;
972} 972}
973 973
974static void __devinit hpt3xx_disable_fast_irq(struct pci_dev *dev, u8 mcr_addr) 974static void hpt3xx_disable_fast_irq(struct pci_dev *dev, u8 mcr_addr)
975{ 975{
976 struct ide_host *host = pci_get_drvdata(dev); 976 struct ide_host *host = pci_get_drvdata(dev);
977 struct hpt_info *info = host->host_priv + (&dev->dev == host->dev[1]); 977 struct hpt_info *info = host->host_priv + (&dev->dev == host->dev[1]);
@@ -1001,7 +1001,7 @@ static void __devinit hpt3xx_disable_fast_irq(struct pci_dev *dev, u8 mcr_addr)
1001 pci_write_config_byte(dev, mcr_addr + 1, new_mcr); 1001 pci_write_config_byte(dev, mcr_addr + 1, new_mcr);
1002} 1002}
1003 1003
1004static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev) 1004static unsigned int init_chipset_hpt366(struct pci_dev *dev)
1005{ 1005{
1006 unsigned long io_base = pci_resource_start(dev, 4); 1006 unsigned long io_base = pci_resource_start(dev, 4);
1007 struct hpt_info *info = hpt3xx_get_info(&dev->dev); 1007 struct hpt_info *info = hpt3xx_get_info(&dev->dev);
@@ -1627,6 +1627,8 @@ static struct pci_driver driver = {
1627 .id_table = hpt366_pci_tbl, 1627 .id_table = hpt366_pci_tbl,
1628 .probe = hpt366_init_one, 1628 .probe = hpt366_init_one,
1629 .remove = __devexit_p(hpt366_remove), 1629 .remove = __devexit_p(hpt366_remove),
1630 .suspend = ide_pci_suspend,
1631 .resume = ide_pci_resume,
1630}; 1632};
1631 1633
1632static int __init hpt366_ide_init(void) 1634static int __init hpt366_ide_init(void)
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c
index a0e058a2abfe..0954ccd08d6f 100644
--- a/drivers/ide/pci/it8213.c
+++ b/drivers/ide/pci/it8213.c
@@ -194,6 +194,8 @@ static struct pci_driver driver = {
194 .id_table = it8213_pci_tbl, 194 .id_table = it8213_pci_tbl,
195 .probe = it8213_init_one, 195 .probe = it8213_init_one,
196 .remove = ide_pci_remove, 196 .remove = ide_pci_remove,
197 .suspend = ide_pci_suspend,
198 .resume = ide_pci_resume,
197}; 199};
198 200
199static int __init it8213_ide_init(void) 201static int __init it8213_ide_init(void)
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 0fdea7e91a7a..46edd083b348 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -586,7 +586,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
586 hwif->mwdma_mask = ATA_MWDMA2; 586 hwif->mwdma_mask = ATA_MWDMA2;
587} 587}
588 588
589static void __devinit it8212_disable_raid(struct pci_dev *dev) 589static void it8212_disable_raid(struct pci_dev *dev)
590{ 590{
591 /* Reset local CPU, and set BIOS not ready */ 591 /* Reset local CPU, and set BIOS not ready */
592 pci_write_config_byte(dev, 0x5E, 0x01); 592 pci_write_config_byte(dev, 0x5E, 0x01);
@@ -603,7 +603,7 @@ static void __devinit it8212_disable_raid(struct pci_dev *dev)
603 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20); 603 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20);
604} 604}
605 605
606static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev) 606static unsigned int init_chipset_it821x(struct pci_dev *dev)
607{ 607{
608 u8 conf; 608 u8 conf;
609 static char *mode[2] = { "pass through", "smart" }; 609 static char *mode[2] = { "pass through", "smart" };
@@ -685,6 +685,8 @@ static struct pci_driver driver = {
685 .id_table = it821x_pci_tbl, 685 .id_table = it821x_pci_tbl,
686 .probe = it821x_init_one, 686 .probe = it821x_init_one,
687 .remove = __devexit_p(it821x_remove), 687 .remove = __devexit_p(it821x_remove),
688 .suspend = ide_pci_suspend,
689 .resume = ide_pci_resume,
688}; 690};
689 691
690static int __init it821x_ide_init(void) 692static int __init it821x_ide_init(void)
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index 4010b4a8dfbb..acd647110648 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -154,6 +154,8 @@ static struct pci_driver driver = {
154 .id_table = jmicron_pci_tbl, 154 .id_table = jmicron_pci_tbl,
155 .probe = jmicron_init_one, 155 .probe = jmicron_init_one,
156 .remove = ide_pci_remove, 156 .remove = ide_pci_remove,
157 .suspend = ide_pci_suspend,
158 .resume = ide_pci_resume,
157}; 159};
158 160
159static int __init jmicron_ide_init(void) 161static int __init jmicron_ide_init(void)
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index a482ade8e455..53bd645736d9 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -339,6 +339,8 @@ static struct pci_driver driver = {
339 .id_table = ns87415_pci_tbl, 339 .id_table = ns87415_pci_tbl,
340 .probe = ns87415_init_one, 340 .probe = ns87415_init_one,
341 .remove = ide_pci_remove, 341 .remove = ide_pci_remove,
342 .suspend = ide_pci_suspend,
343 .resume = ide_pci_resume,
342}; 344};
343 345
344static int __init ns87415_ide_init(void) 346static int __init ns87415_ide_init(void)
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index fefac2c174b6..3de11ddcf863 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -225,6 +225,8 @@ static struct pci_driver driver = {
225 .id_table = opti621_pci_tbl, 225 .id_table = opti621_pci_tbl,
226 .probe = opti621_init_one, 226 .probe = opti621_init_one,
227 .remove = ide_pci_remove, 227 .remove = ide_pci_remove,
228 .suspend = ide_pci_suspend,
229 .resume = ide_pci_resume,
228}; 230};
229 231
230static int __init opti621_ide_init(void) 232static int __init opti621_ide_init(void)
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 73bd264fbf9f..9fc59962553b 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -226,7 +226,7 @@ static void pdcnew_reset(ide_drive_t *drive)
226 * read_counter - Read the byte count registers 226 * read_counter - Read the byte count registers
227 * @dma_base: for the port address 227 * @dma_base: for the port address
228 */ 228 */
229static long __devinit read_counter(u32 dma_base) 229static long read_counter(u32 dma_base)
230{ 230{
231 u32 pri_dma_base = dma_base, sec_dma_base = dma_base + 0x08; 231 u32 pri_dma_base = dma_base, sec_dma_base = dma_base + 0x08;
232 u8 cnt0, cnt1, cnt2, cnt3; 232 u8 cnt0, cnt1, cnt2, cnt3;
@@ -266,7 +266,7 @@ static long __devinit read_counter(u32 dma_base)
266 * @dma_base: for the port address 266 * @dma_base: for the port address
267 * E.g. 16949000 on 33 MHz PCI bus, i.e. half of the PCI clock. 267 * E.g. 16949000 on 33 MHz PCI bus, i.e. half of the PCI clock.
268 */ 268 */
269static long __devinit detect_pll_input_clock(unsigned long dma_base) 269static long detect_pll_input_clock(unsigned long dma_base)
270{ 270{
271 struct timeval start_time, end_time; 271 struct timeval start_time, end_time;
272 long start_count, end_count; 272 long start_count, end_count;
@@ -309,7 +309,7 @@ static long __devinit detect_pll_input_clock(unsigned long dma_base)
309} 309}
310 310
311#ifdef CONFIG_PPC_PMAC 311#ifdef CONFIG_PPC_PMAC
312static void __devinit apple_kiwi_init(struct pci_dev *pdev) 312static void apple_kiwi_init(struct pci_dev *pdev)
313{ 313{
314 struct device_node *np = pci_device_to_OF_node(pdev); 314 struct device_node *np = pci_device_to_OF_node(pdev);
315 u8 conf; 315 u8 conf;
@@ -325,7 +325,7 @@ static void __devinit apple_kiwi_init(struct pci_dev *pdev)
325} 325}
326#endif /* CONFIG_PPC_PMAC */ 326#endif /* CONFIG_PPC_PMAC */
327 327
328static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev) 328static unsigned int init_chipset_pdcnew(struct pci_dev *dev)
329{ 329{
330 const char *name = DRV_NAME; 330 const char *name = DRV_NAME;
331 unsigned long dma_base = pci_resource_start(dev, 4); 331 unsigned long dma_base = pci_resource_start(dev, 4);
@@ -566,6 +566,8 @@ static struct pci_driver driver = {
566 .id_table = pdc202new_pci_tbl, 566 .id_table = pdc202new_pci_tbl,
567 .probe = pdc202new_init_one, 567 .probe = pdc202new_init_one,
568 .remove = __devexit_p(pdc202new_remove), 568 .remove = __devexit_p(pdc202new_remove),
569 .suspend = ide_pci_suspend,
570 .resume = ide_pci_resume,
569}; 571};
570 572
571static int __init pdc202new_ide_init(void) 573static int __init pdc202new_ide_init(void)
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index 8f0acb956c6b..cb6d2a00c514 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -264,7 +264,7 @@ static void pdc202xx_dma_timeout(ide_drive_t *drive)
264 ide_dma_timeout(drive); 264 ide_dma_timeout(drive);
265} 265}
266 266
267static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev) 267static unsigned int init_chipset_pdc202xx(struct pci_dev *dev)
268{ 268{
269 unsigned long dmabase = pci_resource_start(dev, 4); 269 unsigned long dmabase = pci_resource_start(dev, 4);
270 u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0; 270 u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0;
@@ -431,6 +431,8 @@ static struct pci_driver driver = {
431 .id_table = pdc202xx_pci_tbl, 431 .id_table = pdc202xx_pci_tbl,
432 .probe = pdc202xx_init_one, 432 .probe = pdc202xx_init_one,
433 .remove = ide_pci_remove, 433 .remove = ide_pci_remove,
434 .suspend = ide_pci_suspend,
435 .resume = ide_pci_resume,
434}; 436};
435 437
436static int __init pdc202xx_ide_init(void) 438static int __init pdc202xx_ide_init(void)
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index 13136dddb2b4..a06c03f8e295 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -204,7 +204,7 @@ static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed)
204 * out to be nice and simple. 204 * out to be nice and simple.
205 */ 205 */
206 206
207static unsigned int __devinit init_chipset_ich(struct pci_dev *dev) 207static unsigned int init_chipset_ich(struct pci_dev *dev)
208{ 208{
209 u32 extra = 0; 209 u32 extra = 0;
210 210
@@ -449,6 +449,8 @@ static struct pci_driver driver = {
449 .id_table = piix_pci_tbl, 449 .id_table = piix_pci_tbl,
450 .probe = piix_init_one, 450 .probe = piix_init_one,
451 .remove = ide_pci_remove, 451 .remove = ide_pci_remove,
452 .suspend = ide_pci_suspend,
453 .resume = ide_pci_resume,
452}; 454};
453 455
454static int __init piix_ide_init(void) 456static int __init piix_ide_init(void)
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 5f79d284ff82..3dff2aea317e 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -175,7 +175,7 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed)
175 pci_write_config_byte(dev, 0x54, ultra_enable); 175 pci_write_config_byte(dev, 0x54, ultra_enable);
176} 176}
177 177
178static unsigned int __devinit init_chipset_svwks(struct pci_dev *dev) 178static unsigned int init_chipset_svwks(struct pci_dev *dev)
179{ 179{
180 unsigned int reg; 180 unsigned int reg;
181 u8 btr; 181 u8 btr;
@@ -448,6 +448,8 @@ static struct pci_driver driver = {
448 .id_table = svwks_pci_tbl, 448 .id_table = svwks_pci_tbl,
449 .probe = svwks_init_one, 449 .probe = svwks_init_one,
450 .remove = ide_pci_remove, 450 .remove = ide_pci_remove,
451 .suspend = ide_pci_suspend,
452 .resume = ide_pci_resume,
451}; 453};
452 454
453static int __init svwks_ide_init(void) 455static int __init svwks_ide_init(void)
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 874c8ca40ed6..174a873b4c64 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -463,7 +463,7 @@ static void sil_sata_pre_reset(ide_drive_t *drive)
463 * to 133 MHz clocking if the system isn't already set up to do it. 463 * to 133 MHz clocking if the system isn't already set up to do it.
464 */ 464 */
465 465
466static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev) 466static unsigned int init_chipset_siimage(struct pci_dev *dev)
467{ 467{
468 struct ide_host *host = pci_get_drvdata(dev); 468 struct ide_host *host = pci_get_drvdata(dev);
469 void __iomem *ioaddr = host->host_priv; 469 void __iomem *ioaddr = host->host_priv;
@@ -834,6 +834,8 @@ static struct pci_driver driver = {
834 .id_table = siimage_pci_tbl, 834 .id_table = siimage_pci_tbl,
835 .probe = siimage_init_one, 835 .probe = siimage_init_one,
836 .remove = __devexit_p(siimage_remove), 836 .remove = __devexit_p(siimage_remove),
837 .suspend = ide_pci_suspend,
838 .resume = ide_pci_resume,
837}; 839};
838 840
839static int __init siimage_ide_init(void) 841static int __init siimage_ide_init(void)
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 56bfb245f1fa..734dd41f1f67 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -447,7 +447,7 @@ static int __devinit sis_find_family(struct pci_dev *dev)
447 return chipset_family; 447 return chipset_family;
448} 448}
449 449
450static unsigned int __devinit init_chipset_sis5513(struct pci_dev *dev) 450static unsigned int init_chipset_sis5513(struct pci_dev *dev)
451{ 451{
452 /* Make general config ops here 452 /* Make general config ops here
453 1/ tell IDE channels to operate in Compatibility mode only 453 1/ tell IDE channels to operate in Compatibility mode only
@@ -610,6 +610,8 @@ static struct pci_driver driver = {
610 .id_table = sis5513_pci_tbl, 610 .id_table = sis5513_pci_tbl,
611 .probe = sis5513_init_one, 611 .probe = sis5513_init_one,
612 .remove = __devexit_p(sis5513_remove), 612 .remove = __devexit_p(sis5513_remove),
613 .suspend = ide_pci_suspend,
614 .resume = ide_pci_resume,
613}; 615};
614 616
615static int __init sis5513_ide_init(void) 617static int __init sis5513_ide_init(void)
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 8cc4e137c608..37a6b7bdc040 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -271,7 +271,7 @@ static u8 sl82c105_bridge_revision(struct pci_dev *dev)
271 * channel 0 here at least, but channel 1 has to be enabled by 271 * channel 0 here at least, but channel 1 has to be enabled by
272 * firmware or arch code. We still set both to 16 bits mode. 272 * firmware or arch code. We still set both to 16 bits mode.
273 */ 273 */
274static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev) 274static unsigned int init_chipset_sl82c105(struct pci_dev *dev)
275{ 275{
276 u32 val; 276 u32 val;
277 277
@@ -350,6 +350,8 @@ static struct pci_driver driver = {
350 .id_table = sl82c105_pci_tbl, 350 .id_table = sl82c105_pci_tbl,
351 .probe = sl82c105_init_one, 351 .probe = sl82c105_init_one,
352 .remove = ide_pci_remove, 352 .remove = ide_pci_remove,
353 .suspend = ide_pci_suspend,
354 .resume = ide_pci_resume,
353}; 355};
354 356
355static int __init sl82c105_ide_init(void) 357static int __init sl82c105_ide_init(void)
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index a31c6911442d..a9551a13ac57 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -159,6 +159,8 @@ static struct pci_driver driver = {
159 .id_table = slc90e66_pci_tbl, 159 .id_table = slc90e66_pci_tbl,
160 .probe = slc90e66_init_one, 160 .probe = slc90e66_init_one,
161 .remove = ide_pci_remove, 161 .remove = ide_pci_remove,
162 .suspend = ide_pci_suspend,
163 .resume = ide_pci_resume,
162}; 164};
163 165
164static int __init slc90e66_ide_init(void) 166static int __init slc90e66_ide_init(void)
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index c980a7f39052..be8715dcee05 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -119,6 +119,8 @@ static struct pci_driver driver = {
119 .id_table = triflex_pci_tbl, 119 .id_table = triflex_pci_tbl,
120 .probe = triflex_init_one, 120 .probe = triflex_init_one,
121 .remove = ide_pci_remove, 121 .remove = ide_pci_remove,
122 .suspend = ide_pci_suspend,
123 .resume = ide_pci_resume,
122}; 124};
123 125
124static int __init triflex_ide_init(void) 126static int __init triflex_ide_init(void)
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 9cb531dc905a..acacdaab69c2 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -215,7 +215,7 @@ static struct via_isa_bridge *via_config_find(struct pci_dev **isa)
215/* 215/*
216 * Check and handle 80-wire cable presence 216 * Check and handle 80-wire cable presence
217 */ 217 */
218static void __devinit via_cable_detect(struct via82cxxx_dev *vdev, u32 u) 218static void via_cable_detect(struct via82cxxx_dev *vdev, u32 u)
219{ 219{
220 int i; 220 int i;
221 221
@@ -267,7 +267,7 @@ static void __devinit via_cable_detect(struct via82cxxx_dev *vdev, u32 u)
267 * and initialize its drive independent registers. 267 * and initialize its drive independent registers.
268 */ 268 */
269 269
270static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev) 270static unsigned int init_chipset_via82cxxx(struct pci_dev *dev)
271{ 271{
272 struct ide_host *host = pci_get_drvdata(dev); 272 struct ide_host *host = pci_get_drvdata(dev);
273 struct via82cxxx_dev *vdev = host->host_priv; 273 struct via82cxxx_dev *vdev = host->host_priv;
@@ -492,6 +492,8 @@ static struct pci_driver driver = {
492 .id_table = via_pci_tbl, 492 .id_table = via_pci_tbl,
493 .probe = via_init_one, 493 .probe = via_init_one,
494 .remove = __devexit_p(via_remove), 494 .remove = __devexit_p(via_remove),
495 .suspend = ide_pci_suspend,
496 .resume = ide_pci_resume,
495}; 497};
496 498
497static int __init via_ide_init(void) 499static int __init via_ide_init(void)
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}
661EXPORT_SYMBOL_GPL(ide_pci_remove); 661EXPORT_SYMBOL_GPL(ide_pci_remove);
662
663#ifdef CONFIG_PM
664int 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}
672EXPORT_SYMBOL_GPL(ide_pci_suspend);
673
674int 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}
693EXPORT_SYMBOL_GPL(ide_pci_resume);
694#endif
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 432eb98f7fe7..2c5d83ddaef6 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -17,6 +17,7 @@
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/completion.h> 19#include <linux/completion.h>
20#include <linux/pm.h>
20#ifdef CONFIG_BLK_DEV_IDEACPI 21#ifdef CONFIG_BLK_DEV_IDEACPI
21#include <acpi/acpi.h> 22#include <acpi/acpi.h>
22#endif 23#endif
@@ -639,6 +640,7 @@ struct ide_host {
639 ide_hwif_t *ports[MAX_HWIFS]; 640 ide_hwif_t *ports[MAX_HWIFS];
640 unsigned int n_ports; 641 unsigned int n_ports;
641 struct device *dev[2]; 642 struct device *dev[2];
643 unsigned int (*init_chipset)(struct pci_dev *);
642 unsigned long host_flags; 644 unsigned long host_flags;
643 void *host_priv; 645 void *host_priv;
644}; 646};
@@ -1264,6 +1266,14 @@ int ide_pci_init_two(struct pci_dev *, struct pci_dev *,
1264 const struct ide_port_info *, void *); 1266 const struct ide_port_info *, void *);
1265void ide_pci_remove(struct pci_dev *); 1267void ide_pci_remove(struct pci_dev *);
1266 1268
1269#ifdef CONFIG_PM
1270int ide_pci_suspend(struct pci_dev *, pm_message_t);
1271int ide_pci_resume(struct pci_dev *);
1272#else
1273#define ide_pci_suspend NULL
1274#define ide_pci_resume NULL
1275#endif
1276
1267void ide_map_sg(ide_drive_t *, struct request *); 1277void ide_map_sg(ide_drive_t *, struct request *);
1268void ide_init_sg_cmd(ide_drive_t *, struct request *); 1278void ide_init_sg_cmd(ide_drive_t *, struct request *);
1269 1279