[PATCH] Modular IDE completely broken

Taral
2003-06-01T05:41:01Z

[-- Attachment #1.1: Type: text/plain, Size: 482 bytes --]

I've submitted this patch before, but I think it got ignored. This makes
modular IDE at least compile and removes the circular dependencies.

If there's a reason this patch isn't being applied (it's crappy, someone
else is working on this problem already, etc.), _please_ tell me!

--
Taral <taral@taral.net>
This message is digitally signed. Please PGP encrypt mail to me.
"Most parents have better things to do with their time than take care of
their children." -- Me

[-- Attachment #1.2: ide-mod.patch --]
[-- Type: text/plain, Size: 7650 bytes --]

diff -Nru a/drivers/ide/Makefile b/drivers/ide/Makefile
--- a/drivers/ide/Makefile Wed May 14 22:05:00 2003
+++ b/drivers/ide/Makefile Wed May 14 22:05:00 2003
@@ -12,19 +12,23 @@

# Core IDE code - must come before legacy

-obj-$(CONFIG_BLK_DEV_IDE) += ide-io.o ide-probe.o ide-geometry.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
-
+ide-mod-y := ide-probe.o ide-io.o ide-geometry.o ide-iops.o ide-taskfile.o ide.o ide-lib.o ide-default.o
+ide-mod-n :=
+ide-mod-$(CONFIG_PROC_FS) += ide-proc.o
+ide-mod-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o
+ide-mod-$(CONFIG_BLK_DEV_IDEDMA_PCI) += ide-dma.o
+ide-mod-$(CONFIG_BLK_DEV_IDE_TCQ) += ide-tcq.o
+ide-mod-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
ifeq ($(CONFIG_BLK_DEV_IDE),y)
-obj-$(CONFIG_PROC_FS) += ide-proc.o
+obj-y += $(ide-mod-y)
+endif
+ifeq ($(CONFIG_BLK_DEV_IDE),m)
+obj-m += ide-mod.o
endif

obj-$(CONFIG_BLK_DEV_IDE) += legacy/ ppc/ arm/
diff -Nru a/drivers/ide/ide-default.c b/drivers/ide/ide-default.c
--- a/drivers/ide/ide-default.c Wed May 14 22:05:00 2003
+++ b/drivers/ide/ide-default.c Wed May 14 22:05:00 2003
@@ -65,7 +65,3 @@
}
return 0;
}
-
-MODULE_DESCRIPTION("IDE Default Driver");
-
-MODULE_LICENSE("GPL");
diff -Nru a/drivers/ide/ide-geometry.c b/drivers/ide/ide-geometry.c
--- a/drivers/ide/ide-geometry.c Wed May 14 22:05:00 2003
+++ b/drivers/ide/ide-geometry.c Wed May 14 22:05:00 2003
@@ -2,6 +2,7 @@
* linux/drivers/ide/ide-geometry.c
*/
#include <linux/config.h>
+#include <linux/module.h>
#include <linux/ide.h>
#include <linux/mc146818rtc.h>
#include <asm/io.h>
@@ -69,7 +70,7 @@
* Returns 1 if the geometry translation was successful.
*/

-int ide_xlate_1024 (struct block_device *bdev, int xparm, int ptheads, const char *msg)
+int ide_xlate_1024(struct block_device *bdev, int xparm, int ptheads, const char *msg)
{
ide_drive_t *drive = bdev->bd_disk->private_data;
const char *msg1 = "";
@@ -133,3 +134,4 @@
drive->bios_cyl, drive->bios_head, drive->bios_sect);
return ret;
}
+EXPORT_SYMBOL(ide_xlate_1024);
diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c Wed May 14 22:05:00 2003
+++ b/drivers/ide/ide-io.c Wed May 14 22:05:00 2003
@@ -577,7 +577,7 @@
* FIXME: this function needs a rename
*/

-ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
+static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
{
ide_startstop_t startstop;
unsigned long block;
@@ -633,8 +633,6 @@
return ide_stopped;
}

-EXPORT_SYMBOL(start_request);
-
/**
* ide_stall_queue - pause an IDE device
* @drive: drive to stall
@@ -867,14 +865,6 @@
}

EXPORT_SYMBOL(ide_do_request);
-
-/*
- * Passes the stuff to ide_do_request
- */
-void do_ide_request(request_queue_t *q)
-{
- ide_do_request(q->queuedata, IDE_NO_IRQ);
-}

