[PATCH 8/8] ide: fix ide.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[PATCH] ide: fix ide.c #ifdef madness

For some built-in host driver we need to take care of the order in which they
are probed.  Do this during link time and remove all ugly #ifdefs from ide.c.

[ We can probe m68k specific drivers before PCI drivers (no PCI on m68k except
  broken for ages HADES), ide-cris (cris arch specific), cmd640 (x86 specific)
  and pmac (powerpc specific). ]

While at it add missing __init tags to macide/q40ide drivers, fix non-ascii
character in q40ide and remove bogus comment from ide.c.

[ To test this patch I tested some strange combinations of host drivers
  (i.e. ali14xx vs setup-pci vs cmd640) and the probe order is preserved
  as it should be. ]

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>

---
 drivers/ide/Makefile           |   52 +++++++++++-------
 drivers/ide/cris/ide-cris.c    |   13 +++-
 drivers/ide/h8300/Makefile     |    2 
 drivers/ide/h8300/ide-h8300.c  |   12 +++-
 drivers/ide/ide-pnp.c          |    6 +-
 drivers/ide/ide.c              |  116 +----------------------------------------
 drivers/ide/legacy/Makefile    |   17 ++++--
 drivers/ide/legacy/ali14xx.c   |    6 --
 drivers/ide/legacy/buddha.c    |   12 +++-
 drivers/ide/legacy/dtc2278.c   |    6 --
 drivers/ide/legacy/falconide.c |   12 +++-
 drivers/ide/legacy/gayle.c     |   12 +++-
 drivers/ide/legacy/ht6560b.c   |    5 -
 drivers/ide/legacy/macide.c    |   12 +++-
 drivers/ide/legacy/q40ide.c    |   13 +++-
 drivers/ide/legacy/qd65xx.c    |    6 --
 drivers/ide/legacy/umc8672.c   |    6 --
 drivers/ide/pci/cmd640.c       |   14 ++++
 drivers/ide/ppc/Makefile       |    2 
 drivers/ide/ppc/pmac.c         |   13 +++-
 drivers/ide/setup-pci.c        |   15 ++++-
 include/linux/ide.h            |    1 
 22 files changed, 178 insertions(+), 175 deletions(-)

Index: b/drivers/ide/Makefile
===================================================================
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -15,33 +15,35 @@ obj-$(CONFIG_BLK_DEV_IDE)		+= pci/
 
 ide-core-y += ide.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)	+= ide-dma.o
-ide-core-$(CONFIG_IDE_PROC_FS)		+= ide-proc.o
-ide-core-$(CONFIG_BLK_DEV_IDEPNP)	+= ide-pnp.o
 ide-core-$(CONFIG_BLK_DEV_IDEACPI)	+= ide-acpi.o
+ide-core-$(CONFIG_IDE_PROC_FS)		+= ide-proc.o
 
 # built-in only drivers from arm/
 ide-core-$(CONFIG_IDE_ARM)		+= arm/ide_arm.o
 
-# built-in only drivers from legacy/
-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
-
-# built-in only drivers from h8300/
-ide-core-$(CONFIG_H8300)		+= h8300/ide-h8300.o
 
 obj-$(CONFIG_BLK_DEV_IDE)		+= ide-core.o
+
+#
+# if the host drivers are built-in we need to take care of the order
+# in which they are probed - this is handled during link time
+#
+
+obj-$(CONFIG_BLK_DEV_IDE)		+= legacy/
+obj-$(CONFIG_BLK_DEV_IDEPCI)		+= setup-pci.o
+obj-$(CONFIG_ETRAX_IDE)			+= cris/
+# no other way to preserve order without moving pci/cmd640.c around
+ifeq ($(CONFIG_BLK_DEV_CMD640), y)
+	cmd640-core-y += pci/cmd640.o
+	obj-y += cmd640-core.o
+endif
+obj-$(CONFIG_BLK_DEV_IDE_PMAC)		+= ppc/
+obj-$(CONFIG_BLK_DEV_IDEPNP)		+= ide-pnp.o
+obj-$(CONFIG_H8300)			+= h8300/
+
 obj-$(CONFIG_IDE_GENERIC)		+= ide-generic.o
 
 obj-$(CONFIG_BLK_DEV_IDEDISK)		+= ide-disk.o
