]> err.no Git - linux-2.6/blobdiff - drivers/ata/ahci.c
libata: implement ata_host_detach()
[linux-2.6] / drivers / ata / ahci.c
index 48616c6fee9d6c30d36f206b60b98707020e0cc8..649dfa57e51c01df3112579f91d86e5d6f26ea2e 100644 (file)
@@ -431,7 +431,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 
        /* Generic, PCI class code for AHCI */
        { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
-         0x010601, 0xffffff, board_ahci },
+         PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
 
        { }     /* terminate list */
 };
@@ -1173,7 +1173,7 @@ static void ahci_host_intr(struct ata_port *ap)
                 * dangerous, we need to know more about them.  Print
                 * more of it.
                 */
-               const u32 *f = pp->rx_fis + RX_FIS_SDB;
+               const __le32 *f = pp->rx_fis + RX_FIS_SDB;
 
                ata_port_printk(ap, KERN_INFO, "Spurious SDB FIS during NCQ "
                                "issue=0x%x SAct=0x%x FIS=%08x:%08x%s\n",
@@ -1397,7 +1397,9 @@ static int ahci_pci_device_resume(struct pci_dev *pdev)
        void __iomem *mmio = host->mmio_base;
        int rc;
 
-       ata_pci_device_do_resume(pdev);
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
 
        if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
                rc = ahci_reset_controller(mmio, pdev);
@@ -1619,11 +1621,11 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent)
                speed_s = "?";
 
        pci_read_config_word(pdev, 0x0a, &cc);
-       if (cc == 0x0101)
+       if (cc == PCI_CLASS_STORAGE_IDE)
                scc_s = "IDE";
-       else if (cc == 0x0106)
+       else if (cc == PCI_CLASS_STORAGE_SATA)
                scc_s = "SATA";
-       else if (cc == 0x0104)
+       else if (cc == PCI_CLASS_STORAGE_RAID)
                scc_s = "RAID";
        else
                scc_s = "unknown";
@@ -1685,13 +1687,9 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
 
-       /* JMicron-specific fixup: make sure we're in AHCI mode */
-       /* This is protected from races with ata_jmicron by the pci probe
-          locking */
        if (pdev->vendor == PCI_VENDOR_ID_JMICRON) {
-               /* AHCI enable, AHCI on function 0 */
-               pci_write_config_byte(pdev, 0x41, 0xa1);
-               /* Function 1 is the PATA controller */
+               /* Function 1 is the PATA controller except on the 368, where
+                  we are not AHCI anyway */
                if (PCI_FUNC(pdev->devfn))
                        return -ENODEV;
        }
@@ -1794,8 +1792,7 @@ static void ahci_remove_one (struct pci_dev *pdev)
        unsigned int i;
        int have_msi;
 
-       for (i = 0; i < host->n_ports; i++)
-               ata_port_detach(host->ports[i]);
+       ata_host_detach(host);
 
        have_msi = hpriv->flags & AHCI_FLAG_MSI;
        free_irq(host->irq, host);