/*
* un-busy the hwgroup etc, and clear any pending DMA status. we want to
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c Wed May 14 22:05:00 2003
+++ b/drivers/ide/ide-probe.c Wed May 14 22:05:00 2003
@@ -683,8 +683,6 @@
return(addr_errs);
}

-//EXPORT_SYMBOL(hwif_check_regions);
-
#define hwif_request_region(addr, num, name) \
((hwif->mmio) ? request_mem_region((addr),(num),(name)) : request_region((addr),(num),(name)))

@@ -721,8 +719,6 @@
hwif_request_region(hwif->io_ports[i], 1, hwif->name);
}

-//EXPORT_SYMBOL(hwif_register);
-
/* Enable code below on all archs later, for now, I want it on PPC
*/
#ifdef CONFIG_PPC
@@ -976,7 +972,7 @@
*
* This routine detects and reports such situations, but does not fix them.
*/
-void save_match (ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
+static void save_match (ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
{
ide_hwif_t *m = *match;

@@ -989,10 +985,17 @@
if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */
*match = new;
}
-EXPORT_SYMBOL(save_match);
#endif /* MAX_HWIFS > 1 */

/*
+ * Passes the stuff to ide_do_request
+ */
+static void do_ide_request(request_queue_t *q)
+{
+ ide_do_request(q->queuedata, IDE_NO_IRQ);
+}
+
+/*
* init request queue
*/
static void ide_init_queue(ide_drive_t *drive)
@@ -1317,8 +1320,6 @@
THIS_MODULE, ata_probe, ata_lock, hwif);
}

-EXPORT_SYMBOL(init_gendisk);
-
int hwif_init (ide_hwif_t *hwif)
{
int old_irq, unit;
@@ -1389,21 +1390,6 @@

EXPORT_SYMBOL(hwif_init);

-void export_ide_init_queue (ide_drive_t *drive)
-{
- ide_init_queue(drive);
- ide_init_drive(drive);
-}
-
-EXPORT_SYMBOL(export_ide_init_queue);
-
-u8 export_probe_for_drive (ide_drive_t *drive)
-{
- return probe_for_drive(drive);
-}
-
-EXPORT_SYMBOL(export_probe_for_drive);
-
int ideprobe_init (void);
static ide_module_t ideprobe_module = {
IDE_PROBE_MODULE,
@@ -1446,26 +1432,3 @@
MOD_DEC_USE_COUNT;
return 0;
}
-
-#ifdef MODULE
-extern int (*ide_xlate_1024_hook)(struct block_device *, int, int, const char *);
-
-int init_module (void)
-{
- unsigned int index;
-
- for (index = 0; index < MAX_HWIFS; ++index)
- ide_unregister(index);
- ideprobe_init();
- create_proc_ide_interfaces();
- ide_xlate_1024_hook = ide_xlate_1024;
- return 0;
-}
-
-void cleanup_module (void)
-{
- ide_probe = NULL;
- ide_xlate_1024_hook = 0;
-}
-MODULE_LICENSE("GPL");
-#endif /* MODULE */
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c Wed May 14 22:05:00 2003
+++ b/drivers/ide/ide.c Wed May 14 22:05:00 2003
@@ -178,6 +178,7 @@
static int initializing; /* set while initializing built-in drivers */

DECLARE_MUTEX(ide_cfg_sem);
+EXPORT_SYMBOL(ide_cfg_sem);
spinlock_t ide_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;

static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
@@ -1366,6 +1367,7 @@
if (drive->media != ide_disk)
ide_add_setting(drive, "ide-scsi", SETTING_RW, -1, HDIO_SET_IDE_SCSI, TYPE_BYTE, 0, 1, 1, 1, &drive->scsi, ide_atapi_to_scsi);
}
+EXPORT_SYMBOL(ide_add_generic_settings);

/*
* Delay for *at least* 50ms. As we don't know how much time is left
@@ -2196,7 +2198,6 @@
*/
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 */

@@ -2204,7 +2205,6 @@

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();
@@ -2467,6 +2467,7 @@
struct bus_type ide_bus_type = {
.name = "ide",
};
+EXPORT_SYMBOL(ide_bus_type);

/*
* This is gets invoked once during initialization, to set *everything* up
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c Wed May 14 22:05:00 2003
+++ b/drivers/pci/pci.c Wed May 14 22:05:00 2003
@@ -736,6 +736,7 @@
EXPORT_SYMBOL(isa_bridge);
#endif

+EXPORT_SYMBOL(pci_enable_device_bars);
EXPORT_SYMBOL(pci_enable_device);
EXPORT_SYMBOL(pci_disable_device);
EXPORT_SYMBOL(pci_max_busnr);