From: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>

ide_init_default_hwifs() -> ide_init_default_irq()

init_ide_data() initializes default IDE interfaces but without default IRQ
(hwif->irq and hwif->hw.irq fields) so introduce ide_init_default_irq() and
remove redundant ide_init_default_hwifs() (except arm26 and arm ones).

As a side-effect it fixes:
- CONFIG_BLK_DEV_HD_IDE if !CONFIG_BLK_DEV_IDEPCI (i386)
- hwif->noprobe shouldn't be 0 if !hwif->io_ports[IDE_DATA_OFFSET]
  (alpha, i386, ia64, mips, sh, x86_64)


---

 25-akpm/drivers/ide/ide.c                   |    5 +++++
 25-akpm/include/asm-alpha/ide.h             |   20 ++++----------------
 25-akpm/include/asm-arm/ide.h               |    2 ++
 25-akpm/include/asm-arm26/ide.h             |    2 ++
 25-akpm/include/asm-h8300/ide.h             |    5 +----
 25-akpm/include/asm-i386/ide.h              |   19 +++++--------------
 25-akpm/include/asm-ia64/ide.h              |   18 ++++--------------
 25-akpm/include/asm-m68k/ide.h              |    8 +-------
 25-akpm/include/asm-m68knommu/ide.h         |   23 +----------------------
 25-akpm/include/asm-mips/mach-generic/ide.h |   19 +++++--------------
 25-akpm/include/asm-parisc/ide.h            |    3 +--
 25-akpm/include/asm-ppc/ide.h               |   20 ++++----------------
 25-akpm/include/asm-ppc64/ide.h             |    4 +---
 25-akpm/include/asm-sh/ide.h                |   19 +++++--------------
 25-akpm/include/asm-sparc/ide.h             |    3 +--
 25-akpm/include/asm-sparc64/ide.h           |    3 +--
 25-akpm/include/asm-x86_64/ide.h            |   19 +++++--------------
 17 files changed, 48 insertions(+), 144 deletions(-)

diff -puN drivers/ide/ide.c~ide-cleanups-2 drivers/ide/ide.c
--- 25/drivers/ide/ide.c~ide-cleanups-2	2004-04-17 22:01:29.752928112 -0700
+++ 25-akpm/drivers/ide/ide.c	2004-04-17 22:01:29.777924312 -0700
@@ -307,12 +307,17 @@ static void __init init_ide_data (void)
 		hwif = &ide_hwifs[index];
 		init_hwif_data(hwif, index);
 		init_hwif_default(hwif, index);
+		hwif->irq = hwif->hw.irq =
+			ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]);
 	}
 
+/* OBSOLETE: still needed on arm26 and arm */
+#ifdef CONFIG_ARM
 	/* Add default hw interfaces */
 	initializing = 1;
 	ide_init_default_hwifs();
 	initializing = 0;
