diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 0524f17175fd5abd7d36c029226efbc5352c7b63..abcabb2955925f09583d6da02a5ce8c7b7cace0b 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 eb0945284accec16b4c0ff0075c504da59f34a35..157fe93ea34270288fbf46b7a32dbcf1f32674c4 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 11608cd03d4cc0411d693cde6fab75d4f237fb7e..bdb2733208c5146efb81ce49d3783c4b529b0a98 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