]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ata/pata_amd.c
[PATCH] ahci: readability tweak
[linux-2.6-omap-h63xx.git] / drivers / ata / pata_amd.c
index 6ab568428a14bc24f15985d286939fb90755251d..29234c897118eb5d84cfaf08b18cd8560d524390 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME "pata_amd"
-#define DRV_VERSION "0.2.2"
+#define DRV_VERSION "0.2.4"
 
 /**
  *     timing_setup            -       shared timing computation and load
@@ -136,12 +136,9 @@ static int amd_pre_reset(struct ata_port *ap)
 
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        u8 ata66;
-       
-       if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no])) {
-               ata_port_disable(ap);
-               printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
-               return 0;
-       }
+
+       if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no]))
+               return -ENOENT;
 
        pci_read_config_byte(pdev, 0x42, &ata66);
        if (ata66 & bitmask[ap->port_no])
@@ -167,11 +164,9 @@ static int amd_early_pre_reset(struct ata_port *ap)
                { 0x40, 1, 0x01, 0x01 }
        };
 
-       if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no])) {
-               ata_port_disable(ap);
-               printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
-               return 0;
-       }
+       if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no]))
+               return -ENOENT;
+
        /* No host side cable detection */
        ap->cbl = ATA_CBL_PATA80;
        return ata_std_prereset(ap);
