Skip to contentSkip to conversation

Make number of IDE interfaces configurable

PATCH In review Matt Mackall 3 participants 6 messages May 12, 2006 – May 16, 2006 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make number of IDE interfaces configurable

Make IDE_HWIFS configurable if EMBEDDED

This lets us lop as much as 16k off an x86 build. It's a little ugly, but it's dead simple. Note the fix for HWIFS < 2.

Sizing interfaces dynamically unfortunately turns out to be pretty major surgery.

add/remove: 0/1 grow/shrink: 0/11 up/down: 0/-16182 (-16182)
function old new delta
ide_hwifs 16920 1692 -15228

init_irq                                    1113     750    -363
ideprobe_init                                283     138    -145
ide_pci_setup_ports                         1329    1193    -136
save_match                                    85       -     -85
ide_register_hw_with_fixup                   367     287     -80
ide_setup                                   1364    1308     -56
is_chipset_set                                40       4     -36
create_proc_ide_interfaces                   225     205     -20
init_ide_data                                 84      67     -17
ide_probe_for_cmd640x                       1198    1183     -15

ide_unregister 1452 1451 -1

drivers/ide/Kconfig +1 -1
Index: 2.6/drivers/ide/Kconfig
===================================================================
@@ -54,7 +54,7 @@ if IDE
 
 config IDE_MAX_HWIFS
 	int "Max IDE interfaces"
-	depends on ALPHA || SUPERH || IA64
+	depends on ALPHA || SUPERH || IA64 || EMBEDDED
 	default 4
 	help
 	  This is the maximum number of IDE hardware interfaces that will
drivers/ide/setup-pci.c +1 -1
Index: 2.6/drivers/ide/setup-pci.c
===================================================================
@@ -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 */
include/linux/ide.h +2 -1
Index: 2.6/include/linux/ide.h
===================================================================
@@ -252,7 +252,8 @@ static inline void ide_std_init_ports(hw
 
 #include <asm/ide.h>
 
-#ifndef MAX_HWIFS
+#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
+#undef MAX_HWIFS
 #define MAX_HWIFS	CONFIG_IDE_MAX_HWIFS
 #endif
 
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#1 lore raw

include/linux/ide.h static inline void ide_std_init_ports(hw · line 258

Quoted 12 lines · Matt Mackall

...

include/linux/ide.h +2 -1
@@ -252,7 +252,8 @@ static inline void ide_std_init_ports(hw
 
 #include <asm/ide.h>
 
-#ifndef MAX_HWIFS
+#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
+#undef MAX_HWIFS
 #define MAX_HWIFS	CONFIG_IDE_MAX_HWIFS
 #endif

Why do you need this?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#2 lore raw
Quoted 8 lines · Adrian Bunk
Quoted 7 lines · Matt Mackall

...

include/linux/ide.h +0 -0
@@ -252,7 +252,8 @@ static inline void ide_std_init_ports(hw
 
 #include <asm/ide.h>
 
Quoted 7 lines

include/linux/ide.h static inline void ide_std_init_ports(hw · line 258

Quoted 5 lines
include/linux/ide.h +2 -1
-#ifndef MAX_HWIFS
+#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
+#undef MAX_HWIFS
 #define MAX_HWIFS	CONFIG_IDE_MAX_HWIFS
 #endif

Why do you need this?

Doesn't work without it?

Most platforms define MAX_HWIFS.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#3 lore raw
Quoted 17 lines · Matt Mackall
Quoted 8 lines · Adrian Bunk
Quoted 7 lines · Matt Mackall

...

include/linux/ide.h +0 -0
@@ -252,7 +252,8 @@ static inline void ide_std_init_ports(hw
 
 #include <asm/ide.h>
 
Quoted 7 lines

include/linux/ide.h static inline void ide_std_init_ports(hw · line 258

Quoted 5 lines
include/linux/ide.h +2 -1
-#ifndef MAX_HWIFS
+#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
+#undef MAX_HWIFS
 #define MAX_HWIFS	CONFIG_IDE_MAX_HWIFS
 #endif

Why do you need this?

Quoted 3 lines

Doesn't work without it?

Most platforms define MAX_HWIFS.

OK, now I got it.

Setting this value is sometimes done in heder files and sometimes done in the Kconfig file.

That is extremely ugly.

Bart, would you accept a patch to set in in the Kconfig file on all architectures?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#4 lore raw

I submitted a patch ages ago similar (but differnet ;-) ) to this:

http://lkml.org/lkml/2005/6/25/69

I couldn't/don't see why I get six ide probes when I know I have only 2 IDE interfaces - I thought it would be better to stick to default _unless_ the kernel builder knew otherwise and specified the amount.

Alan Cox didn't like it as it introduces more config unnecessary config options.

But it would be nice though if this could be included with that enhancement too.

Nick

Quoted 48 lines · Adrian Bunk
Quoted 17 lines · Matt Mackall
Quoted 8 lines · Adrian Bunk
Quoted 7 lines · Matt Mackall

...

include/linux/ide.h +0 -0
@@ -252,7 +252,8 @@ static inline void ide_std_init_ports(hw
 
 #include <asm/ide.h>
 
Quoted 7 lines

include/linux/ide.h static inline void ide_std_init_ports(hw · line 258

Quoted 5 lines
include/linux/ide.h +2 -1
-#ifndef MAX_HWIFS
+#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
+#undef MAX_HWIFS
 #define MAX_HWIFS	CONFIG_IDE_MAX_HWIFS
 #endif

Why do you need this?

Quoted 3 lines

Doesn't work without it?

Most platforms define MAX_HWIFS.

OK, now I got it.

Setting this value is sometimes done in heder files and sometimes done in the Kconfig file.

That is extremely ugly.

Bart, would you accept a patch to set in in the Kconfig file on all architectures?

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

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

#5 lore raw
In reply to Matt Mackall

include/linux/ide.h static inline void ide_std_init_ports(hw · line 258

Quoted 12 lines · Matt Mackall

...

include/linux/ide.h +2 -1
@@ -252,7 +252,8 @@ static inline void ide_std_init_ports(hw
 
 #include <asm/ide.h>
 
-#ifndef MAX_HWIFS
+#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
+#undef MAX_HWIFS
 #define MAX_HWIFS	CONFIG_IDE_MAX_HWIFS
 #endif

Why do you need this?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed