From: Matt Mackall Date: Tue, 3 Oct 2006 08:14:16 +0000 (-0700) Subject: [PATCH] Make number of IDE interfaces configurable X-Git-Tag: v2.6.19-rc1~336 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83d7dbc4095a0c314b191c573be5fb4fa6ce0897;p=linux-2.6 [PATCH] 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 Signed-off-by: Matt Mackall Cc: Bartlomiej Zolnierkiewicz Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 0524f17175..abcabb2955 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -56,7 +56,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 diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index eb0945284a..157fe93ea3 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -101,7 +101,7 @@ static ide_hwif_t *ide_match_hwif(unsigned long io_base, u8 bootable, const char 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 */ diff --git a/include/linux/ide.h b/include/linux/ide.h index 11608cd03d..bdb2733208 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -251,7 +251,8 @@ static inline void ide_std_init_ports(hw_regs_t *hw, #include -#ifndef MAX_HWIFS +#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) +#undef MAX_HWIFS #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS #endif