+#endif
 }
 
 /*
diff -puN include/asm-alpha/ide.h~ide-cleanups-2 include/asm-alpha/ide.h
--- 25/include/asm-alpha/ide.h~ide-cleanups-2	2004-04-17 22:01:29.754927808 -0700
+++ 25-akpm/include/asm-alpha/ide.h	2004-04-17 22:01:29.777924312 -0700
@@ -63,23 +63,11 @@ static inline void ide_init_hwif_ports(h
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static __inline__ void ide_init_default_hwifs(void)
-{
-#ifndef CONFIG_PCI
-	hw_regs_t hw;
-	int index;
-
-	for (index = 0; index < MAX_HWIFS; index++) {
-		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
-		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
-	}
+#ifdef CONFIG_PCI
+#define ide_init_default_irq(base)	(0)
+#else
+#define ide_init_default_irq(base)	ide_default_irq(base)
 #endif
-}
 
 #include <asm-generic/ide_iops.h>
 
diff -puN include/asm-arm26/ide.h~ide-cleanups-2 include/asm-arm26/ide.h
--- 25/include/asm-arm26/ide.h~ide-cleanups-2	2004-04-17 22:01:29.755927656 -0700
+++ 25-akpm/include/asm-arm26/ide.h	2004-04-17 22:01:29.778924160 -0700
@@ -45,6 +45,8 @@ static inline void ide_init_hwif_ports(h
                 *irq = 0;
 }
 
+#define ide_init_default_irq(base)	(0)
+
 /*
  * This registers the standard ports for this architecture with the IDE
  * driver.
diff -puN include/asm-arm/ide.h~ide-cleanups-2 include/asm-arm/ide.h
--- 25/include/asm-arm/ide.h~ide-cleanups-2	2004-04-17 22:01:29.756927504 -0700
+++ 25-akpm/include/asm-arm/ide.h	2004-04-17 22:01:29.778924160 -0700
@@ -26,6 +26,8 @@
 #define ide_default_io_base(i)		(0)
 #define ide_default_irq(b)		(0)
 
+#define ide_init_default_irq(base)	(0)
+
 #define __ide_mm_insw(port,addr,len)	readsw(port,addr,len)
 #define __ide_mm_insl(port,addr,len)	readsl(port,addr,len)
 #define __ide_mm_outsw(port,addr,len)	writesw(port,addr,len)
diff -puN include/asm-h8300/ide.h~ide-cleanups-2 include/asm-h8300/ide.h
--- 25/include/asm-h8300/ide.h~ide-cleanups-2	2004-04-17 22:01:29.757927352 -0700
+++ 25-akpm/include/asm-h8300/ide.h	2004-04-17 22:01:29.778924160 -0700
@@ -25,10 +25,7 @@ static __inline__ void ide_init_hwif_por
 {
 }
 
-
-static inline void ide_init_default_hwifs(void)
-{
-}
+#define ide_init_default_irq(base)	(0)
 
 #define MAX_HWIFS	1
 
diff -puN include/asm-i386/ide.h~ide-cleanups-2 include/asm-i386/ide.h
--- 25/include/asm-i386/ide.h~ide-cleanups-2	2004-04-17 22:01:29.759927048 -0700
+++ 25-akpm/include/asm-i386/ide.h	2004-04-17 22:01:29.779924008 -0700
@@ -90,20 +90,11 @@ static __inline__ void ide_init_hwif_por
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 
-static __inline__ void ide_init_default_hwifs(void)
-{
-#ifndef CONFIG_BLK_DEV_IDEPCI
-	hw_regs_t hw;
-	int index;
-
-	for(index = 0; index < MAX_HWIFS; index++) {
-		memset(&hw, 0, sizeof hw);
-		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
-		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
-	}
-#endif /* CONFIG_BLK_DEV_IDEPCI */
-}
+#ifdef CONFIG_BLK_DEV_IDEPCI
+#define ide_init_default_irq(base)	(0)
+#else
+#define ide_init_default_irq(base)	ide_default_irq(base)
+#endif
 
 #include <asm-generic/ide_iops.h>
 
