[PATCH] Re: [2.6] Modular IDE - problem

From: Bartlomiej Zolnierkiewicz
Date: Fri Dec 12 2003 - 18:56:30 EST


On Friday 12 of December 2003 14:31, Bartlomiej Zolnierkiewicz wrote:
> Can you try this patch for 2.6.0-test11?
>
> On Friday 12 of December 2003 14:38, Wojciech 'Sas' Cieciwa wrote:
> > Hi,
> > I try to build kernel 2.6.0-test11 + cset-20031209_2107 with modular IDE.
> >
> > But I got some wornings/errors and kernel doesn't works.
> >
> > Can anyone look at this and help me ?
> >
> > Thanx.
> > Sas.

Corrected version.
- ide-disk.o must be linked after ide.o (affects built-in case not modular)
- move initialize=1 to ide_init_data() to fix generic IDE w/o PCI support

drivers/block/ll_rw_blk.c | 2 ++
drivers/ide/Makefile | 16 ++++++++--------
drivers/ide/ide-probe-mini.c | 23 +++++++++++++++++++++++
drivers/ide/ide-probe.c | 20 +++++++++++++-------
drivers/ide/ide.c | 35 ++++++++---------------------------
include/linux/ide.h | 1 -
6 files changed, 54 insertions(+), 43 deletions(-)

diff -puN drivers/block/ll_rw_blk.c~ide-modules drivers/block/ll_rw_blk.c
--- linux-2.6.0-test11-bart1/drivers/block/ll_rw_blk.c~ide-modules 2003-12-12 23:49:03.361002480 +0100
+++ linux-2.6.0-test11-bart1-root/drivers/block/ll_rw_blk.c 2003-12-12 23:49:03.385998680 +0100
@@ -145,6 +145,8 @@ void blk_queue_activity_fn(request_queue
q->activity_data = data;
}

+EXPORT_SYMBOL(blk_queue_activity_fn);
+
/**
* blk_queue_prep_rq - set a prepare_request function for queue
* @q: queue
diff -puN drivers/ide/ide.c~ide-modules drivers/ide/ide.c
--- linux-2.6.0-test11-bart1/drivers/ide/ide.c~ide-modules 2003-12-12 23:49:03.373000656 +0100
+++ linux-2.6.0-test11-bart1-root/drivers/ide/ide.c 2003-12-12 23:50:10.433805864 +0100
@@ -189,9 +189,6 @@ int noautodma = 1;
#endif

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:
@@ -313,6 +310,8 @@ static void __init init_ide_data (void)
for (index = 0; index < MAX_HWIFS; ++index)
init_hwif_data(index);

+ initializing = 1;
+
/* Add default hw interfaces */
ide_init_default_hwifs();

@@ -443,21 +442,6 @@ u8 ide_dump_status (ide_drive_t *drive,

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;
@@ -585,8 +569,6 @@ control_region_busy:
return -EBUSY;
}

-EXPORT_SYMBOL(ide_hwif_request_regions);
-
/**
* ide_hwif_release_regions - free IDE resources
*
@@ -622,8 +604,6 @@ void ide_hwif_release_regions(ide_hwif_t
}
}

-EXPORT_SYMBOL(ide_hwif_release_regions);
-
extern void init_hwif_data(unsigned int index);

/**
@@ -992,6 +972,8 @@ void ide_setup_ports ( hw_regs_t *hw,

EXPORT_SYMBOL(ide_setup_ports);

+extern int ideprobe_init_module(void);
+
/*
* Register an IDE interface, specifying exactly the registers etc
* Set init=1 iff calling before probes have taken place.
@@ -1033,7 +1015,10 @@ found:
hwif->chipset = hw->chipset;

if (!initializing) {
- ide_probe_module();
+#ifdef MODULE
+ if (ideprobe_init_module() == -EBUSY)
+#endif
+ ideprobe_init();
#ifdef CONFIG_PROC_FS
create_proc_ide_interfaces();
#endif
@@ -1517,8 +1502,6 @@ int ata_attach(ide_drive_t *drive)
return 1;
}

-EXPORT_SYMBOL(ata_attach);
-
static int generic_ide_suspend(struct device *dev, u32 state)
{
ide_drive_t *drive = dev->driver_data;
@@ -2558,7 +2541,6 @@ EXPORT_SYMBOL(ide_fops);
*/

