]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fix/improve modular IDE
authorBartlomiej Zolnierkiewicz <b.zolnierkiewicz@elka.pw.edu.pl>
Sun, 1 Feb 2004 10:17:14 +0000 (02:17 -0800)
committerDavid S. Miller <davem@nuts.davemloft.net>
Sun, 1 Feb 2004 10:17:14 +0000 (02:17 -0800)
This has been in -mm since 2.6.1-mm5

 - IDE can be used as module again (compiles and works),
   this fixes bugzilla bugs #576 and #1700
 - separate module for probing is no longer required
 - generic/default host driver is available as ide_generic module

This contains the build fixes by Adrian Bunk and Andrew Morton.

drivers/block/ll_rw_blk.c
drivers/ide/Kconfig
drivers/ide/Makefile
drivers/ide/ide-generic.c [new file with mode: 0644]
drivers/ide/ide-probe.c
drivers/ide/ide.c
drivers/ide/legacy/Makefile
drivers/ide/pci/Makefile
drivers/ide/ppc/Makefile [deleted file]
include/linux/ide.h

index c23382abd4f548c41d76839ced4ac5096aa27681..c3974ba569aee5cb92c9c12d80975378924559d4 100644 (file)
@@ -145,6 +145,8 @@ void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data)
        q->activity_data = data;
 }
 
+EXPORT_SYMBOL(blk_queue_activity_fn);
+
 /**
  * blk_queue_prep_rq - set a prepare_request function for queue
  * @q:         queue
index 7889c28de3db9687535ac5ac31bf126485169bd0..f58c227813c54de81fc8e84be69fc49338c41a79 100644 (file)
@@ -296,6 +296,12 @@ config IDE_TASKFILE_IO
 
 comment "IDE chipset support/bugfixes"
 
+config IDE_GENERIC
+       tristate "generic/default IDE chipset support"
+       default y
+       help
+         If unsure, say Y.
+
 config BLK_DEV_CMD640
        bool "CMD640 chipset bugfix/support"
        depends on X86
index ac76a4308ed11288b5b7bc3c2c9c6511525208d6..488c784ce670f276b565141ef499ddc56ccd35af 100644 (file)
@@ -13,22 +13,38 @@ EXTRA_CFLAGS                                += -Idrivers/ide
 
 obj-$(CONFIG_BLK_DEV_IDE)              += pci/
 
+ide-core-y += ide.o ide-default.o ide-io.o ide-iops.o ide-lib.o ide-probe.o \
+       ide-taskfile.o
+
+ide-core-$(CONFIG_BLK_DEV_CMD640)      += pci/cmd640.o
+
 # Core IDE code - must come before legacy
+ide-core-$(CONFIG_BLK_DEV_IDEPCI)      += setup-pci.o
+ide-core-$(CONFIG_BLK_DEV_IDEDMA_PCI)  += ide-dma.o
+ide-core-$(CONFIG_BLK_DEV_IDE_TCQ)     += ide-tcq.o
+ide-core-$(CONFIG_PROC_FS)             += ide-proc.o
+ide-core-$(CONFIG_BLK_DEV_IDEPNP)      += ide-pnp.o
+
+# built-in only drivers from legacy/
+ide-core-$(CONFIG_BLK_DEV_IDE_PC9800)  += legacy/pc9800.o
+ide-core-$(CONFIG_BLK_DEV_BUDDHA)      += legacy/buddha.o
+ide-core-$(CONFIG_BLK_DEV_FALCON_IDE)  += legacy/falconide.o
+ide-core-$(CONFIG_BLK_DEV_GAYLE)       += legacy/gayle.o
+ide-core-$(CONFIG_BLK_DEV_MAC_IDE)     += legacy/macide.o
+ide-core-$(CONFIG_BLK_DEV_Q40IDE)      += legacy/q40ide.o
+
+# built-in only drivers from ppc/
+ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE)  += ppc/mpc8xx.o
+ide-core-$(CONFIG_BLK_DEV_IDE_PMAC)    += ppc/pmac.o
+ide-core-$(CONFIG_BLK_DEV_IDE_SWARM)   += ppc/swarm.o
+
+obj-$(CONFIG_BLK_DEV_IDE)              += ide-core.o
+obj-$(CONFIG_IDE_GENERIC)              += ide-generic.o
 
-obj-$(CONFIG_BLK_DEV_IDE)              += ide-io.o ide-probe.o ide-iops.o ide-taskfile.o ide.o ide-lib.o ide-default.o
 obj-$(CONFIG_BLK_DEV_IDEDISK)          += ide-disk.o
 obj-$(CONFIG_BLK_DEV_IDECD)            += ide-cd.o
 obj-$(CONFIG_BLK_DEV_IDETAPE)          += ide-tape.o
 obj-$(CONFIG_BLK_DEV_IDEFLOPPY)                += ide-floppy.o
 
-obj-$(CONFIG_BLK_DEV_IDEPCI)           += setup-pci.o
-obj-$(CONFIG_BLK_DEV_IDEDMA_PCI)       += ide-dma.o
-obj-$(CONFIG_BLK_DEV_IDE_TCQ)          += ide-tcq.o
-obj-$(CONFIG_BLK_DEV_IDEPNP)           += ide-pnp.o
-
-ifeq ($(CONFIG_BLK_DEV_IDE),y)
-obj-$(CONFIG_PROC_FS)                  += ide-proc.o
-endif
-
-obj-$(CONFIG_BLK_DEV_IDE)              += legacy/ ppc/ arm/
+obj-$(CONFIG_BLK_DEV_IDE)              += legacy/ arm/
 obj-$(CONFIG_BLK_DEV_HD)               += legacy/
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c
new file mode 100644 (file)
index 0000000..ee27933
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * generic/default IDE host driver
+ *
+ * Copyright (C) 2004 Bartlomiej Zolnierkiewicz
+ * This code was split off from ide.c.  See it for original copyrights.
+ *
+ * May be copied or modified under the terms of the GNU General Public License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/ide.h>
+
+static int __init ide_generic_init(void)
+{
+       MOD_INC_USE_COUNT;
+       if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
+               ide_get_lock(NULL, NULL); /* for atari only */
+
+       (void)ideprobe_init();
+
+       if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
+               ide_release_lock();     /* for atari only */
+
+#ifdef CONFIG_PROC_FS
+       create_proc_ide_interfaces();
+#endif
+       return 0;
+}
+
+module_init(ide_generic_init);
+
+MODULE_LICENSE("GPL");
index 59d3da8c6e48e28bd121889830dc7d656e32cf19..2d75b2cf8bb59b80d661533f0a67cd4356cd9ad1 100644 (file)
@@ -1322,8 +1322,7 @@ int ideprobe_init (void)
 {
        unsigned int index;
        int probe[MAX_HWIFS];
-       
-       MOD_INC_USE_COUNT;
+
        memset(probe, 0, MAX_HWIFS * sizeof(int));
        for (index = 0; index < MAX_HWIFS; ++index)
                probe[index] = !ide_hwifs[index].present;
@@ -1350,27 +1349,7 @@ int ideprobe_init (void)
                                        ata_attach(&hwif->drives[unit]);
                }
        }
