const struct ata_port_info *ppi[] = { NULL, NULL };
        u8 tmp;
        struct pci_dev *isa_bridge;
+       int rc;
+
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
 
        /*
         * The chipset revision selects the driver operations and
 #ifdef CONFIG_PM
 static int ali_reinit_one(struct pci_dev *pdev)
 {
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
        ali_init_chipset(pdev);
-       return ata_pci_device_resume(pdev);
+       ata_host_resume(host);
+       return 0;
 }
 #endif
 
 
        static int printed_version;
        int type = id->driver_data;
        u8 fifo;
+       int rc;
 
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
 
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
+
        pci_read_config_byte(pdev, 0x41, &fifo);
 
        /* Check for AMD7409 without swdma errata and if found adjust type */
 #ifdef CONFIG_PM
 static int amd_reinit_one(struct pci_dev *pdev)
 {
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
+
        if (pdev->vendor == PCI_VENDOR_ID_AMD) {
                u8 fifo;
                pci_read_config_byte(pdev, 0x41, &fifo);
                    pdev->device == PCI_DEVICE_ID_AMD_COBRA_7401)
                        ata_pci_clear_simplex(pdev);
        }
-       return ata_pci_device_resume(pdev);
+
+       ata_host_resume(host);
+       return 0;
 }
 #endif
 
 
                .port_ops       = &artop6260_ops,
        };
        const struct ata_port_info *ppi[] = { NULL, NULL };
+       int rc;
 
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &pdev->dev,
                           "version " DRV_VERSION "\n");
 
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
+
        if (id->driver_data == 0) {     /* 6210 variant */
                ppi[0] = &info_6210;
                ppi[1] = &ata_dummy_port_info;
 
                .port_ops = &cmd640_port_ops
        };
        const struct ata_port_info *ppi[] = { &info, NULL };
+       int rc;
+
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
 
        cmd640_hardware_init(pdev);
+
        return ata_pci_init_one(pdev, ppi);
 }
 
+#ifdef CONFIG_PM
 static int cmd640_reinit_one(struct pci_dev *pdev)
 {
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
        cmd640_hardware_init(pdev);
-#ifdef CONFIG_PM
-       return ata_pci_device_resume(pdev);
-#else
+       ata_host_resume(host);
        return 0;
-#endif
 }
+#endif
 
 static const struct pci_device_id cmd640[] = {
        { PCI_VDEVICE(CMD, 0x640), 0 },
        .remove         = ata_pci_remove_one,
 #ifdef CONFIG_PM
        .suspend        = ata_pci_device_suspend,
-#endif
        .resume         = cmd640_reinit_one,
+#endif
 };
 
 static int __init cmd640_init(void)
 
        };
        const struct ata_port_info *ppi[] = { &cmd_info[id->driver_data], NULL };
        u8 mrdmode;
+       int rc;
+
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
 
        pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev);
        class_rev &= 0xFF;
 #ifdef CONFIG_PM
 static int cmd64x_reinit_one(struct pci_dev *pdev)
 {
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
        u8 mrdmode;
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
+
        pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64);
        pci_read_config_byte(pdev, MRDMODE, &mrdmode);
        mrdmode &= ~ 0x30;      /* IRQ set up */
 #ifdef CONFIG_PPC
        pci_write_config_byte(pdev, UDIDETCR0, 0xF0);
 #endif
-       return ata_pci_device_resume(pdev);
+       ata_host_resume(host);
+       return 0;
 }
 #endif
 
 
        struct ata_ioports *ioaddr;
        int i, rc;
 
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
+
        /* IDE port enable bits */
        pci_read_config_byte(pdev, 0x60, &pcicfg);
 
 
 static int cs5520_reinit_one(struct pci_dev *pdev)
 {
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
        u8 pcicfg;
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
+
        pci_read_config_byte(pdev, 0x60, &pcicfg);
        if ((pcicfg & 0x40) == 0)
                pci_write_config_byte(pdev, 0x60, pcicfg | 0x40);
-       return ata_pci_device_resume(pdev);
+
+       ata_host_resume(host);
+       return 0;
 }
 
 /**
 
                .port_ops = &cs5530_port_ops
        };
        const struct ata_port_info *ppi[] = { &info, NULL };
+       int rc;
+
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
 
        /* Chip initialisation */
        if (cs5530_init_chip())
 #ifdef CONFIG_PM
 static int cs5530_reinit_one(struct pci_dev *pdev)
 {
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
+
        /* If we fail on resume we are doomed */
        if (cs5530_init_chip())
-               BUG();
-       return ata_pci_device_resume(pdev);
+               return -EIO;
+
+       ata_host_resume(host);
+       return 0;
 }
 #endif /* CONFIG_PM */
 
 
 
        u32 class_rev;
        u32 reg1;
+       int rc;
+
+       rc = pcim_enable_device(dev);
+       if (rc)
+               return rc;
 
        pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
        class_rev &= 0xFF;
 #ifdef CONFIG_PM
 static int hpt36x_reinit_one(struct pci_dev *dev)
 {
+       struct ata_host *host = dev_get_drvdata(&dev->dev);
+       int rc;
+
+       rc = ata_pci_device_do_resume(dev);
+       if (rc)
+               return rc;
        hpt36x_init_chipset(dev);
-       return ata_pci_device_resume(dev);
+       ata_host_resume(host);
+       return 0;
 }
 #endif
 
 
 
        const struct hpt_chip *chip_table;
        int clock_slot;