diff -puN include/asm-ia64/ide.h~ide-cleanups-2 include/asm-ia64/ide.h
--- 25/include/asm-ia64/ide.h~ide-cleanups-2	2004-04-17 22:01:29.760926896 -0700
+++ 25-akpm/include/asm-ia64/ide.h	2004-04-17 22:01:29.779924008 -0700
@@ -73,21 +73,11 @@ static inline void ide_init_hwif_ports(h
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 
-static __inline__ void
-ide_init_default_hwifs (void)
-{
-#ifndef CONFIG_PCI
-	hw_regs_t hw;
-	int index;
-
-	for(index = 0; index < MAX_HWIFS; index++) {
-		memset(&hw, 0, sizeof hw);
-		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
-		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
-	}
+#ifdef CONFIG_PCI
+#define ide_init_default_irq(base)	(0)
+#else
+#define ide_init_default_irq(base)	ide_default_irq(base)
 #endif
-}
 
 #include <asm-generic/ide_iops.h>
 
diff -puN include/asm-m68k/ide.h~ide-cleanups-2 include/asm-m68k/ide.h
--- 25/include/asm-m68k/ide.h~ide-cleanups-2	2004-04-17 22:01:29.761926744 -0700
+++ 25-akpm/include/asm-m68k/ide.h	2004-04-17 22:01:29.779924008 -0700
@@ -74,13 +74,7 @@ static __inline__ void ide_init_hwif_por
 		printk("ide_init_hwif_ports: must not be called\n");
 }
 
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static __inline__ void ide_init_default_hwifs(void)
-{
-}
+#define ide_init_default_irq(base)	(0)
 
 /*
  * Get rid of defs from io.h - ide has its private and conflicting versions
diff -puN include/asm-m68knommu/ide.h~ide-cleanups-2 include/asm-m68knommu/ide.h
--- 25/include/asm-m68knommu/ide.h~ide-cleanups-2	2004-04-17 22:01:29.762926592 -0700
+++ 25-akpm/include/asm-m68knommu/ide.h	2004-04-17 22:01:29.780923856 -0700
@@ -139,28 +139,7 @@ static IDE_INLINE void ide_init_hwif_por
 	}
 }
 
-
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static IDE_INLINE void ide_init_default_hwifs(void)
-{
-	hw_regs_t hw;
-	ide_ioreg_t base;
-	int index;
-
-	for (index = 0; index < MAX_HWIFS; index++) {
-		base = ide_default_io_base(index);
-		if (!base)
-			continue;
-		memset(&hw, 0, sizeof(hw));
-		ide_init_hwif_ports(&hw, base, 0, NULL);
-		hw.irq = ide_default_irq(base);
-		ide_register_hw(&hw, NULL);
-	}
-}
-
+#define ide_init_default_irq(base)	ide_default_irq(base)
 
 static IDE_INLINE int
 ide_request_irq(
diff -puN include/asm-mips/mach-generic/ide.h~ide-cleanups-2 include/asm-mips/mach-generic/ide.h
--- 25/include/asm-mips/mach-generic/ide.h~ide-cleanups-2	2004-04-17 22:01:29.764926288 -0700
+++ 25-akpm/include/asm-mips/mach-generic/ide.h	2004-04-17 22:01:29.780923856 -0700
@@ -68,19 +68,10 @@ static inline void ide_init_hwif_ports(h
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 
-static inline void ide_init_default_hwifs(void)
-{
-#ifndef CONFIG_BLK_DEV_IDEPCI
-	hw_regs_t hw;
-	int index;
-
-	for(index = 0; index < MAX_HWIFS; index++) {
-		memset(&hw, 0, sizeof hw);
-		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
-		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
-	}
-#endif /* CONFIG_BLK_DEV_IDEPCI */
-}
+#ifdef CONFIG_BLK_DEV_IDEPCI
+#define ide_init_default_irq(base)	(0)
+#else
+#define ide_init_default_irq(base)	ide_default_irq(base)
+#endif
 
 #endif /* __ASM_MACH_GENERIC_IDE_H */