@@ -49,6 +51,16 @@ 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_IDE)		+= legacy/ arm/ mips/
-obj-$(CONFIG_BLK_DEV_HD)		+= legacy/
-obj-$(CONFIG_ETRAX_IDE)		+= cris/
+# no other way to preserve order without moving legacy/ide-cs.c around
+ifeq ($(CONFIG_BLK_DEV_IDECS), y)
+	ide-cs-core-y += legacy/ide-cs.o
+	obj-y += ide-cs-core.o
+endif
+
+obj-$(CONFIG_BLK_DEV_IDE)		+= arm/ mips/
+
+# old hd driver must be last
+ifeq ($(CONFIG_BLK_DEV_HD), y)
+	hd-core-y += legacy/hd.o
+	obj-y += hd-core.o
+endif
Index: b/drivers/ide/cris/ide-cris.c
===================================================================
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -773,8 +773,8 @@ static int speed_cris_ide(ide_drive_t *d
 	return 0;
 }
 
-void __init
-init_e100_ide (void)
+/* TODO: return error values */
+static void __init init_e100_ide(void)
 {
 	hw_regs_t hw;
 	int ide_offsets[IDE_NR_PORTS];
@@ -1098,3 +1098,12 @@ static void cris_dma_start(ide_drive_t *
 		LED_DISK_READ(1);
 	}
 }
+
+static int __init ide_cris_init(void)
+{
+	init_e100_ide();
+
+	return 0;
+}
+
+module_init(ide_cris_init);
Index: b/drivers/ide/h8300/Makefile
===================================================================
--- /dev/null
+++ b/drivers/ide/h8300/Makefile
@@ -0,0 +1,2 @@
+
+obj-$(CONFIG_H8300)			+= ide-h8300.o
Index: b/drivers/ide/h8300/ide-h8300.c
===================================================================
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -85,7 +85,8 @@ static inline void hwif_setup(ide_hwif_t
 	hwif->INSL  = NULL;
 }
 
-void __init h8300_ide_init(void)
+/* TODO: return error values */
+static void __init h8300_ide_probe(void)
 {
 	hw_regs_t hw;
 	ide_hwif_t *hwif;
@@ -114,3 +115,12 @@ void __init h8300_ide_init(void)
 out_busy:
 	printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n");
 }
+
+static int __init h8300_ide_init(void)
+{
+	h8300_ide_probe();
+
+	return 0;
+}
+
+module_init(h8300_ide_init);
Index: b/drivers/ide/ide-pnp.c
===================================================================
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -69,12 +69,14 @@ static struct pnp_driver idepnp_driver =
 	.remove		= idepnp_remove,
 };
 
-void __init pnpide_init(void)
+static int __init pnpide_init(void)
 {
-	pnp_register_driver(&idepnp_driver);
+	return pnp_register_driver(&idepnp_driver);
 }
 
 void __exit pnpide_exit(void)
 {
 	pnp_unregister_driver(&idepnp_driver);
 }
+
+module_init(pnpide_init);
Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -175,7 +175,7 @@ DECLARE_MUTEX(ide_cfg_sem);
  __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock);
 
 #ifdef CONFIG_BLK_DEV_IDEPCI
-static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
+int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
 #endif
 
 #ifdef CONFIG_IDEDMA_AUTO
@@ -1247,26 +1247,11 @@ static int __init match_parm (char *s, c
 	return 0;	/* zero = nothing matched */
 }
 
-#ifdef CONFIG_BLK_DEV_ALI14XX
 extern int probe_ali14xx;
-extern int ali14xx_init(void);
-#endif
-#ifdef CONFIG_BLK_DEV_UMC8672
 extern int probe_umc8672;
-extern int umc8672_init(void);
-#endif
-#ifdef CONFIG_BLK_DEV_DTC2278
 extern int probe_dtc2278;
-extern int dtc2278_init(void);
-#endif
-#ifdef CONFIG_BLK_DEV_HT6560B
 extern int probe_ht6560b;
-extern int ht6560b_init(void);
-#endif
-#ifdef CONFIG_BLK_DEV_QD65XX
 extern int probe_qd65xx;
-extern int qd65xx_init(void);
-#endif
 
 static int __initdata is_chipset_set[MAX_HWIFS];
 
@@ -1565,79 +1550,6 @@ done:
 	return 1;
 }
 