-       if (!ide_probe)
-               ide_probe = &ideprobe_init;
-       MOD_DEC_USE_COUNT;
        return 0;
 }
 
-#ifdef MODULE
-int init_module (void)
-{
-       unsigned int index;
-       
-       for (index = 0; index < MAX_HWIFS; ++index)
-               ide_unregister(index);
-       ideprobe_init();
-       create_proc_ide_interfaces();
-       return 0;
-}
-
-void cleanup_module (void)
-{
-       ide_probe = NULL;
-}
-MODULE_LICENSE("GPL");
-#endif /* MODULE */
+EXPORT_SYMBOL_GPL(ideprobe_init);
index 01134b2e1bb0895ac5ee4a87ac12977dbf8fd82a..25b79a70ee02abd5d69c9009642800a291cbc60d 100644 (file)
 #include <linux/cdrom.h>
 #include <linux/seq_file.h>
 #include <linux/device.h>
-#include <linux/kmod.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
@@ -191,8 +190,6 @@ int noautodma = 1;
 EXPORT_SYMBOL(noautodma);
 EXPORT_SYMBOL(ide_bus_type);
 
-int (*ide_probe)(void);
-
 /*
  * This is declared extern in ide.h, for access by other IDE modules:
  */
@@ -443,21 +440,6 @@ u8 ide_dump_status (ide_drive_t *drive, const char *msg, u8 stat)
 
 EXPORT_SYMBOL(ide_dump_status);
 