@@ -253,11 +248,18 @@ static void amd133_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 
 static int nv_pre_reset(struct ata_port *ap) {
        static const u8 bitmask[2] = {0x03, 0xC0};
+       static const struct pci_bits nv_enable_bits[] = {
+               { 0x50, 1, 0x02, 0x02 },
+               { 0x50, 1, 0x01, 0x01 }
+       };
 
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        u8 ata66;
        u16 udma;
 
+       if (!pci_test_config_bits(pdev, &nv_enable_bits[ap->port_no]))
+               return -ENOENT;
+
        pci_read_config_byte(pdev, 0x52, &ata66);
        if (ata66 & bitmask[ap->port_no])
                ap->cbl = ATA_CBL_PATA80;
@@ -357,7 +359,7 @@ static struct ata_port_operations amd33_port_ops = {
 
        .qc_prep        = ata_qc_prep,
        .qc_issue       = ata_qc_issue_prot,
-       .eng_timeout    = ata_eng_timeout,
+
        .data_xfer      = ata_pio_data_xfer,
 
        .irq_handler    = ata_interrupt,
@@ -391,7 +393,7 @@ static struct ata_port_operations amd66_port_ops = {
 
        .qc_prep        = ata_qc_prep,
        .qc_issue       = ata_qc_issue_prot,
-       .eng_timeout    = ata_eng_timeout,
+
        .data_xfer      = ata_pio_data_xfer,
 
        .irq_handler    = ata_interrupt,
@@ -425,7 +427,7 @@ static struct ata_port_operations amd100_port_ops = {
 
        .qc_prep        = ata_qc_prep,
        .qc_issue       = ata_qc_issue_prot,
-       .eng_timeout    = ata_eng_timeout,
+
        .data_xfer      = ata_pio_data_xfer,
 
        .irq_handler    = ata_interrupt,
@@ -459,7 +461,7 @@ static struct ata_port_operations amd133_port_ops = {
 
        .qc_prep        = ata_qc_prep,
        .qc_issue       = ata_qc_issue_prot,
-       .eng_timeout    = ata_eng_timeout,
+
        .data_xfer      = ata_pio_data_xfer,
 
        .irq_handler    = ata_interrupt,
@@ -493,7 +495,7 @@ static struct ata_port_operations nv100_port_ops = {
 
        .qc_prep        = ata_qc_prep,
        .qc_issue       = ata_qc_issue_prot,
-       .eng_timeout    = ata_eng_timeout,
+
        .data_xfer      = ata_pio_data_xfer,
 
        .irq_handler    = ata_interrupt,
@@ -527,7 +529,7 @@ static struct ata_port_operations nv133_port_ops = {
 
        .qc_prep        = ata_qc_prep,
        .qc_issue       = ata_qc_issue_prot,
-       .eng_timeout    = ata_eng_timeout,
+
        .data_xfer      = ata_pio_data_xfer,
 
        .irq_handler    = ata_interrupt,
@@ -660,27 +662,28 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 }
 
 static const struct pci_device_id amd[] = {
-       { PCI_VENDOR_ID_AMD,    PCI_DEVICE_ID_AMD_COBRA_7401,           PCI_ANY_ID, PCI_ANY_ID, 0, 0,  0 },
-       { PCI_VENDOR_ID_AMD,    PCI_DEVICE_ID_AMD_VIPER_7409,           PCI_ANY_ID, PCI_ANY_ID, 0, 0,  1 },
-       { PCI_VENDOR_ID_AMD,    PCI_DEVICE_ID_AMD_VIPER_7411,           PCI_ANY_ID, PCI_ANY_ID, 0, 0,  3 },
-       { PCI_VENDOR_ID_AMD,    PCI_DEVICE_ID_AMD_OPUS_7441,            PCI_ANY_ID, PCI_ANY_ID, 0, 0,  4 },
-       { PCI_VENDOR_ID_AMD,    PCI_DEVICE_ID_AMD_8111_IDE,             PCI_ANY_ID, PCI_ANY_ID, 0, 0,  5 },
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_IDE,        PCI_ANY_ID, PCI_ANY_ID, 0, 0,  7 },
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE,       PCI_ANY_ID, PCI_ANY_ID, 0, 0,  8 },
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE,      PCI_ANY_ID, PCI_ANY_ID, 0, 0,  8 },
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE,       PCI_ANY_ID, PCI_ANY_ID, 0, 0,  8 },
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE,      PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
-       { PCI_VENDOR_ID_AMD,    PCI_DEVICE_ID_AMD_CS5536_IDE,           PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9 },
-       { 0, },
+       { PCI_VDEVICE(AMD,      PCI_DEVICE_ID_AMD_COBRA_7401),          0 },
+       { PCI_VDEVICE(AMD,      PCI_DEVICE_ID_AMD_VIPER_7409),          1 },
+       { PCI_VDEVICE(AMD,      PCI_DEVICE_ID_AMD_VIPER_7411),          3 },
+       { PCI_VDEVICE(AMD,      PCI_DEVICE_ID_AMD_OPUS_7441),           4 },
+       { PCI_VDEVICE(AMD,      PCI_DEVICE_ID_AMD_8111_IDE),            5 },
+       { PCI_VDEVICE(NVIDIA,   PCI_DEVICE_ID_NVIDIA_NFORCE_IDE),       7 },
+       { PCI_VDEVICE(NVIDIA,   PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE),      8 },
+       { PCI_VDEVICE(NVIDIA,   PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE),     8 },
+       { PCI_VDEVICE(NVIDIA,   PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE),      8 },
+       { PCI_VDEVICE(NVIDIA,   PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE),     8 },
+       { PCI_VDEVICE(NVIDIA,   PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE), 8 },
+       { PCI_VDEVICE(NVIDIA,   PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE), 8 },
+       { PCI_VDEVICE(NVIDIA,   PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE), 8 },
+       { PCI_VDEVICE(NVIDIA,   PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE), 8 },
+       { PCI_VDEVICE(NVIDIA,   PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE), 8 },
+       { PCI_VDEVICE(AMD,      PCI_DEVICE_ID_AMD_CS5536_IDE),          9 },
+
+       { },
 };
 
 static struct pci_driver amd_pci_driver = {
-        .name          = DRV_NAME,
+       .name           = DRV_NAME,
        .id_table       = amd,
        .probe          = amd_init_one,
        .remove         = ata_pci_remove_one
@@ -696,7 +699,6 @@ static void __exit amd_exit(void)
        pci_unregister_driver(&amd_pci_driver);
 }
 
-
 MODULE_AUTHOR("Alan Cox");
 MODULE_DESCRIPTION("low-level driver for AMD PATA IDE");
 MODULE_LICENSE("GPL");