EXPORT_SYMBOL(ide_lock);
-EXPORT_SYMBOL(ide_probe);

struct bus_type ide_bus_type = {
.name = "ide",
@@ -2600,7 +2582,6 @@ int __init ide_init (void)
(void)qd65xx_init();
#endif

- initializing = 1;
ide_init_builtin_drivers();
initializing = 0;

diff -puN drivers/ide/ide-probe.c~ide-modules drivers/ide/ide-probe.c
--- linux-2.6.0-test11-bart1/drivers/ide/ide-probe.c~ide-modules 2003-12-12 23:49:03.376000200 +0100
+++ linux-2.6.0-test11-bart1-root/drivers/ide/ide-probe.c 2003-12-12 23:49:03.389998072 +0100
@@ -1348,27 +1348,33 @@ 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)
+static int ideprobe_done;
+
+int ideprobe_init_module(void)
{
unsigned int index;
-
+
+ if (ideprobe_done)
+ return -EBUSY;
+
for (index = 0; index < MAX_HWIFS; ++index)
ide_unregister(index);
ideprobe_init();
create_proc_ide_interfaces();
+ ideprobe_done = 1;
return 0;
}

-void cleanup_module (void)
+EXPORT_SYMBOL_GPL(ideprobe_init_module);
+
+void ideprobe_cleanup_module(void)
{
- ide_probe = NULL;
}
-MODULE_LICENSE("GPL");
+
+EXPORT_SYMBOL_GPL(ideprobe_cleanup_module);
#endif /* MODULE */
diff -puN /dev/null drivers/ide/ide-probe-mini.c
--- /dev/null 2003-01-30 11:24:37.000000000 +0100
+++ linux-2.6.0-test11-bart1-root/drivers/ide/ide-probe-mini.c 2003-12-12 23:49:03.389998072 +0100
@@ -0,0 +1,23 @@
+/*
+ * linux/drivers/ide/ide-probe-mini.c Version 1
+ *
+ * Copyright (C) 1994-1998 Linus Torvalds & authors (see below)
+ */
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/string.h>
+#include <linux/kernel.h>
+#include <linux/kmod.h>
+
+#ifdef MODULE
+extern int ideprobe_init_module(void);
+extern void ideprobe_cleanup_module(void);
+
+module_init(ideprobe_init_module);
+module_exit(ideprobe_cleanup_module);
+
+MODULE_LICENSE("GPL");
+#endif
diff -puN drivers/ide/Makefile~ide-modules drivers/ide/Makefile
--- linux-2.6.0-test11-bart1/drivers/ide/Makefile~ide-modules 2003-12-12 23:49:03.378999744 +0100
+++ linux-2.6.0-test11-bart1-root/drivers/ide/Makefile 2003-12-12 23:50:02.471016392 +0100
@@ -10,22 +10,22 @@
# First come modules that register themselves with the core
obj-$(CONFIG_BLK_DEV_IDE) += pci/

+ide-core-objs := ide-io.o ide-probe.o ide-iops.o ide-taskfile.o ide.o ide-lib.o ide-default.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
+
+obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o ide-probe-mini.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_HD) += legacy/
diff -puN include/linux/ide.h~ide-modules include/linux/ide.h
--- linux-2.6.0-test11-bart1/include/linux/ide.h~ide-modules 2003-12-12 23:49:03.381999288 +0100
+++ linux-2.6.0-test11-bart1-root/include/linux/ide.h 2003-12-12 23:49:03.391997768 +0100
@@ -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;

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/