-extern void __init pnpide_init(void);
-extern void __exit pnpide_exit(void);
-extern void __init h8300_ide_init(void);
-
-/*
- * probe_for_hwifs() finds/initializes "known" IDE interfaces
- */
-static void __init probe_for_hwifs (void)
-{
-#ifdef CONFIG_BLK_DEV_IDEPCI
-	ide_scan_pcibus(ide_scan_direction);
-#endif /* CONFIG_BLK_DEV_IDEPCI */
-
-#ifdef CONFIG_ETRAX_IDE
-	{
-		extern void init_e100_ide(void);
-		init_e100_ide();
-	}
-#endif /* CONFIG_ETRAX_IDE */
-#ifdef CONFIG_BLK_DEV_CMD640
-	{
-		extern void ide_probe_for_cmd640x(void);
-		ide_probe_for_cmd640x();
-	}
-#endif /* CONFIG_BLK_DEV_CMD640 */
-#ifdef CONFIG_BLK_DEV_IDE_PMAC
-	{
-		extern void pmac_ide_probe(void);
-		pmac_ide_probe();
-	}
-#endif /* CONFIG_BLK_DEV_IDE_PMAC */
-#ifdef CONFIG_BLK_DEV_GAYLE
-	{
-		extern void gayle_init(void);
-		gayle_init();
-	}
-#endif /* CONFIG_BLK_DEV_GAYLE */
-#ifdef CONFIG_BLK_DEV_FALCON_IDE
-	{
-		extern void falconide_init(void);
-		falconide_init();
-	}
-#endif /* CONFIG_BLK_DEV_FALCON_IDE */
-#ifdef CONFIG_BLK_DEV_MAC_IDE
-	{
-		extern void macide_init(void);
-		macide_init();
-	}
-#endif /* CONFIG_BLK_DEV_MAC_IDE */
-#ifdef CONFIG_BLK_DEV_Q40IDE
-	{
-		extern void q40ide_init(void);
-		q40ide_init();
-	}
-#endif /* CONFIG_BLK_DEV_Q40IDE */
-#ifdef CONFIG_BLK_DEV_BUDDHA
-	{
-		extern void buddha_init(void);
-		buddha_init();
-	}
-#endif /* CONFIG_BLK_DEV_BUDDHA */
-#ifdef CONFIG_BLK_DEV_IDEPNP
-	pnpide_init();
-#endif
-#ifdef CONFIG_H8300
-	h8300_ide_init();
-#endif
-}
-
-/*
- * Probe module
- */
-
 EXPORT_SYMBOL(ide_lock);
 
 static int ide_bus_match(struct device *dev, struct device_driver *drv)
@@ -1765,30 +1677,6 @@ static int __init ide_init(void)
 
 	proc_ide_create();
 
-#ifdef CONFIG_BLK_DEV_ALI14XX
-	if (probe_ali14xx)
-		(void)ali14xx_init();
-#endif
-#ifdef CONFIG_BLK_DEV_UMC8672
-	if (probe_umc8672)
-		(void)umc8672_init();
-#endif
-#ifdef CONFIG_BLK_DEV_DTC2278
-	if (probe_dtc2278)
-		(void)dtc2278_init();
-#endif
-#ifdef CONFIG_BLK_DEV_HT6560B
-	if (probe_ht6560b)
-		(void)ht6560b_init();
-#endif
-#ifdef CONFIG_BLK_DEV_QD65XX
-	if (probe_qd65xx)
-		(void)qd65xx_init();
-#endif
-
-	/* Probe for special PCI and other "known" interface chipsets. */
-	probe_for_hwifs();
-
 	return 0;
 }
 
@@ -1817,6 +1705,8 @@ int __init init_module (void)
 	return ide_init();
 }
 