+       int rc;
+
+       rc = pcim_enable_device(dev);
+       if (rc)
+               return rc;
 
        pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
        class_rev &= 0xFF;
 
        unsigned int f_low, f_high;
        int adjust;
        unsigned long iobase = pci_resource_start(dev, 4);
+       int rc;
+
+       rc = pcim_enable_device(dev);
+       if (rc)
+               return rc;
 
        pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
        class_rev &= 0xFF;
 
 
        const struct ata_port_info *ppi[] = { NULL, NULL };
        static char *mode[2] = { "pass through", "smart" };
+       int rc;
+
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
 
        /* Force the card into bypass mode if so requested */
        if (it8212_noraid) {
 #ifdef CONFIG_PM
 static int it821x_reinit_one(struct pci_dev *pdev)
 {
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
        /* Resume - turn raid back off if need be */
        if (it8212_noraid)
                it821x_disable_raid(pdev);
-       return ata_pci_device_resume(pdev);
+       ata_host_resume(host);
+       return rc;
 }
 #endif
 
 
                .port_ops       = &netcell_ops,
        };
        const struct ata_port_info *port_info[] = { &info, NULL };
+       int rc;
 
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &pdev->dev,
                           "version " DRV_VERSION "\n");
 
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
+
        /* Any chip specific setup/optimisation/messages here */
        ata_pci_clear_simplex(pdev);
 
 
                .port_ops       = &ns87415_pata_ops,
        };
        const struct ata_port_info *ppi[] = { &info, NULL };
+       int rc;
 #if defined(CONFIG_SUPERIO)
        static const struct ata_port_info info87560 = {
                .sht            = &ns87415_sht,
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &pdev->dev,
                           "version " DRV_VERSION "\n");
+
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
+
        /* Select 512 byte sectors */
        pci_write_config_byte(pdev, 0x55, 0xEE);
        /* Select PIO0 8bit clocking */
 
        };
        const struct ata_port_info *ppi[] = { &info_82c700, NULL };
        static int printed_version;
+       int rc;
 
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
 
+       rc = pcim_enable_device(dev);
+       if (rc)
+               return rc;
+
        /* Fixed location chipset magic */
        inw(0x1F1);
        inw(0x1F1);
 
                }
        };
        const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL };
+       int rc;
+
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
 
        /* Force master latency timer to 64 PCI clocks */
        pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40);
 #ifdef CONFIG_PM
 static int serverworks_reinit_one(struct pci_dev *pdev)
 {
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
+
        /* Force master latency timer to 64 PCI clocks */
        pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40);
 
-       switch (pdev->device)
-       {
+       switch (pdev->device) {
                case PCI_DEVICE_ID_SERVERWORKS_OSB4IDE:
                        serverworks_fixup_osb4(pdev);
                        break;
                        serverworks_fixup_ht1000(pdev);
                        break;
        }
-       return ata_pci_device_resume(pdev);
+
+       ata_host_resume(host);
+       return 0;
 }
 #endif
 
 
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
 
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
+
        switch (sil680_init_chip(pdev, &try_mmio)) {
                case 0:
                        ppi[0] = &info_slow;
 #ifdef CONFIG_PM
 static int sil680_reinit_one(struct pci_dev *pdev)
 {
-       int try_mmio;
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int try_mmio, rc;
 
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
        sil680_init_chip(pdev, &try_mmio);
-       return ata_pci_device_resume(pdev);
+       ata_host_resume(host);
+       return 0;
 }
 #endif
 
 
        struct pci_dev *host = NULL;
        struct sis_chipset *chipset = NULL;
        struct sis_chipset *sets;
+       int rc;
 
        static struct sis_chipset sis_chipsets[] = {
 
                dev_printk(KERN_DEBUG, &pdev->dev,
                           "version " DRV_VERSION "\n");
 
-       /* We have to find the bridge first */
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
 
+       /* We have to find the bridge first */
        for (sets = &sis_chipsets[0]; sets->device; sets++) {
                host = pci_get_device(PCI_VENDOR_ID_SI, sets->device, NULL);
                if (host != NULL) {
 
                                               NULL };
        u32 val;
        int rev;
+       int rc;
+
+       rc = pcim_enable_device(dev);
+       if (rc)
+               return rc;
 
        rev = sl82c105_bridge_revision(dev);
 
 
        static int printed_version;
        u8 enable;
        u32 timing;
+       int rc;
 
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
 
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
+
        /* To find out how the IDE will behave and what features we
           actually have to look at the bridge not the IDE controller */
        for (config = via_isa_bridges; config->id; config++)
        u32 timing;
        struct ata_host *host = dev_get_drvdata(&pdev->dev);
        const struct via_isa_bridge *config = host->private_data;
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
 
        via_config_fifo(pdev, config->flags);
 
                timing &= ~0x80008;
                pci_write_config_dword(pdev, 0x50, timing);
        }
-       return ata_pci_device_resume(pdev);
+
+       ata_host_resume(host);
+       return 0;
 }
 #endif