-
-
-void ide_probe_module (void)
-{
-       if (!ide_probe) {
-#if defined(CONFIG_KMOD) && defined(CONFIG_BLK_DEV_IDE_MODULE)
-               (void) request_module("ide-probe-mod");
-#endif /* (CONFIG_KMOD) && (CONFIG_BLK_DEV_IDE_MODULE) */
-       } else {
-               (void)ide_probe();
-       }
-}
-
-EXPORT_SYMBOL(ide_probe_module);
-
 static int ide_open (struct inode * inode, struct file * filp)
 {
        return -ENXIO;
@@ -1033,7 +1015,7 @@ found:
        hwif->chipset = hw->chipset;
 
        if (!initializing) {
-               ide_probe_module();
+               probe_hwif_init(hwif);
 #ifdef CONFIG_PROC_FS
                create_proc_ide_interfaces();
 #endif
@@ -2276,28 +2258,6 @@ static void __init probe_for_hwifs (void)
 #endif /* CONFIG_BLK_DEV_IDEPNP */
 }
 
-void __init ide_init_builtin_drivers (void)
-{
-       /*
-        * Probe for special PCI and other "known" interface chipsets
-        */
-       probe_for_hwifs ();
-
-#ifdef CONFIG_BLK_DEV_IDE
-       if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
-               ide_get_lock(NULL, NULL); /* for atari only */
-
-       (void) ideprobe_init();
-
-       if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
-               ide_release_lock();     /* for atari only */
-#endif /* CONFIG_BLK_DEV_IDE */
-
-#ifdef CONFIG_PROC_FS
-       proc_ide_create();
-#endif
-}
-
 /*
  *     Actually unregister the subdriver. Called with the
  *     request lock dropped.
@@ -2558,7 +2518,6 @@ EXPORT_SYMBOL(ide_fops);
  */
 
 EXPORT_SYMBOL(ide_lock);
-EXPORT_SYMBOL(ide_probe);
 
 struct bus_type ide_bus_type = {
        .name           = "ide",
@@ -2601,9 +2560,13 @@ int __init ide_init (void)
 #endif
 
        initializing = 1;
-       ide_init_builtin_drivers();
+       /* Probe for special PCI and other "known" interface chipsets. */
+       probe_for_hwifs();
        initializing = 0;
 
+#ifdef CONFIG_PROC_FS
+       proc_ide_create();
+#endif
        return 0;
 }
 
index 9d3feaf52fb4dee0873806620a683b4be083d713..ad8ae32b81938b10148500d2c5c4b24ebdc10ec1 100644 (file)
@@ -2,17 +2,10 @@
 obj-$(CONFIG_BLK_DEV_ALI14XX)          += ali14xx.o
 obj-$(CONFIG_BLK_DEV_DTC2278)          += dtc2278.o
 obj-$(CONFIG_BLK_DEV_HT6560B)          += ht6560b.o
-obj-$(CONFIG_BLK_DEV_IDE_PC9800)       += pc9800.o
 obj-$(CONFIG_BLK_DEV_PDC4030)          += pdc4030.o
 obj-$(CONFIG_BLK_DEV_QD65XX)           += qd65xx.o
 obj-$(CONFIG_BLK_DEV_UMC8672)          += umc8672.o
 
-obj-$(CONFIG_BLK_DEV_BUDDHA)           += buddha.o
-obj-$(CONFIG_BLK_DEV_FALCON_IDE)       += falconide.o
-obj-$(CONFIG_BLK_DEV_GAYLE)            += gayle.o
-obj-$(CONFIG_BLK_DEV_MAC_IDE)          += macide.o
-obj-$(CONFIG_BLK_DEV_Q40IDE)           += q40ide.o
-
 obj-$(CONFIG_BLK_DEV_IDECS)            += ide-cs.o
 
 # Last of all
index 3d2e1213fa117630f97a9d9fd24fc389c3521226..ddaee15b1d52bcdd1f39c49d1c2918417f7722a2 100644 (file)
@@ -3,7 +3,6 @@ obj-$(CONFIG_BLK_DEV_ADMA100)           += adma100.o
 obj-$(CONFIG_BLK_DEV_AEC62XX)          += aec62xx.o
 obj-$(CONFIG_BLK_DEV_ALI15X3)          += alim15x3.o
 obj-$(CONFIG_BLK_DEV_AMD74XX)          += amd74xx.o
-obj-$(CONFIG_BLK_DEV_CMD640)           += cmd640.o
 obj-$(CONFIG_BLK_DEV_CMD64X)           += cmd64x.o
 obj-$(CONFIG_BLK_DEV_CS5520)           += cs5520.o
 obj-$(CONFIG_BLK_DEV_CS5530)           += cs5530.o
diff --git a/drivers/ide/ppc/Makefile b/drivers/ide/ppc/Makefile
deleted file mode 100644 (file)
index 6fc3fa3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-
-obj-$(CONFIG_BLK_DEV_MPC8xx_IDE)       += mpc8xx.o
-obj-$(CONFIG_BLK_DEV_IDE_PMAC)         += pmac.o
-obj-$(CONFIG_BLK_DEV_IDE_SWARM)                += swarm.o
-
-EXTRA_CFLAGS   := -Idrivers/ide
index ea10e916d9eb1ee9964f293a842a77a3d39211d7..ef73baf33fc8f48c9a377e571c04d69cb73505bf 100644 (file)
@@ -1231,7 +1231,6 @@ typedef struct ide_devices_s {
  */
 #ifndef _IDE_C
 extern ide_hwif_t      ide_hwifs[];            /* master data repository */
-extern int (*ide_probe)(void);
 
 extern ide_devices_t   *idedisk;
 extern ide_devices_t   *idecd;