asus_acpi: convert to seq_file
[safe/jmp/linux-2.6] / drivers / ata / pata_ns87415.c
index 89bf5f8..061aa1c 100644 (file)
@@ -325,6 +325,13 @@ static struct scsi_host_template ns87415_sht = {
        ATA_BMDMA_SHT(DRV_NAME),
 };
 
+static void ns87415_fixup(struct pci_dev *pdev)
+{
+       /* Select 512 byte sectors */
+       pci_write_config_byte(pdev, 0x55, 0xEE);
+       /* Select PIO0 8bit clocking */
+       pci_write_config_byte(pdev, 0x54, 0xB7);
+}
 
 /**
  *     ns87415_init_one - Register 87415 ATA PCI device with kernel services
@@ -346,8 +353,8 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *e
        static int printed_version;
        static const struct ata_port_info info = {
                .flags          = ATA_FLAG_SLAVE_POSS,
-               .pio_mask       = 0x1f, /* pio0-4 */
-               .mwdma_mask     = 0x07, /* mwdma0-2 */
+               .pio_mask       = ATA_PIO4,
+               .mwdma_mask     = ATA_MWDMA2,
                .port_ops       = &ns87415_pata_ops,
        };
        const struct ata_port_info *ppi[] = { &info, NULL };
@@ -355,8 +362,8 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *e
 #if defined(CONFIG_SUPERIO)
        static const struct ata_port_info info87560 = {
                .flags          = ATA_FLAG_SLAVE_POSS,
-               .pio_mask       = 0x1f, /* pio0-4 */
-               .mwdma_mask     = 0x07, /* mwdma0-2 */
+               .pio_mask       = ATA_PIO4,
+               .mwdma_mask     = ATA_MWDMA2,
                .port_ops       = &ns87560_pata_ops,
        };
 
@@ -371,10 +378,8 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *e
        if (rc)
                return rc;
 
-       /* Select 512 byte sectors */
-       pci_write_config_byte(pdev, 0x55, 0xEE);
-       /* Select PIO0 8bit clocking */
-       pci_write_config_byte(pdev, 0x54, 0xB7);
+       ns87415_fixup(pdev);
+
        return ata_pci_sff_init_one(pdev, ppi, &ns87415_sht, NULL);
 }
 
@@ -384,6 +389,23 @@ static const struct pci_device_id ns87415_pci_tbl[] = {
        { }     /* terminate list */
 };
 
+#ifdef CONFIG_PM
+static int ns87415_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;
+
+       ns87415_fixup(pdev);
+
+       ata_host_resume(host);
+       return 0;
+}
+#endif
+
 static struct pci_driver ns87415_pci_driver = {
        .name                   = DRV_NAME,
        .id_table               = ns87415_pci_tbl,
@@ -391,7 +413,7 @@ static struct pci_driver ns87415_pci_driver = {
        .remove                 = ata_pci_remove_one,
 #ifdef CONFIG_PM
        .suspend                = ata_pci_device_suspend,
-       .resume                 = ata_pci_device_resume,
+       .resume                 = ns87415_reinit_one,
 #endif
 };