diff -puN include/asm-parisc/ide.h~ide-cleanups-2 include/asm-parisc/ide.h
--- 25/include/asm-parisc/ide.h~ide-cleanups-2	2004-04-17 22:01:29.765926136 -0700
+++ 25-akpm/include/asm-parisc/ide.h	2004-04-17 22:01:29.781923704 -0700
@@ -42,8 +42,7 @@ static inline void ide_init_hwif_ports(h
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 
-/* There are no standard ports. */
-static inline void ide_init_default_hwifs(void)	{ ; }
+#define ide_init_default_irq(base)	(0)
 
 #define ide_request_irq(irq,hand,flg,dev,id)	request_irq((irq),(hand),(flg),(dev),(id))
 #define ide_free_irq(irq,dev_id)		free_irq((irq), (dev_id))
diff -puN include/asm-ppc64/ide.h~ide-cleanups-2 include/asm-ppc64/ide.h
--- 25/include/asm-ppc64/ide.h~ide-cleanups-2	2004-04-17 22:01:29.766925984 -0700
+++ 25-akpm/include/asm-ppc64/ide.h	2004-04-17 22:01:29.781923704 -0700
@@ -45,9 +45,7 @@ static inline void ide_init_hwif_ports(h
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 
-static __inline__ void ide_init_default_hwifs(void)
-{
-}
+#define ide_init_default_irq(base)	(0)
 
 #endif /* __KERNEL__ */
 
diff -puN include/asm-ppc/ide.h~ide-cleanups-2 include/asm-ppc/ide.h
--- 25/include/asm-ppc/ide.h~ide-cleanups-2	2004-04-17 22:01:29.767925832 -0700
+++ 25-akpm/include/asm-ppc/ide.h	2004-04-17 22:01:29.781923704 -0700
@@ -84,23 +84,11 @@ static __inline__ void ide_init_hwif_por
 		ppc_ide_md.ide_init_hwif(hw, data_port, ctrl_port, irq);
 }
 
-static __inline__ void ide_init_default_hwifs(void)
-{
-#ifndef CONFIG_PCI
-	hw_regs_t hw;
-	int index;
-	unsigned long base;
-
-	for (index = 0; index < MAX_HWIFS; index++) {
-		base = ide_default_io_base(index);
-		if (base == 0)
-			continue;
-		ide_init_hwif_ports(&hw, base, 0, NULL);
-		hw.irq = ide_default_irq(base);
-		ide_register_hw(&hw, NULL);
-	}
+#ifdef CONFIG_PCI
+#define ide_init_default_irq(base)	(0)
+#else
+#define ide_init_default_irq(base)	ide_default_irq(base)
 #endif
-}
 
 #if (defined CONFIG_APUS || defined CONFIG_BLK_DEV_MPC8xx_IDE )
 #define IDE_ARCH_ACK_INTR  1
diff -puN include/asm-sh/ide.h~ide-cleanups-2 include/asm-sh/ide.h
--- 25/include/asm-sh/ide.h~ide-cleanups-2	2004-04-17 22:01:29.769925528 -0700
+++ 25-akpm/include/asm-sh/ide.h	2004-04-17 22:01:29.782923552 -0700
@@ -92,20 +92,11 @@ static inline void ide_init_hwif_ports(h
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 
-static __inline__ void ide_init_default_hwifs(void)
-{
-#ifndef CONFIG_PCI
-	hw_regs_t hw;
-	int index;
-
-	for(index = 0; index < MAX_HWIFS; index++) {
-		memset(&hw, 0, sizeof hw);
-		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
-		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
-	}
-#endif /* CONFIG_PCI */
-}
+#ifdef CONFIG_PCI
+#define ide_init_default_irq(base)	(0)
+#else
+#define ide_init_default_irq(base)	ide_default_irq(base)
+#endif
 
 #include <asm-generic/ide_iops.h>
 
diff -puN include/asm-sparc64/ide.h~ide-cleanups-2 include/asm-sparc64/ide.h
--- 25/include/asm-sparc64/ide.h~ide-cleanups-2	2004-04-17 22:01:29.770925376 -0700
+++ 25-akpm/include/asm-sparc64/ide.h	2004-04-17 22:01:29.782923552 -0700
@@ -53,8 +53,7 @@ static __inline__ void ide_init_hwif_por
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 
-/* There are no standard ports. */
-static inline void ide_init_default_hwifs(void)	{ ; }
+#define ide_init_default_irq(base)	(0)
 
 #define __ide_insl(data_reg, buffer, wcount) \
 	__ide_insw(data_reg, buffer, (wcount)<<1)
diff -puN include/asm-sparc/ide.h~ide-cleanups-2 include/asm-sparc/ide.h
--- 25/include/asm-sparc/ide.h~ide-cleanups-2	2004-04-17 22:01:29.771925224 -0700
+++ 25-akpm/include/asm-sparc/ide.h	2004-04-17 22:01:29.782923552 -0700
@@ -52,8 +52,7 @@ static __inline__ void ide_init_hwif_por
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 
-/* There are no standard ports. */
-static inline void ide_init_default_hwifs(void)	{ ; }
+#define ide_init_default_irq(base)	(0)
 
 #define __ide_insl(data_reg, buffer, wcount) \
 	__ide_insw(data_reg, buffer, (wcount)<<1)
diff -puN include/asm-x86_64/ide.h~ide-cleanups-2 include/asm-x86_64/ide.h
--- 25/include/asm-x86_64/ide.h~ide-cleanups-2	2004-04-17 22:01:29.772925072 -0700
+++ 25-akpm/include/asm-x86_64/ide.h	2004-04-17 22:01:29.783923400 -0700
@@ -71,20 +71,11 @@ static __inline__ void ide_init_hwif_por
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 
-static __inline__ void ide_init_default_hwifs(void)
-{
-#ifndef CONFIG_BLK_DEV_IDEPCI
-	hw_regs_t hw;
-	int index;
-
-	for(index = 0; index < MAX_HWIFS; index++) {
-		memset(&hw, 0, sizeof hw);
-		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
-		hw.irq = ide_default_irq(ide_default_io_base(index));
-		ide_register_hw(&hw, NULL);
-	}
-#endif /* CONFIG_BLK_DEV_IDEPCI */
-}
+#ifdef CONFIG_BLK_DEV_IDEPCI
+#define ide_init_default_irq(base)	(0)
+#else
+#define ide_init_default_irq(base)	ide_default_irq(base)
+#endif
 
 #include <asm-generic/ide_iops.h>
 

_