Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[safe/jmp/linux-2.6] / drivers / ide / ide-generic.c
index 3a93e4c..54d7c46 100644 (file)
 #include <linux/ide.h>
 #include <linux/pci_ids.h>
 
-/* FIXME: convert m32r to use ide_platform host driver */
+/* FIXME: convert arm and m32r to use ide_platform host driver */
+#ifdef CONFIG_ARM
+#include <asm/irq.h>
+#endif
 #ifdef CONFIG_M32R
 #include <asm/m32r.h>
 #endif
@@ -26,10 +29,14 @@ MODULE_PARM_DESC(probe_mask, "probe mask for legacy ISA IDE ports");
 
 static const struct ide_port_info ide_generic_port_info = {
        .host_flags             = IDE_HFLAG_NO_DMA,
+       .chipset                = ide_generic,
 };
 
-#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) \
-       || defined(CONFIG_PLAT_OPSPUT)
+#ifdef CONFIG_ARM
+static const u16 legacy_bases[] = { 0x1f0 };
+static const int legacy_irqs[]  = { IRQ_HARDDISK };
+#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) || \
+      defined(CONFIG_PLAT_OPSPUT)
 static const u16 legacy_bases[] = { 0x1f0 };
 static const int legacy_irqs[]  = { PLD_IRQ_CFIREQ };
 #elif defined(CONFIG_PLAT_MAPPI3)
@@ -45,11 +52,11 @@ static const int legacy_irqs[]  = { 14, 15, 11, 10, 8, 12 };
 
 static void ide_generic_check_pci_legacy_iobases(int *primary, int *secondary)
 {
+#ifdef CONFIG_PCI
        struct pci_dev *p = NULL;
        u16 val;
 
        for_each_pci_dev(p) {
-
                if (pci_resource_start(p, 0) == 0x1f0)
                        *primary = 1;
                if (pci_resource_start(p, 2) == 0x170)
@@ -64,7 +71,6 @@ static void ide_generic_check_pci_legacy_iobases(int *primary, int *secondary)
                /* Intel MPIIX - PIO ATA on non PCI side of bridge */
                if (p->vendor == PCI_VENDOR_ID_INTEL &&
                    p->device == PCI_DEVICE_ID_INTEL_82371MX) {
-
                        pci_read_config_word(p, 0x6C, &val);
                        if (val & 0x8000) {
                                /* ATA port enabled */
@@ -75,11 +81,12 @@ static void ide_generic_check_pci_legacy_iobases(int *primary, int *secondary)
                        }
                }
        }
+#endif
 }
 
 static int __init ide_generic_init(void)
 {
-       hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
+       struct ide_hw hw, *hws[] = { &hw };
        unsigned long io_addr;
        int i, rc = 0, primary = 0, secondary = 0;
 
@@ -106,6 +113,7 @@ static int __init ide_generic_init(void)
                                printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX "
                                                "not free.\n",
                                                DRV_NAME, io_addr, io_addr + 7);
+                               rc = -EBUSY;
                                continue;
                        }
 
@@ -114,6 +122,7 @@ static int __init ide_generic_init(void)
                                                "not free.\n",
                                                DRV_NAME, io_addr + 0x206);
                                release_region(io_addr, 8);
+                               rc = -EBUSY;
                                continue;
                        }
 
@@ -124,9 +133,7 @@ static int __init ide_generic_init(void)
 #else
                        hw.irq = legacy_irqs[i];
 #endif
-                       hw.chipset = ide_generic;
-
-                       rc = ide_host_add(&ide_generic_port_info, hws, NULL);
+                       rc = ide_host_add(&ide_generic_port_info, hws, 1, NULL);
                        if (rc) {
                                release_region(io_addr + 0x206, 1);
                                release_region(io_addr, 8);