[PATCH 14/15] misc: Configurable number of supported IDE interfaces

Matt Mackall
2005-11-11T08:36:40Z

Configurable number of supported IDE interfaces

This overrides the default limit (which may be set per arch with
CONFIG_IDE_MAX_HWIFS). This is the result of setting interfaces to 1:

text data bss dec hex filename
3330172 529036 190556 4049764 3dcb64 vmlinux-baseline
3329352 528928 172124 4030404 3d7fc4 vmlinux

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: 2.6.14-misc/drivers/ide/setup-pci.c
===================================================================
--- 2.6.14-misc.orig/drivers/ide/setup-pci.c 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/drivers/ide/setup-pci.c 2005-11-09 11:27:23.000000000 -0800
@@ -102,7 +102,7 @@ static ide_hwif_t *ide_match_hwif(unsign
return hwif; /* pick an unused entry */
}
}
- for (h = 0; h < 2; ++h) {
+ for (h = 0; h < 2 && h < MAX_HWIFS; ++h) {
hwif = ide_hwifs + h;
if (hwif->chipset == ide_unknown)
return hwif; /* pick an unused entry */
Index: 2.6.14-misc/include/linux/ide.h
===================================================================
--- 2.6.14-misc.orig/include/linux/ide.h 2005-11-01 10:54:33.000000000 -0800
+++ 2.6.14-misc/include/linux/ide.h 2005-11-09 11:27:23.000000000 -0800
@@ -309,6 +309,11 @@ static inline void ide_init_hwif_ports(h
}
#endif /* IDE_ARCH_OBSOLETE_INIT */

+#if defined(CONFIG_IDE_HWIFS) && CONFIG_IDE_HWIFS > 0
+#undef MAX_HWIFS
+#define MAX_HWIFS CONFIG_IDE_HWIFS
+#endif
+
/* Currently only m68k, apus and m8xx need it */
#ifndef IDE_ARCH_ACK_INTR
# define ide_ack_intr(hwif) (1)
Index: 2.6.14-misc/init/Kconfig
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:27:20.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-09 11:27:23.000000000 -0800
@@ -457,6 +457,15 @@ config CC_ALIGN_JUMPS
no dummy operations need be executed.
Zero means use compiler's default.

+config IDE_HWIFS
+ depends IDE
+ int "Number of IDE hardware interfaces (0 for default)" if EMBEDDED
+ range 0 20
+ default 0
+ help
+ Select the maximum number of IDE interfaces (0 for default).
+ Saves up to 14k.
+
endmenu # General setup

config TINY_SHMEM