+extern void __exit pnpide_exit(void);
+
 void __exit cleanup_module (void)
 {
 	int index;
Index: b/drivers/ide/legacy/Makefile
===================================================================
--- a/drivers/ide/legacy/Makefile
+++ b/drivers/ide/legacy/Makefile
@@ -1,13 +1,22 @@
 
+#
+# link order is important here
+#
+
 obj-$(CONFIG_BLK_DEV_ALI14XX)		+= ali14xx.o
+obj-$(CONFIG_BLK_DEV_UMC8672)		+= umc8672.o
 obj-$(CONFIG_BLK_DEV_DTC2278)		+= dtc2278.o
 obj-$(CONFIG_BLK_DEV_HT6560B)		+= ht6560b.o
 obj-$(CONFIG_BLK_DEV_QD65XX)		+= qd65xx.o
-obj-$(CONFIG_BLK_DEV_UMC8672)		+= umc8672.o
 
-obj-$(CONFIG_BLK_DEV_IDECS)		+= ide-cs.o
+obj-$(CONFIG_BLK_DEV_GAYLE)		+= gayle.o
+obj-$(CONFIG_BLK_DEV_FALCON_IDE)	+= falconide.o
+obj-$(CONFIG_BLK_DEV_MAC_IDE)		+= macide.o
+obj-$(CONFIG_BLK_DEV_Q40IDE)		+= q40ide.o
+obj-$(CONFIG_BLK_DEV_BUDDHA)		+= buddha.o
 
-# Last of all
-obj-$(CONFIG_BLK_DEV_HD)		+= hd.o
+ifeq ($(CONFIG_BLK_DEV_IDECS), m)
+	obj-m += ide-cs.o
+endif
 
 EXTRA_CFLAGS	:= -Idrivers/ide
Index: b/drivers/ide/legacy/ali14xx.c
===================================================================
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -197,6 +197,7 @@ static int __init initRegisters (void) {
 	return t;
 }
 
+/* TODO: return error values */
 static int __init ali14xx_probe(void)
 {
 	ide_hwif_t *hwif, *mate;
@@ -236,8 +237,7 @@ int probe_ali14xx = 0;
 module_param_named(probe, probe_ali14xx, bool, 0);
 MODULE_PARM_DESC(probe, "probe for ALI M14xx chipsets");
 
-/* Can be called directly from ide.c. */
-int __init ali14xx_init(void)
+static int __init ali14xx_init(void)
 {
 	if (probe_ali14xx == 0)
 		goto out;
@@ -253,9 +253,7 @@ out:
 	return -ENODEV;
 }
 
-#ifdef MODULE
 module_init(ali14xx_init);
-#endif
 
 MODULE_AUTHOR("see local file");
 MODULE_DESCRIPTION("support of ALI 14XX IDE chipsets");
Index: b/drivers/ide/legacy/buddha.c
===================================================================
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -143,7 +143,8 @@ static int xsurf_ack_intr(ide_hwif_t *hw
      *  Probe for a Buddha or Catweasel IDE interface
      */
 
-void __init buddha_init(void)
+/* TODO: return error values */
+static void __init buddha_ide_probe(void)
 {
 	hw_regs_t hw;
 	ide_hwif_t *hwif;
@@ -233,3 +234,12 @@ fail_base2:
 		}
 	}
 }
+
+static int __init buddha_ide_init(void)
+{
+	buddha_ide_probe();
+
+	return 0;
+}
+
+module_init(buddha_ide_init);
Index: b/drivers/ide/legacy/dtc2278.c
===================================================================
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -94,6 +94,7 @@ static void tune_dtc2278 (ide_drive_t *d
 	HWIF(drive)->drives[!drive->select.b.unit].io_32bit = 1;
 }
 
+/* TODO: return error values */
 static int __init dtc2278_probe(void)
 {
 	unsigned long flags;
@@ -151,8 +152,7 @@ int probe_dtc2278 = 0;
 module_param_named(probe, probe_dtc2278, bool, 0);
 MODULE_PARM_DESC(probe, "probe for DTC2278xx chipsets");
 
-/* Can be called directly from ide.c. */
-int __init dtc2278_init(void)
+static int __init dtc2278_init(void)
 {
 	if (probe_dtc2278 == 0)
 		return -ENODEV;
@@ -164,9 +164,7 @@ int __init dtc2278_init(void)
 	return 0;
 }
 
-#ifdef MODULE
 module_init(dtc2278_init);
-#endif
 
 MODULE_AUTHOR("See Local File");
 MODULE_DESCRIPTION("support of DTC-2278 VLB IDE chipsets");
Index: b/drivers/ide/legacy/falconide.c
===================================================================
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -60,7 +60,8 @@ int falconide_intr_lock;
      *  Probe for a Falcon IDE interface
      */
 
-void __init falconide_init(void)
+/* TODO: return error values */
+static void __init falcon_ide_probe(void)
 {
     if (MACH_IS_ATARI && ATARIHW_PRESENT(IDE)) {
 	hw_regs_t hw;
@@ -76,3 +77,12 @@ void __init falconide_init(void)
 	    printk("ide%d: Falcon IDE interface\n", index);
     }
 }
+
+static int __init falcon_ide_init(void)
+{
+	falcon_ide_probe();
+
+	return 0;
+}
+
+module_init(falcon_ide_init);
Index: b/drivers/ide/legacy/gayle.c
===================================================================
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -110,7 +110,8 @@ static int gayle_ack_intr_a1200(ide_hwif
      *  Probe for a Gayle IDE interface (and optionally for an IDE doubler)
      */
 
-void __init gayle_init(void)
+/* TODO: return error values */
+static void __init gayle_ide_probe(void)
 {
     int a4000, i;
 
@@ -183,3 +184,12 @@ found:
 	    release_mem_region(res_start, res_n);
     }
 }
+
+static int __init gayle_ide_init(void)
+{
+	gayle_ide_probe();
+
+	return 0;
+}
+
+module_init(gayle_ide_init);
Index: b/drivers/ide/legacy/ht6560b.c
===================================================================
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -308,8 +308,7 @@ int probe_ht6560b = 0;
 module_param_named(probe, probe_ht6560b, bool, 0);
 MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
 
-/* Can be called directly from ide.c. */
-int __init ht6560b_init(void)
+static int __init ht6560b_init(void)
 {
 	ide_hwif_t *hwif, *mate;
 	int t;
@@ -369,9 +368,7 @@ release_region:
 	return -ENODEV;
 }
 
-#ifdef MODULE
 module_init(ht6560b_init);
-#endif
 
 MODULE_AUTHOR("See Local File");
 MODULE_DESCRIPTION("HT-6560B EIDE-controller support");
Index: b/drivers/ide/legacy/macide.c
===================================================================
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -90,7 +90,8 @@ static void macide_mediabay_interrupt(in
  * Probe for a Macintosh IDE interface
  */
 
-void macide_init(void)
+/* TODO: return error values */
+static void __init mac_ide_probe(void)
 {
 	hw_regs_t hw;
 	ide_hwif_t *hwif;
@@ -152,3 +153,12 @@ void macide_init(void)
 			printk(KERN_INFO "ide%d: Unknown Macintosh IDE interface\n", index);
 	}
 }
+
+static int __init mac_ide_init(void)
+{
+	mac_ide_probe();
+
+	return 0;
+}
+
+module_init(mac_ide_init);
Index: b/drivers/ide/legacy/q40ide.c
===================================================================
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -102,7 +102,7 @@ void q40_ide_setup_ports ( hw_regs_t *hw
 
 /* 
  * the static array is needed to have the name reported in /proc/ioports,
- * hwif->name unfortunately isn´t available yet
+ * hwif->name unfortunately isn't available yet
  */
 static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
 	"ide0", "ide1"
@@ -112,7 +112,8 @@ static const char *q40_ide_names[Q40IDE_
  *  Probe for Q40 IDE interfaces
  */
 
-void q40ide_init(void)
+/* TODO: return error values */
+static void __init q40_ide_probe(void)
 {
     int i;
     ide_hwif_t *hwif;
@@ -149,3 +150,11 @@ void q40ide_init(void)
     }
 }
 
+static int __init q40_ide_init(void)
+{
+	q40_ide_probe();
+
+	return 0;
+}
+
+module_init(q40_ide_init);
Index: b/drivers/ide/legacy/qd65xx.c
===================================================================
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -397,6 +397,7 @@ static void __exit qd_unsetup(ide_hwif_t
  * return 1 if another qd may be probed
  */
 
+/* TODO: return error values */
 static int __init qd_probe(int base)
 {
 	ide_hwif_t *hwif;
@@ -496,8 +497,7 @@ int probe_qd65xx = 0;
 module_param_named(probe, probe_qd65xx, bool, 0);
 MODULE_PARM_DESC(probe, "probe for QD65xx chipsets");
 
-/* Can be called directly from ide.c. */
-int __init qd65xx_init(void)
+static int __init qd65xx_init(void)
 {
 	if (probe_qd65xx == 0)
 		return -ENODEV;
@@ -510,9 +510,7 @@ int __init qd65xx_init(void)
 	return 0;
 }
 
-#ifdef MODULE
 module_init(qd65xx_init);
-#endif
 
 MODULE_AUTHOR("Samuel Thibault");
 MODULE_DESCRIPTION("support of qd65xx vlb ide chipset");
Index: b/drivers/ide/legacy/umc8672.c
===================================================================
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -123,6 +123,7 @@ static void tune_umc (ide_drive_t *drive
 	spin_unlock_irqrestore(&ide_lock, flags);
 }
 
+/* TODO: return error values */
 static int __init umc8672_probe(void)
 {
 	unsigned long flags;
@@ -171,8 +172,7 @@ int probe_umc8672 = 0;
 module_param_named(probe, probe_umc8672, bool, 0);
 MODULE_PARM_DESC(probe, "probe for UMC8672 chipset");
 
-/* Can be called directly from ide.c. */
-int __init umc8672_init(void)
+static int __init umc8672_init(void)
 {
 	if (probe_umc8672 == 0)
 		goto out;
@@ -183,9 +183,7 @@ out:
 	return -ENODEV;;
 }
 
-#ifdef MODULE
 module_init(umc8672_init);
-#endif
 
 MODULE_AUTHOR("Wolfram Podien");
 MODULE_DESCRIPTION("Support for UMC 8672 IDE chipset");
Index: b/drivers/ide/pci/cmd640.c
===================================================================
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -713,9 +713,11 @@ static int pci_conf2(void)
 }
 
 /*
- * Probe for a cmd640 chipset, and initialize it if found.  Called from ide.c
+ * Probe for a cmd640 chipset, and initialize it if found.
+ *
+ * TODO: return error values
  */
-int __init ide_probe_for_cmd640x (void)
+static int __init cmd640x_probe(void)
 {
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
 	int second_port_toggled = 0;
@@ -876,3 +878,11 @@ int __init ide_probe_for_cmd640x (void)
 	return 1;
 }
 
+static int __init cmd640x_init(void)
+{
+	(void)cmd640x_probe();
+
+	return 0;
+}
+
+module_init(cmd640x_init);
Index: b/drivers/ide/ppc/Makefile
===================================================================
--- /dev/null
+++ b/drivers/ide/ppc/Makefile
@@ -0,0 +1,2 @@
+
+obj-$(CONFIG_BLK_DEV_IDE_PMAC)		+= pmac.o
Index: b/drivers/ide/ppc/pmac.c
===================================================================
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1554,8 +1554,8 @@ static struct pci_driver pmac_ide_pci_dr
 };
 MODULE_DEVICE_TABLE(pci, pmac_ide_pci_match);
 
-void __init
-pmac_ide_probe(void)
+/* TODO: return error values */
+static void __init pmac_ide_probe(void)
 {
 	if (!machine_is(powermac))
 		return;
@@ -2073,3 +2073,12 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif
 }
 
 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
+
+static int __init pmac_ide_init(void)
+{
+	pmac_ide_probe();
+
+	return 0;
+}
+
+module_init(pmac_ide_init);
Index: b/drivers/ide/setup-pci.c
===================================================================
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -853,8 +853,8 @@ static int __init ide_scan_pcidev(struct
  *	PCI drivers. After this all IDE pci handling becomes standard
  *	module ordering not traditionally ordered.
  */
- 	
-void __init ide_scan_pcibus (int scan_direction)
+
+static void __init ide_scan_pcibus(int scan_direction)
 {
 	struct pci_dev *dev = NULL;
 	struct pci_driver *d;
@@ -883,3 +883,14 @@ void __init ide_scan_pcibus (int scan_di
 		__pci_register_driver(d, d->driver.owner, d->driver.mod_name);
 	}
 }
+
+extern int ide_scan_direction;
+
+static int __init ide_pci_init(void)
+{
+	ide_scan_pcibus(ide_scan_direction);
+
+	return 0;
+}
+
+module_init(ide_pci_init);
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1203,7 +1203,6 @@ void ide_init_disk(struct gendisk *, ide
 
 extern int ideprobe_init(void);
 
-extern void ide_scan_pcibus(int scan_direction) __init;
 extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
 #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
 void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *);
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux