aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-26 14:13:07 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-26 14:13:07 -0500
commitade2daf9c6e57845fe83a24e0a9fa1c03c6e91b1 (patch)
tree68070062d6306442caee50630c4213c911eb9064
parent8ac4ce742c66100931b6f2d7a36b0df08bc721fe (diff)
ide: make remaining built-in only IDE host drivers modular (take 2)
* Make remaining built-in only IDE host drivers modular, add ide-scan-pci.c file for probing PCI host drivers registered with IDE core (special case for built-in IDE and CONFIG_IDEPCI_PCIBUS_ORDER=y) and then take care of the ordering in which all IDE host drivers are probed when IDE is built-in during link time. * Move probing of gayle, falconide, macide, q40ide and buddha (m68k arch specific) host drivers, before PCI ones (no PCI on m68k), ide-cris (cris arch specific), cmd640 (x86 arch specific) and pmac (ppc arch specific). * Move probing of ide-cris (cris arch specific) host driver before cmd640 (x86 arch specific). * Move probing of mpc8xx (ppc specific) host driver before ide-pnp (depends on ISA and none of ppc platform that use mpc8xx supports ISA) and ide-h8300 (h8300 arch specific). * Add "probe_vlb" kernel parameter to cmd640 host driver and update Documentation/ide.txt accordingly. * Make IDE_ARM config option visible so it can also be disabled if needed. * Remove bogus comment from ide.c while at it. v2: * Fix two issues spotted by Sergei: - replace ENOMEM error value by ENOENT in ide-h8300 host driver - fix MODULE_PARM_DESC() in cmd640 host driver Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: Mikael Starvik <starvik@axis.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--Documentation/ide.txt9
-rw-r--r--drivers/ide/Kconfig26
-rw-r--r--drivers/ide/Makefile58
-rw-r--r--drivers/ide/arm/Makefile4
-rw-r--r--drivers/ide/arm/ide_arm.c6
-rw-r--r--drivers/ide/cris/Makefile2
-rw-r--r--drivers/ide/cris/ide-cris.c7
-rw-r--r--drivers/ide/h8300/Makefile2
-rw-r--r--drivers/ide/h8300/ide-h8300.c10
-rw-r--r--drivers/ide/ide-pnp.c9
-rw-r--r--drivers/ide/ide-scan-pci.c11
-rw-r--r--drivers/ide/ide.c131
-rw-r--r--drivers/ide/legacy/Makefile19
-rw-r--r--drivers/ide/legacy/ali14xx.c5
-rw-r--r--drivers/ide/legacy/buddha.c6
-rw-r--r--drivers/ide/legacy/dtc2278.c5
-rw-r--r--drivers/ide/legacy/falconide.c7
-rw-r--r--drivers/ide/legacy/gayle.c10
-rw-r--r--drivers/ide/legacy/ht6560b.c5
-rw-r--r--drivers/ide/legacy/macide.c8
-rw-r--r--drivers/ide/legacy/q40ide.c7
-rw-r--r--drivers/ide/legacy/qd65xx.c5
-rw-r--r--drivers/ide/legacy/umc8672.c5
-rw-r--r--drivers/ide/pci/Makefile4
-rw-r--r--drivers/ide/pci/cmd640.c8
-rw-r--r--drivers/ide/ppc/Makefile3
-rw-r--r--drivers/ide/ppc/mpc8xx.c6
-rw-r--r--drivers/ide/ppc/pmac.c2
-rw-r--r--drivers/ide/setup-pci.c9
-rw-r--r--include/linux/ide.h3
30 files changed, 171 insertions, 221 deletions
diff --git a/Documentation/ide.txt b/Documentation/ide.txt
index 1d50f23a5cab..b29ccb43d6cc 100644
--- a/Documentation/ide.txt
+++ b/Documentation/ide.txt
@@ -30,7 +30,7 @@
30*** 30***
31*** The CMD640 is also used on some Vesa Local Bus (VLB) cards, and is *NOT* 31*** The CMD640 is also used on some Vesa Local Bus (VLB) cards, and is *NOT*
32*** automatically detected by Linux. For safe, reliable operation with such 32*** automatically detected by Linux. For safe, reliable operation with such
33*** interfaces, one *MUST* use the "ide0=cmd640_vlb" kernel option. 33*** interfaces, one *MUST* use the "cmd640.probe_vlb" kernel option.
34*** 34***
35*** Use of the "serialize" option is no longer necessary. 35*** Use of the "serialize" option is no longer necessary.
36 36
@@ -292,9 +292,6 @@ The following are valid ONLY on ide0, which usually corresponds
292to the first ATA interface found on the particular host, and the defaults for 292to the first ATA interface found on the particular host, and the defaults for
293the base,ctl ports must not be altered. 293the base,ctl ports must not be altered.
294 294
295 "ide0=cmd640_vlb" : *REQUIRED* for VLB cards with the CMD640 chip
296 (not for PCI -- automatically detected)
297
298 "ide=doubler" : probe/support IDE doublers on Amiga 295 "ide=doubler" : probe/support IDE doublers on Amiga
299 296
300There may be more options than shown -- use the source, Luke! 297There may be more options than shown -- use the source, Luke!
@@ -310,6 +307,10 @@ i.e. to enable probing for ALI M14xx chipsets (ali14xx host driver) use:
310* "probe" module parameter when ali14xx driver is compiled as module 307* "probe" module parameter when ali14xx driver is compiled as module
311 ("modprobe ali14xx probe") 308 ("modprobe ali14xx probe")
312 309
310Also for legacy CMD640 host driver (cmd640) you need to use "probe_vlb"
311kernel paremeter to enable probing for VLB version of the chipset (PCI ones
312are detected automatically).
313
313================================================================================ 314================================================================================
314 315
315IDE ATAPI streaming tape driver 316IDE ATAPI streaming tape driver
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 7c419e87a4a4..e92128a87f26 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -325,7 +325,7 @@ config BLK_DEV_PLATFORM
325 If unsure, say N. 325 If unsure, say N.
326 326
327config BLK_DEV_CMD640 327config BLK_DEV_CMD640
328 bool "CMD640 chipset bugfix/support" 328 tristate "CMD640 chipset bugfix/support"
329 depends on X86 329 depends on X86
330 ---help--- 330 ---help---
331 The CMD-Technologies CMD640 IDE chip is used on many common 486 and 331 The CMD-Technologies CMD640 IDE chip is used on many common 486 and
@@ -359,7 +359,7 @@ config BLK_DEV_CMD640_ENHANCED
359 Otherwise say N. 359 Otherwise say N.
360 360
361config BLK_DEV_IDEPNP 361config BLK_DEV_IDEPNP
362 bool "PNP EIDE support" 362 tristate "PNP EIDE support"
363 depends on PNP 363 depends on PNP
364 help 364 help
365 If you have a PnP (Plug and Play) compatible EIDE card and 365 If you have a PnP (Plug and Play) compatible EIDE card and
@@ -788,7 +788,7 @@ config BLK_DEV_CELLEB
788endif 788endif
789 789
790config BLK_DEV_IDE_PMAC 790config BLK_DEV_IDE_PMAC
791 bool "Builtin PowerMac IDE support" 791 tristate "Builtin PowerMac IDE support"
792 depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y 792 depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y
793 help 793 help
794 This driver provides support for the built-in IDE controller on 794 This driver provides support for the built-in IDE controller on
@@ -842,7 +842,9 @@ config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
842 depends on BLK_DEV_IDE_AU1XXX 842 depends on BLK_DEV_IDE_AU1XXX
843 843
844config IDE_ARM 844config IDE_ARM
845 def_bool ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) 845 tristate "ARM IDE support"
846 depends on ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK)
847 default y
846 848
847config BLK_DEV_IDE_ICSIDE 849config BLK_DEV_IDE_ICSIDE
848 tristate "ICS IDE interface support" 850 tristate "ICS IDE interface support"
@@ -874,7 +876,7 @@ config BLK_DEV_IDE_BAST
874 Simtec BAST or the Thorcom VR1000 876 Simtec BAST or the Thorcom VR1000
875 877
876config ETRAX_IDE 878config ETRAX_IDE
877 bool "ETRAX IDE support" 879 tristate "ETRAX IDE support"
878 depends on CRIS && BROKEN 880 depends on CRIS && BROKEN
879 select BLK_DEV_IDEDMA 881 select BLK_DEV_IDEDMA
880 help 882 help
@@ -908,14 +910,14 @@ config ETRAX_IDE_G27_RESET
908endchoice 910endchoice
909 911
910config IDE_H8300 912config IDE_H8300
911 bool "H8300 IDE support" 913 tristate "H8300 IDE support"
912 depends on H8300 914 depends on H8300
913 default y 915 default y
914 help 916 help
915 Enables the H8300 IDE driver. 917 Enables the H8300 IDE driver.
916 918
917config BLK_DEV_GAYLE 919config BLK_DEV_GAYLE
918 bool "Amiga Gayle IDE interface support" 920 tristate "Amiga Gayle IDE interface support"
919 depends on AMIGA 921 depends on AMIGA
920 help 922 help
921 This is the IDE driver for the Amiga Gayle IDE interface. It supports 923 This is the IDE driver for the Amiga Gayle IDE interface. It supports
@@ -946,7 +948,7 @@ config BLK_DEV_IDEDOUBLER
946 runtime using the "ide=doubler" kernel boot parameter. 948 runtime using the "ide=doubler" kernel boot parameter.
947 949
948config BLK_DEV_BUDDHA 950config BLK_DEV_BUDDHA
949 bool "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" 951 tristate "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)"
950 depends on ZORRO && EXPERIMENTAL 952 depends on ZORRO && EXPERIMENTAL
951 help 953 help
952 This is the IDE driver for the IDE interfaces on the Buddha, 954 This is the IDE driver for the IDE interfaces on the Buddha,
@@ -958,7 +960,7 @@ config BLK_DEV_BUDDHA
958 to one of its IDE interfaces. 960 to one of its IDE interfaces.
959 961
960config BLK_DEV_FALCON_IDE 962config BLK_DEV_FALCON_IDE
961 bool "Falcon IDE interface support" 963 tristate "Falcon IDE interface support"
962 depends on ATARI 964 depends on ATARI
963 help 965 help
964 This is the IDE driver for the builtin IDE interface on the Atari 966 This is the IDE driver for the builtin IDE interface on the Atari
@@ -967,7 +969,7 @@ config BLK_DEV_FALCON_IDE
967 interface. 969 interface.
968 970
969config BLK_DEV_MAC_IDE 971config BLK_DEV_MAC_IDE
970 bool "Macintosh Quadra/Powerbook IDE interface support" 972 tristate "Macintosh Quadra/Powerbook IDE interface support"
971 depends on MAC 973 depends on MAC
972 help 974 help
973 This is the IDE driver for the builtin IDE interface on some m68k 975 This is the IDE driver for the builtin IDE interface on some m68k
@@ -980,7 +982,7 @@ config BLK_DEV_MAC_IDE
980 builtin IDE interface. 982 builtin IDE interface.
981 983
982config BLK_DEV_Q40IDE 984config BLK_DEV_Q40IDE
983 bool "Q40/Q60 IDE interface support" 985 tristate "Q40/Q60 IDE interface support"
984 depends on Q40 986 depends on Q40
985 help 987 help
986 Enable the on-board IDE controller in the Q40/Q60. This should 988 Enable the on-board IDE controller in the Q40/Q60. This should
@@ -988,7 +990,7 @@ config BLK_DEV_Q40IDE
988 drive subsystem through an expansion card. 990 drive subsystem through an expansion card.
989 991
990config BLK_DEV_MPC8xx_IDE 992config BLK_DEV_MPC8xx_IDE
991 bool "MPC8xx IDE support" 993 tristate "MPC8xx IDE support"
992 depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE 994 depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE
993 help 995 help
994 This option provides support for IDE on Motorola MPC8xx Systems. 996 This option provides support for IDE on Motorola MPC8xx Systems.
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index b181fc672057..0d2da89d15cf 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -7,41 +7,37 @@
7# Note : at this point, these files are compiled on all systems. 7# Note : at this point, these files are compiled on all systems.
8# In the future, some of these should be built conditionally. 8# In the future, some of these should be built conditionally.
9# 9#
10# First come modules that register themselves with the core 10# link order is important here
11 11
12EXTRA_CFLAGS += -Idrivers/ide 12EXTRA_CFLAGS += -Idrivers/ide
13 13
14obj-$(CONFIG_BLK_DEV_IDE) += pci/
15
16ide-core-y += ide.o ide-io.o ide-iops.o ide-lib.o ide-probe.o ide-taskfile.o 14ide-core-y += ide.o ide-io.o ide-iops.o ide-lib.o ide-probe.o ide-taskfile.o
17 15
18ide-core-$(CONFIG_BLK_DEV_CMD640) += pci/cmd640.o 16# core IDE code
19
20# Core IDE code - must come before legacy
21ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o 17ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o
22ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o 18ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o
23ide-core-$(CONFIG_IDE_PROC_FS) += ide-proc.o 19ide-core-$(CONFIG_IDE_PROC_FS) += ide-proc.o
24ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
25ide-core-$(CONFIG_BLK_DEV_IDEACPI) += ide-acpi.o 20ide-core-$(CONFIG_BLK_DEV_IDEACPI) += ide-acpi.o
26 21
27# built-in only drivers from arm/ 22obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o
28ide-core-$(CONFIG_IDE_ARM) += arm/ide_arm.o
29 23
30# built-in only drivers from legacy/ 24ifeq ($(CONFIG_IDE_ARM), y)
31ide-core-$(CONFIG_BLK_DEV_BUDDHA) += legacy/buddha.o 25 ide-arm-core-y += arm/ide_arm.o
32ide-core-$(CONFIG_BLK_DEV_FALCON_IDE) += legacy/falconide.o 26 obj-y += ide-arm-core.o
33ide-core-$(CONFIG_BLK_DEV_GAYLE) += legacy/gayle.o 27endif
34ide-core-$(CONFIG_BLK_DEV_MAC_IDE) += legacy/macide.o
35ide-core-$(CONFIG_BLK_DEV_Q40IDE) += legacy/q40ide.o
36 28
37# built-in only drivers from ppc/ 29obj-$(CONFIG_BLK_DEV_IDE) += legacy/ pci/
38ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o
39ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o
40 30
41# built-in only drivers from h8300/ 31obj-$(CONFIG_IDEPCI_PCIBUS_ORDER) += ide-scan-pci.o
42ide-core-$(CONFIG_IDE_H8300) += h8300/ide-h8300.o
43 32
44obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o 33ifeq ($(CONFIG_BLK_DEV_CMD640), y)
34 cmd640-core-y += pci/cmd640.o
35 obj-y += cmd640-core.o
36endif
37
38obj-$(CONFIG_BLK_DEV_IDE) += cris/ ppc/
39obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
40obj-$(CONFIG_IDE_H8300) += h8300/
45obj-$(CONFIG_IDE_GENERIC) += ide-generic.o 41obj-$(CONFIG_IDE_GENERIC) += ide-generic.o
46 42
47obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o 43obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o
@@ -49,6 +45,20 @@ obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd.o
49obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o 45obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o
50obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o 46obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o
51 47
52obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ mips/ 48ifeq ($(CONFIG_BLK_DEV_IDECS), y)
53obj-$(CONFIG_BLK_DEV_HD) += legacy/ 49 ide-cs-core-y += legacy/ide-cs.o
54obj-$(CONFIG_ETRAX_IDE) += cris/ 50 obj-y += ide-cs-core.o
51endif
52
53ifeq ($(CONFIG_BLK_DEV_PLATFORM), y)
54 ide-platform-core-y += legacy/ide_platform.o
55 obj-y += ide-platform-core.o
56endif
57
58obj-$(CONFIG_BLK_DEV_IDE) += arm/ mips/
59
60# old hd driver must be last
61ifeq ($(CONFIG_BLK_DEV_HD), y)
62 hd-core-y += legacy/hd.o
63 obj-y += hd-core.o
64endif
diff --git a/drivers/ide/arm/Makefile b/drivers/ide/arm/Makefile
index 6a78f0755f26..5f63ad216862 100644
--- a/drivers/ide/arm/Makefile
+++ b/drivers/ide/arm/Makefile
@@ -3,4 +3,8 @@ obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o
3obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o 3obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o
4obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o 4obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o
5 5
6ifeq ($(CONFIG_IDE_ARM), m)
7 obj-m += ide_arm.o
8endif
9
6EXTRA_CFLAGS := -Idrivers/ide 10EXTRA_CFLAGS := -Idrivers/ide
diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c
index a1b5ddab6a48..60f2497542c0 100644
--- a/drivers/ide/arm/ide_arm.c
+++ b/drivers/ide/arm/ide_arm.c
@@ -24,7 +24,7 @@
24# define IDE_ARM_IRQ IRQ_HARDDISK 24# define IDE_ARM_IRQ IRQ_HARDDISK
25#endif 25#endif
26 26
27void __init ide_arm_init(void) 27static int __init ide_arm_init(void)
28{ 28{
29 ide_hwif_t *hwif; 29 ide_hwif_t *hwif;
30 hw_regs_t hw; 30 hw_regs_t hw;
@@ -41,4 +41,8 @@ void __init ide_arm_init(void)
41 41
42 ide_device_add(idx); 42 ide_device_add(idx);
43 } 43 }
44
45 return 0;
44} 46}
47
48module_init(ide_arm_init);
diff --git a/drivers/ide/cris/Makefile b/drivers/ide/cris/Makefile
index 6176e8d6b2e6..20b95960531f 100644
--- a/drivers/ide/cris/Makefile
+++ b/drivers/ide/cris/Makefile
@@ -1,3 +1,3 @@
1EXTRA_CFLAGS += -Idrivers/ide 1EXTRA_CFLAGS += -Idrivers/ide
2 2
3obj-y += ide-cris.o 3obj-$(CONFIG_IDE_ETRAX) += ide-cris.o
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index 924536297036..8c3294c4d23e 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -754,8 +754,7 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed)
754 cris_ide_set_speed(TYPE_DMA, 0, strobe, hold); 754 cris_ide_set_speed(TYPE_DMA, 0, strobe, hold);
755} 755}
756 756
757void __init 757static int __init init_e100_ide(void)
758init_e100_ide (void)
759{ 758{
760 hw_regs_t hw; 759 hw_regs_t hw;
761 int ide_offsets[IDE_NR_PORTS], h, i; 760 int ide_offsets[IDE_NR_PORTS], h, i;
@@ -823,6 +822,8 @@ init_e100_ide (void)
823 cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0); 822 cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0);
824 823
825 ide_device_add(idx); 824 ide_device_add(idx);
825
826 return 0;
826} 827}
827 828
828static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16))); 829static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16)));
@@ -1056,3 +1057,5 @@ static void cris_dma_start(ide_drive_t *drive)
1056 LED_DISK_READ(1); 1057 LED_DISK_READ(1);
1057 } 1058 }
1058} 1059}
1060
1061module_init(init_e100_ide);
diff --git a/drivers/ide/h8300/Makefile b/drivers/ide/h8300/Makefile
new file mode 100644
index 000000000000..5eba16f423f4
--- /dev/null
+++ b/drivers/ide/h8300/Makefile
@@ -0,0 +1,2 @@
1
2obj-$(CONFIG_IDE_H8300) += ide-h8300.o
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
index 9fa78e98d1ba..4f6d0191cf6c 100644
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -84,7 +84,7 @@ static inline void hwif_setup(ide_hwif_t *hwif)
84 hwif->INSL = NULL; 84 hwif->INSL = NULL;
85} 85}
86 86
87void __init h8300_ide_init(void) 87static int __init h8300_ide_init(void)
88{ 88{
89 hw_regs_t hw; 89 hw_regs_t hw;
90 ide_hwif_t *hwif; 90 ide_hwif_t *hwif;
@@ -104,7 +104,7 @@ void __init h8300_ide_init(void)
104 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); 104 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
105 if (hwif == NULL) { 105 if (hwif == NULL) {
106 printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); 106 printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
107 return; 107 return -ENOENT;
108 } 108 }
109 109
110 index = hwif->index; 110 index = hwif->index;
@@ -117,8 +117,12 @@ void __init h8300_ide_init(void)
117 117
118 ide_device_add(idx); 118 ide_device_add(idx);
119 119
120 return; 120 return 0;
121 121
122out_busy: 122out_busy:
123 printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n"); 123 printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n");
124
125 return -EBUSY;
124} 126}
127
128module_init(h8300_ide_init);
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
index 802efd4d9760..cbbb0f75be92 100644
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -75,12 +75,15 @@ static struct pnp_driver idepnp_driver = {
75 .remove = idepnp_remove, 75 .remove = idepnp_remove,
76}; 76};
77 77
78void __init pnpide_init(void) 78static int __init pnpide_init(void)
79{ 79{
80 pnp_register_driver(&idepnp_driver); 80 return pnp_register_driver(&idepnp_driver);
81} 81}
82 82
83void __exit pnpide_exit(void) 83static void __exit pnpide_exit(void)
84{ 84{
85 pnp_unregister_driver(&idepnp_driver); 85 pnp_unregister_driver(&idepnp_driver);
86} 86}
87
88module_init(pnpide_init);
89module_exit(pnpide_exit);
diff --git a/drivers/ide/ide-scan-pci.c b/drivers/ide/ide-scan-pci.c
new file mode 100644
index 000000000000..23015d89e735
--- /dev/null
+++ b/drivers/ide/ide-scan-pci.c
@@ -0,0 +1,11 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/module.h>
4#include <linux/ide.h>
5
6static int __init ide_scan_pci(void)
7{
8 return ide_scan_pcibus();
9}
10
11module_init(ide_scan_pci);
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 6f99f5c90062..5f3e53ec5838 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -95,7 +95,7 @@ DEFINE_MUTEX(ide_cfg_mtx);
95 __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock); 95 __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock);
96 96
97#ifdef CONFIG_IDEPCI_PCIBUS_ORDER 97#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
98static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ 98int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
99#endif 99#endif
100 100
101int noautodma = 0; 101int noautodma = 0;
@@ -178,8 +178,6 @@ static void init_hwif_default(ide_hwif_t *hwif, unsigned int index)
178#endif 178#endif
179} 179}
180 180
181extern void ide_arm_init(void);
182
183/* 181/*
184 * init_ide_data() sets reasonable default values into all fields 182 * init_ide_data() sets reasonable default values into all fields
185 * of all instances of the hwifs and drives, but only on the first call. 183 * of all instances of the hwifs and drives, but only on the first call.
@@ -1223,26 +1221,12 @@ static int __init match_parm (char *s, const char *keywords[], int vals[], int m
1223 return 0; /* zero = nothing matched */ 1221 return 0; /* zero = nothing matched */
1224} 1222}
1225 1223
1226#ifdef CONFIG_BLK_DEV_ALI14XX
1227extern int probe_ali14xx; 1224extern int probe_ali14xx;
1228extern int ali14xx_init(void);
1229#endif
1230#ifdef CONFIG_BLK_DEV_UMC8672
1231extern int probe_umc8672; 1225extern int probe_umc8672;
1232extern int umc8672_init(void);
1233#endif
1234#ifdef CONFIG_BLK_DEV_DTC2278
1235extern int probe_dtc2278; 1226extern int probe_dtc2278;
1236extern int dtc2278_init(void);
1237#endif
1238#ifdef CONFIG_BLK_DEV_HT6560B
1239extern int probe_ht6560b; 1227extern int probe_ht6560b;
1240extern int ht6560b_init(void);
1241#endif
1242#ifdef CONFIG_BLK_DEV_QD65XX
1243extern int probe_qd65xx; 1228extern int probe_qd65xx;
1244extern int qd65xx_init(void); 1229extern int cmd640_vlb;
1245#endif
1246 1230
1247static int __initdata is_chipset_set[MAX_HWIFS]; 1231static int __initdata is_chipset_set[MAX_HWIFS];
1248 1232
@@ -1458,11 +1442,8 @@ static int __init ide_setup(char *s)
1458#endif 1442#endif
1459#ifdef CONFIG_BLK_DEV_CMD640 1443#ifdef CONFIG_BLK_DEV_CMD640
1460 case -14: /* "cmd640_vlb" */ 1444 case -14: /* "cmd640_vlb" */
1461 {
1462 extern int cmd640_vlb; /* flag for cmd640.c */
1463 cmd640_vlb = 1; 1445 cmd640_vlb = 1;
1464 goto done; 1446 goto done;
1465 }
1466#endif 1447#endif
1467#ifdef CONFIG_BLK_DEV_HT6560B 1448#ifdef CONFIG_BLK_DEV_HT6560B
1468 case -13: /* "ht6560b" */ 1449 case -13: /* "ht6560b" */
@@ -1552,83 +1533,6 @@ done:
1552 return 1; 1533 return 1;
1553} 1534}
1554 1535
1555extern void __init pnpide_init(void);
1556extern void __exit pnpide_exit(void);
1557extern void __init h8300_ide_init(void);
1558extern void __init mpc8xx_ide_probe(void);
1559
1560/*
1561 * probe_for_hwifs() finds/initializes "known" IDE interfaces
1562 */
1563static void __init probe_for_hwifs (void)
1564{
1565#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
1566 ide_scan_pcibus(ide_scan_direction);
1567#endif
1568
1569#ifdef CONFIG_ETRAX_IDE
1570 {
1571 extern void init_e100_ide(void);
1572 init_e100_ide();
1573 }
1574#endif /* CONFIG_ETRAX_IDE */
1575#ifdef CONFIG_BLK_DEV_CMD640
1576 {
1577 extern void ide_probe_for_cmd640x(void);
1578 ide_probe_for_cmd640x();
1579 }
1580#endif /* CONFIG_BLK_DEV_CMD640 */
1581#ifdef CONFIG_BLK_DEV_IDE_PMAC
1582 {
1583 extern int pmac_ide_probe(void);
1584 (void)pmac_ide_probe();
1585 }
1586#endif /* CONFIG_BLK_DEV_IDE_PMAC */
1587#ifdef CONFIG_BLK_DEV_GAYLE
1588 {
1589 extern void gayle_init(void);
1590 gayle_init();
1591 }
1592#endif /* CONFIG_BLK_DEV_GAYLE */
1593#ifdef CONFIG_BLK_DEV_FALCON_IDE
1594 {
1595 extern void falconide_init(void);
1596 falconide_init();
1597 }
1598#endif /* CONFIG_BLK_DEV_FALCON_IDE */
1599#ifdef CONFIG_BLK_DEV_MAC_IDE
1600 {
1601 extern void macide_init(void);
1602 macide_init();
1603 }
1604#endif /* CONFIG_BLK_DEV_MAC_IDE */
1605#ifdef CONFIG_BLK_DEV_Q40IDE
1606 {
1607 extern void q40ide_init(void);
1608 q40ide_init();
1609 }
1610#endif /* CONFIG_BLK_DEV_Q40IDE */
1611#ifdef CONFIG_BLK_DEV_BUDDHA
1612 {
1613 extern void buddha_init(void);
1614 buddha_init();
1615 }
1616#endif /* CONFIG_BLK_DEV_BUDDHA */
1617#ifdef CONFIG_BLK_DEV_IDEPNP
1618 pnpide_init();
1619#endif
1620#ifdef CONFIG_H8300
1621 h8300_ide_init();
1622#endif
1623#ifdef BLK_DEV_MPC8xx_IDE
1624 mpc8xx_ide_probe();
1625#endif
1626}
1627
1628/*
1629 * Probe module
1630 */
1631
1632EXPORT_SYMBOL(ide_lock); 1536EXPORT_SYMBOL(ide_lock);
1633 1537
1634static int ide_bus_match(struct device *dev, struct device_driver *drv) 1538static int ide_bus_match(struct device *dev, struct device_driver *drv)
@@ -1775,33 +1679,6 @@ static int __init ide_init(void)
1775 1679
1776 proc_ide_create(); 1680 proc_ide_create();
1777 1681
1778#ifdef CONFIG_IDE_ARM
1779 ide_arm_init();
1780#endif
1781#ifdef CONFIG_BLK_DEV_ALI14XX
1782 if (probe_ali14xx)
1783 (void)ali14xx_init();
1784#endif
1785#ifdef CONFIG_BLK_DEV_UMC8672
1786 if (probe_umc8672)
1787 (void)umc8672_init();
1788#endif
1789#ifdef CONFIG_BLK_DEV_DTC2278
1790 if (probe_dtc2278)
1791 (void)dtc2278_init();
1792#endif
1793#ifdef CONFIG_BLK_DEV_HT6560B
1794 if (probe_ht6560b)
1795 (void)ht6560b_init();
1796#endif
1797#ifdef CONFIG_BLK_DEV_QD65XX
1798 if (probe_qd65xx)
1799 (void)qd65xx_init();
1800#endif
1801
1802 /* Probe for special PCI and other "known" interface chipsets. */
1803 probe_for_hwifs();
1804
1805 return 0; 1682 return 0;
1806} 1683}
1807 1684
@@ -1837,10 +1714,6 @@ void __exit cleanup_module (void)
1837 for (index = 0; index < MAX_HWIFS; ++index) 1714 for (index = 0; index < MAX_HWIFS; ++index)
1838 ide_unregister(index); 1715 ide_unregister(index);
1839 1716
1840#ifdef CONFIG_BLK_DEV_IDEPNP
1841 pnpide_exit();
1842#endif
1843
1844 proc_ide_destroy(); 1717 proc_ide_destroy();
1845 1718
1846 bus_unregister(&ide_bus_type); 1719 bus_unregister(&ide_bus_type);
diff --git a/drivers/ide/legacy/Makefile b/drivers/ide/legacy/Makefile
index 409822349f10..7043ec7d1e05 100644
--- a/drivers/ide/legacy/Makefile
+++ b/drivers/ide/legacy/Makefile
@@ -1,15 +1,24 @@
1 1
2# link order is important here
3
2obj-$(CONFIG_BLK_DEV_ALI14XX) += ali14xx.o 4obj-$(CONFIG_BLK_DEV_ALI14XX) += ali14xx.o
5obj-$(CONFIG_BLK_DEV_UMC8672) += umc8672.o
3obj-$(CONFIG_BLK_DEV_DTC2278) += dtc2278.o 6obj-$(CONFIG_BLK_DEV_DTC2278) += dtc2278.o
4obj-$(CONFIG_BLK_DEV_HT6560B) += ht6560b.o 7obj-$(CONFIG_BLK_DEV_HT6560B) += ht6560b.o
5obj-$(CONFIG_BLK_DEV_QD65XX) += qd65xx.o 8obj-$(CONFIG_BLK_DEV_QD65XX) += qd65xx.o
6obj-$(CONFIG_BLK_DEV_UMC8672) += umc8672.o
7 9
8obj-$(CONFIG_BLK_DEV_IDECS) += ide-cs.o 10obj-$(CONFIG_BLK_DEV_GAYLE) += gayle.o
11obj-$(CONFIG_BLK_DEV_FALCON_IDE) += falconide.o
12obj-$(CONFIG_BLK_DEV_MAC_IDE) += macide.o
13obj-$(CONFIG_BLK_DEV_Q40IDE) += q40ide.o
14obj-$(CONFIG_BLK_DEV_BUDDHA) += buddha.o
9 15
10obj-$(CONFIG_BLK_DEV_PLATFORM) += ide_platform.o 16ifeq ($(CONFIG_BLK_DEV_IDECS), m)
17 obj-m += ide-cs.o
18endif
11 19
12# Last of all 20ifeq ($(CONFIG_BLK_DEV_PLATFORM), m)
13obj-$(CONFIG_BLK_DEV_HD) += hd.o 21 obj-m += ide_platform.o
22endif
14 23
15EXTRA_CFLAGS := -Idrivers/ide 24EXTRA_CFLAGS := -Idrivers/ide
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 38c3a6d63f30..5ec0be4cbad7 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -231,8 +231,7 @@ int probe_ali14xx = 0;
231module_param_named(probe, probe_ali14xx, bool, 0); 231module_param_named(probe, probe_ali14xx, bool, 0);
232MODULE_PARM_DESC(probe, "probe for ALI M14xx chipsets"); 232MODULE_PARM_DESC(probe, "probe for ALI M14xx chipsets");
233 233
234/* Can be called directly from ide.c. */ 234static int __init ali14xx_init(void)
235int __init ali14xx_init(void)
236{ 235{
237 if (probe_ali14xx == 0) 236 if (probe_ali14xx == 0)
238 goto out; 237 goto out;
@@ -248,9 +247,7 @@ out:
248 return -ENODEV; 247 return -ENODEV;
249} 248}
250 249
251#ifdef MODULE
252module_init(ali14xx_init); 250module_init(ali14xx_init);
253#endif
254 251
255MODULE_AUTHOR("see local file"); 252MODULE_AUTHOR("see local file");
256MODULE_DESCRIPTION("support of ALI 14XX IDE chipsets"); 253MODULE_DESCRIPTION("support of ALI 14XX IDE chipsets");
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index ba64c4b9f918..e97766aef374 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -143,7 +143,7 @@ static int xsurf_ack_intr(ide_hwif_t *hwif)
143 * Probe for a Buddha or Catweasel IDE interface 143 * Probe for a Buddha or Catweasel IDE interface
144 */ 144 */
145 145
146void __init buddha_init(void) 146static int __init buddha_init(void)
147{ 147{
148 hw_regs_t hw; 148 hw_regs_t hw;
149 ide_hwif_t *hwif; 149 ide_hwif_t *hwif;
@@ -243,4 +243,8 @@ fail_base2:
243 243
244 ide_device_add(idx); 244 ide_device_add(idx);
245 } 245 }
246
247 return 0;
246} 248}
249
250module_init(buddha_init);
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
index 24a845d45bd2..13eee6da2806 100644
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -150,8 +150,7 @@ int probe_dtc2278 = 0;
150module_param_named(probe, probe_dtc2278, bool, 0); 150module_param_named(probe, probe_dtc2278, bool, 0);
151MODULE_PARM_DESC(probe, "probe for DTC2278xx chipsets"); 151MODULE_PARM_DESC(probe, "probe for DTC2278xx chipsets");
152 152
153/* Can be called directly from ide.c. */ 153static int __init dtc2278_init(void)
154int __init dtc2278_init(void)
155{ 154{
156 if (probe_dtc2278 == 0) 155 if (probe_dtc2278 == 0)
157 return -ENODEV; 156 return -ENODEV;
@@ -163,9 +162,7 @@ int __init dtc2278_init(void)
163 return 0; 162 return 0;
164} 163}
165 164
166#ifdef MODULE
167module_init(dtc2278_init); 165module_init(dtc2278_init);
168#endif
169 166
170MODULE_AUTHOR("See Local File"); 167MODULE_AUTHOR("See Local File");
171MODULE_DESCRIPTION("support of DTC-2278 VLB IDE chipsets"); 168MODULE_DESCRIPTION("support of DTC-2278 VLB IDE chipsets");
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index c1a84540beb1..dec2ef99c778 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -62,7 +62,7 @@ EXPORT_SYMBOL(falconide_intr_lock);
62 * Probe for a Falcon IDE interface 62 * Probe for a Falcon IDE interface
63 */ 63 */
64 64
65void __init falconide_init(void) 65static int __init falconide_init(void)
66{ 66{
67 if (MACH_IS_ATARI && ATARIHW_PRESENT(IDE)) { 67 if (MACH_IS_ATARI && ATARIHW_PRESENT(IDE)) {
68 hw_regs_t hw; 68 hw_regs_t hw;
@@ -84,4 +84,9 @@ void __init falconide_init(void)
84 84
85 ide_device_add(idx); 85 ide_device_add(idx);
86 } 86 }
87 }
88
89 return 0;
87} 90}
91
92module_init(falconide_init);
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index ec53dc9b483c..e21ef75c9055 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -110,13 +110,13 @@ static int gayle_ack_intr_a1200(ide_hwif_t *hwif)
110 * Probe for a Gayle IDE interface (and optionally for an IDE doubler) 110 * Probe for a Gayle IDE interface (and optionally for an IDE doubler)
111 */ 111 */
112 112
113void __init gayle_init(void) 113static int __init gayle_init(void)
114{ 114{
115 int a4000, i; 115 int a4000, i;
116 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 116 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
117 117
118 if (!MACH_IS_AMIGA) 118 if (!MACH_IS_AMIGA)
119 return; 119 return -ENODEV;
120 120
121 if ((a4000 = AMIGAHW_PRESENT(A4000_IDE)) || AMIGAHW_PRESENT(A1200_IDE)) 121 if ((a4000 = AMIGAHW_PRESENT(A4000_IDE)) || AMIGAHW_PRESENT(A1200_IDE))
122 goto found; 122 goto found;
@@ -126,7 +126,7 @@ void __init gayle_init(void)
126 NULL)) 126 NULL))
127 goto found; 127 goto found;
128#endif 128#endif
129 return; 129 return -ENODEV;
130 130
131found: 131found:
132 for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) { 132 for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) {
@@ -191,4 +191,8 @@ found:
191 } 191 }
192 192
193 ide_device_add(idx); 193 ide_device_add(idx);
194
195 return 0;
194} 196}
197
198module_init(gayle_init);
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index a4245d13f11b..8da5031a6d05 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -307,8 +307,7 @@ int probe_ht6560b = 0;
307module_param_named(probe, probe_ht6560b, bool, 0); 307module_param_named(probe, probe_ht6560b, bool, 0);
308MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); 308MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
309 309
310/* Can be called directly from ide.c. */ 310static int __init ht6560b_init(void)
311int __init ht6560b_init(void)
312{ 311{
313 ide_hwif_t *hwif, *mate; 312 ide_hwif_t *hwif, *mate;
314 static u8 idx[4] = { 0, 1, 0xff, 0xff }; 313 static u8 idx[4] = { 0, 1, 0xff, 0xff };
@@ -369,9 +368,7 @@ release_region:
369 return -ENODEV; 368 return -ENODEV;
370} 369}
371 370
372#ifdef MODULE
373module_init(ht6560b_init); 371module_init(ht6560b_init);
374#endif
375 372
376MODULE_AUTHOR("See Local File"); 373MODULE_AUTHOR("See Local File");
377MODULE_DESCRIPTION("HT-6560B EIDE-controller support"); 374MODULE_DESCRIPTION("HT-6560B EIDE-controller support");
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index c1b7881c280a..6b3e960350aa 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -81,7 +81,7 @@ int macide_ack_intr(ide_hwif_t* hwif)
81 * Probe for a Macintosh IDE interface 81 * Probe for a Macintosh IDE interface
82 */ 82 */
83 83
84void __init macide_init(void) 84static int __init macide_init(void)
85{ 85{
86 hw_regs_t hw; 86 hw_regs_t hw;
87 ide_hwif_t *hwif; 87 ide_hwif_t *hwif;
@@ -106,7 +106,7 @@ void __init macide_init(void)
106 IRQ_BABOON_1); 106 IRQ_BABOON_1);
107 break; 107 break;
108 default: 108 default:
109 return; 109 return -ENODEV;
110 } 110 }
111 111
112 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); 112 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
@@ -139,4 +139,8 @@ void __init macide_init(void)
139 139
140 ide_device_add(idx); 140 ide_device_add(idx);
141 } 141 }
142
143 return 0;
142} 144}
145
146module_init(macide_init);
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index 2082e9c6efd9..0154c91ee4b1 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -111,7 +111,7 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
111 * Probe for Q40 IDE interfaces 111 * Probe for Q40 IDE interfaces
112 */ 112 */
113 113
114void __init q40ide_init(void) 114static int __init q40ide_init(void)
115{ 115{
116 int i; 116 int i;
117 ide_hwif_t *hwif; 117 ide_hwif_t *hwif;
@@ -119,7 +119,7 @@ void __init q40ide_init(void)
119 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 119 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
120 120
121 if (!MACH_IS_Q40) 121 if (!MACH_IS_Q40)
122 return ; 122 return -ENODEV;
123 123
124 for (i = 0; i < Q40IDE_NUM_HWIFS; i++) { 124 for (i = 0; i < Q40IDE_NUM_HWIFS; i++) {
125 hw_regs_t hw; 125 hw_regs_t hw;
@@ -153,5 +153,8 @@ void __init q40ide_init(void)
153 } 153 }
154 154
155 ide_device_add(idx); 155 ide_device_add(idx);
156
157 return 0;
156} 158}
157 159
160module_init(q40ide_init);
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 912e73853faa..2bac4c1a6532 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -478,8 +478,7 @@ int probe_qd65xx = 0;
478module_param_named(probe, probe_qd65xx, bool, 0); 478module_param_named(probe, probe_qd65xx, bool, 0);
479MODULE_PARM_DESC(probe, "probe for QD65xx chipsets"); 479MODULE_PARM_DESC(probe, "probe for QD65xx chipsets");
480 480
481/* Can be called directly from ide.c. */ 481static int __init qd65xx_init(void)
482int __init qd65xx_init(void)
483{ 482{
484 if (probe_qd65xx == 0) 483 if (probe_qd65xx == 0)
485 return -ENODEV; 484 return -ENODEV;
@@ -492,9 +491,7 @@ int __init qd65xx_init(void)
492 return 0; 491 return 0;
493} 492}
494 493
495#ifdef MODULE
496module_init(qd65xx_init); 494module_init(qd65xx_init);
497#endif
498 495
499MODULE_AUTHOR("Samuel Thibault"); 496MODULE_AUTHOR("Samuel Thibault");
500MODULE_DESCRIPTION("support of qd65xx vlb ide chipset"); 497MODULE_DESCRIPTION("support of qd65xx vlb ide chipset");
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
index 79577b916874..a1ae1ae6699d 100644
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -169,8 +169,7 @@ int probe_umc8672 = 0;
169module_param_named(probe, probe_umc8672, bool, 0); 169module_param_named(probe, probe_umc8672, bool, 0);
170MODULE_PARM_DESC(probe, "probe for UMC8672 chipset"); 170MODULE_PARM_DESC(probe, "probe for UMC8672 chipset");
171 171
172/* Can be called directly from ide.c. */ 172static int __init umc8672_init(void)
173int __init umc8672_init(void)
174{ 173{
175 if (probe_umc8672 == 0) 174 if (probe_umc8672 == 0)
176 goto out; 175 goto out;
@@ -181,9 +180,7 @@ out:
181 return -ENODEV;; 180 return -ENODEV;;
182} 181}
183 182
184#ifdef MODULE
185module_init(umc8672_init); 183module_init(umc8672_init);
186#endif
187 184
188MODULE_AUTHOR("Wolfram Podien"); 185MODULE_AUTHOR("Wolfram Podien");
189MODULE_DESCRIPTION("Support for UMC 8672 IDE chipset"); 186MODULE_DESCRIPTION("Support for UMC 8672 IDE chipset");
diff --git a/drivers/ide/pci/Makefile b/drivers/ide/pci/Makefile
index 95d1ea8f1f14..94803253e8af 100644
--- a/drivers/ide/pci/Makefile
+++ b/drivers/ide/pci/Makefile
@@ -36,4 +36,8 @@ obj-$(CONFIG_BLK_DEV_VIA82CXXX) += via82cxxx.o
36# Must appear at the end of the block 36# Must appear at the end of the block
37obj-$(CONFIG_BLK_DEV_GENERIC) += generic.o 37obj-$(CONFIG_BLK_DEV_GENERIC) += generic.o
38 38
39ifeq ($(CONFIG_BLK_DEV_CMD640), m)
40 obj-m += cmd640.o
41endif
42
39EXTRA_CFLAGS := -Idrivers/ide 43EXTRA_CFLAGS := -Idrivers/ide
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index 5096e059ac5a..da3565e0071f 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -706,9 +706,9 @@ static int pci_conf2(void)
706} 706}
707 707
708/* 708/*
709 * Probe for a cmd640 chipset, and initialize it if found. Called from ide.c 709 * Probe for a cmd640 chipset, and initialize it if found.
710 */ 710 */
711int __init ide_probe_for_cmd640x (void) 711static int __init cmd640x_init(void)
712{ 712{
713#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 713#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
714 int second_port_toggled = 0; 714 int second_port_toggled = 0;
@@ -883,3 +883,7 @@ int __init ide_probe_for_cmd640x (void)
883 return 1; 883 return 1;
884} 884}
885 885
886module_param_named(probe_vlb, cmd640_vlb, bool, 0);
887MODULE_PARM_DESC(probe_vlb, "probe for VLB version of CMD640 chipset");
888
889module_init(cmd640x_init);
diff --git a/drivers/ide/ppc/Makefile b/drivers/ide/ppc/Makefile
new file mode 100644
index 000000000000..65af5848b28c
--- /dev/null
+++ b/drivers/ide/ppc/Makefile
@@ -0,0 +1,3 @@
1
2obj-$(CONFIG_BLK_DEV_IDE_PMAC) += pmac.o
3obj-$(CONFIG_BLK_DEV_MPC8xx_IDE) += mpc8xx.o
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index 8172e813b034..3fd5d45b5e0e 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -839,7 +839,7 @@ void m8xx_ide_init(void)
839 ppc_ide_md.ide_init_hwif = m8xx_ide_init_hwif_ports; 839 ppc_ide_md.ide_init_hwif = m8xx_ide_init_hwif_ports;
840} 840}
841 841
842void __init mpc8xx_ide_probe(void) 842static int __init mpc8xx_ide_probe(void)
843{ 843{
844 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 844 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
845 845
@@ -851,4 +851,8 @@ void __init mpc8xx_ide_probe(void)
851#endif 851#endif
852 852
853 ide_device_add(idx); 853 ide_device_add(idx);
854
855 return 0;
854} 856}
857
858module_init(mpc8xx_ide_probe);
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 36e4b9570746..cd514743df96 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1786,3 +1786,5 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1786} 1786}
1787 1787
1788#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ 1788#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
1789
1790module_init(pmac_ide_probe);
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index d89f84d41b08..63ef8aaa7b90 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -766,21 +766,20 @@ static int __init ide_scan_pcidev(struct pci_dev *dev)
766 766
767/** 767/**
768 * ide_scan_pcibus - perform the initial IDE driver scan 768 * ide_scan_pcibus - perform the initial IDE driver scan
769 * @scan_direction: set for reverse order scanning
770 * 769 *
771 * Perform the initial bus rather than driver ordered scan of the 770 * Perform the initial bus rather than driver ordered scan of the
772 * PCI drivers. After this all IDE pci handling becomes standard 771 * PCI drivers. After this all IDE pci handling becomes standard
773 * module ordering not traditionally ordered. 772 * module ordering not traditionally ordered.
774 */ 773 */
775 774
776void __init ide_scan_pcibus (int scan_direction) 775int __init ide_scan_pcibus(void)
777{ 776{
778 struct pci_dev *dev = NULL; 777 struct pci_dev *dev = NULL;
779 struct pci_driver *d; 778 struct pci_driver *d;
780 struct list_head *l, *n; 779 struct list_head *l, *n;
781 780
782 pre_init = 0; 781 pre_init = 0;
783 if (!scan_direction) 782 if (!ide_scan_direction)
784 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev))) 783 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)))
785 ide_scan_pcidev(dev); 784 ide_scan_pcidev(dev);
786 else 785 else
@@ -801,5 +800,7 @@ void __init ide_scan_pcibus (int scan_direction)
801 printk(KERN_ERR "%s: failed to register %s driver\n", 800 printk(KERN_ERR "%s: failed to register %s driver\n",
802 __FUNCTION__, d->driver.mod_name); 801 __FUNCTION__, d->driver.mod_name);
803 } 802 }
803
804 return 0;
804} 805}
805#endif 806#endif
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 9c037a0f2af2..735737500f8f 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1014,7 +1014,8 @@ extern void do_ide_request(struct request_queue *);
1014void ide_init_disk(struct gendisk *, ide_drive_t *); 1014void ide_init_disk(struct gendisk *, ide_drive_t *);
1015 1015
1016#ifdef CONFIG_IDEPCI_PCIBUS_ORDER 1016#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
1017extern void ide_scan_pcibus(int scan_direction) __init; 1017extern int ide_scan_direction;
1018int __init ide_scan_pcibus(void);
1018extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); 1019extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
1019#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) 1020#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
1020#else 1021#else