]> Pileus Git - ~andy/linux/commitdiff
ide: move legacy ISA/VLB ports handling to ide-legacy.c (v2)
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Mon, 29 Dec 2008 19:27:37 +0000 (20:27 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Mon, 29 Dec 2008 19:27:37 +0000 (20:27 +0100)
* Move legacy ISA/VLB ports handling from ide-probe.c to ide-legacy.c.

* Add CONFIG_IDE_LEGACY config option to be selected by host drivers
  needing ide-legacy.c.

v2:
Fix CONFIG_IDE_LEGACY not being defined in Kconfig.
(from Takashi Iwai <tiwai@suse.de>)

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/Kconfig
drivers/ide/Makefile
drivers/ide/ide-legacy.c [new file with mode: 0644]
drivers/ide/ide-probe.c

index e6857e01d1bad372da0c62480753adbd1266d1f4..7a0a84b042c9e4e1dd42b64b4faf09775147b34a 100644 (file)
@@ -62,6 +62,9 @@ config IDE_TIMINGS
 config IDE_ATAPI
        bool
 
+config IDE_LEGACY
+       bool
+
 config BLK_DEV_IDE_SATA
        bool "Support for SATA (deprecated; conflicts with libata SATA driver)"
        default n
@@ -856,6 +859,7 @@ config BLK_DEV_4DRIVES
 config BLK_DEV_ALI14XX
        tristate "ALI M14xx support"
        select IDE_TIMINGS
+       select IDE_LEGACY
        help
          This driver is enabled at runtime using the "ali14xx.probe" kernel
          boot parameter.  It enables support for the secondary IDE interface
@@ -866,6 +870,7 @@ config BLK_DEV_ALI14XX
 
 config BLK_DEV_DTC2278
        tristate "DTC-2278 support"
+       select IDE_LEGACY
        help
          This driver is enabled at runtime using the "dtc2278.probe" kernel
          boot parameter. It enables support for the secondary IDE interface
@@ -876,6 +881,7 @@ config BLK_DEV_DTC2278
 config BLK_DEV_HT6560B
        tristate "Holtek HT6560B support"
        select IDE_TIMINGS
+       select IDE_LEGACY
        help
          This driver is enabled at runtime using the "ht6560b.probe" kernel
          boot parameter. It enables support for the secondary IDE interface
@@ -886,6 +892,7 @@ config BLK_DEV_HT6560B
 config BLK_DEV_QD65XX
        tristate "QDI QD65xx support"
        select IDE_TIMINGS
+       select IDE_LEGACY
        help
          This driver is enabled at runtime using the "qd65xx.probe" kernel
          boot parameter.  It permits faster I/O speeds to be set.  See the
@@ -894,6 +901,7 @@ config BLK_DEV_QD65XX
 
 config BLK_DEV_UMC8672
        tristate "UMC-8672 support"
+       select IDE_LEGACY
        help
          This driver is enabled at runtime using the "umc8672.probe" kernel
          boot parameter. It enables support for the secondary IDE interface
index bdc7b81bc04410e2b07c0ce0e453416a76beb2e6..177e3f8523edd2fb16c106d21ecd5848f44fd1fe 100644 (file)
@@ -15,6 +15,7 @@ ide-core-$(CONFIG_BLK_DEV_IDEDMA)     += ide-dma.o
 ide-core-$(CONFIG_BLK_DEV_IDEDMA_SFF)  += ide-dma-sff.o
 ide-core-$(CONFIG_IDE_PROC_FS)         += ide-proc.o
 ide-core-$(CONFIG_BLK_DEV_IDEACPI)     += ide-acpi.o
+ide-core-$(CONFIG_IDE_LEGACY)          += ide-legacy.o
 
 obj-$(CONFIG_IDE)                      += ide-core.o
 
diff --git a/drivers/ide/ide-legacy.c b/drivers/ide/ide-legacy.c
new file mode 100644 (file)
index 0000000..8c5dcbf
--- /dev/null
@@ -0,0 +1,58 @@
+#include <linux/kernel.h>
+#include <linux/ide.h>
+
+static void ide_legacy_init_one(hw_regs_t **hws, hw_regs_t *hw,
+                               u8 port_no, const struct ide_port_info *d,
+                               unsigned long config)
+{
+       unsigned long base, ctl;
+       int irq;
+
+       if (port_no == 0) {
+               base = 0x1f0;
+               ctl  = 0x3f6;
+               irq  = 14;
+       } else {
+               base = 0x170;
+               ctl  = 0x376;
+               irq  = 15;
+       }
+
+       if (!request_region(base, 8, d->name)) {
+               printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
+                               d->name, base, base + 7);
+               return;
+       }
+
+       if (!request_region(ctl, 1, d->name)) {
+               printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
+                               d->name, ctl);
+               release_region(base, 8);
+               return;
+       }
+
+       ide_std_init_ports(hw, base, ctl);
+       hw->irq = irq;
+       hw->chipset = d->chipset;
+       hw->config = config;
+
+       hws[port_no] = hw;
+}
+
+int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config)
+{
+       hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL };
+
+       memset(&hw, 0, sizeof(hw));
+
+       if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0)
+               ide_legacy_init_one(hws, &hw[0], 0, d, config);
+       ide_legacy_init_one(hws, &hw[1], 1, d, config);
+
+       if (hws[0] == NULL && hws[1] == NULL &&
+           (d->host_flags & IDE_HFLAG_SINGLE))
+               return -ENOENT;
+
+       return ide_host_add(d, hws, NULL);
+}
+EXPORT_SYMBOL_GPL(ide_legacy_device_add);
index 6d11f180bd1ff7b4bc7c8d8ae6695e322f0c74ae..2333a5a8351921e7850fda9b51aa7ea38b899be3 100644 (file)
@@ -1755,59 +1755,3 @@ void ide_port_scan(ide_hwif_t *hwif)
        ide_proc_port_register_devices(hwif);
 }
 EXPORT_SYMBOL_GPL(ide_port_scan);
-
-static void ide_legacy_init_one(hw_regs_t **hws, hw_regs_t *hw,
-                               u8 port_no, const struct ide_port_info *d,
-                               unsigned long config)
-{
-       unsigned long base, ctl;
-       int irq;
-
-       if (port_no == 0) {
-               base = 0x1f0;
-               ctl  = 0x3f6;
-               irq  = 14;
-       } else {
-               base = 0x170;
-               ctl  = 0x376;
-               irq  = 15;
-       }
-
-       if (!request_region(base, 8, d->name)) {
-               printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
-                               d->name, base, base + 7);
-               return;
-       }
-
-       if (!request_region(ctl, 1, d->name)) {
-               printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
-                               d->name, ctl);
-               release_region(base, 8);
-               return;
-       }
-
-       ide_std_init_ports(hw, base, ctl);
-       hw->irq = irq;
-       hw->chipset = d->chipset;
-       hw->config = config;
-
-       hws[port_no] = hw;
-}
-
-int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config)
-{
-       hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL };
-
-       memset(&hw, 0, sizeof(hw));
-
-       if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0)
-               ide_legacy_init_one(hws, &hw[0], 0, d, config);
-       ide_legacy_init_one(hws, &hw[1], 1, d, config);
-
-       if (hws[0] == NULL && hws[1] == NULL &&
-           (d->host_flags & IDE_HFLAG_SINGLE))
-               return -ENOENT;
-
-       return ide_host_add(d, hws, NULL);
-}
-EXPORT_SYMBOL_GPL(ide_legacy_device_add);