From: Andrey Panin <pazke@donpac.ru>

Example code for the new DMI APU - port HP Pavilion irq workaround to new
DMI probing.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/i386/kernel/dmi_scan.c |   24 ------------------------
 25-akpm/arch/i386/pci/irq.c         |   32 +++++++++++++++++++++++++++++++-
 25-akpm/arch/i386/pci/visws.c       |    2 --
 3 files changed, 31 insertions(+), 27 deletions(-)

diff -puN arch/i386/kernel/dmi_scan.c~hp-pavilion-use-dmi-api arch/i386/kernel/dmi_scan.c
--- 25/arch/i386/kernel/dmi_scan.c~hp-pavilion-use-dmi-api	2004-06-08 01:11:50.332947848 -0700
+++ 25-akpm/arch/i386/kernel/dmi_scan.c	2004-06-08 01:13:30.677693128 -0700
@@ -317,23 +317,6 @@ static __init int disable_smbus(struct d
 }
 
 /*
- * Work around broken HP Pavilion Notebooks which assign USB to
- * IRQ 9 even though it is actually wired to IRQ 11
- */
-static __init int fix_broken_hp_bios_irq9(struct dmi_blacklist *d)
-{
-#ifdef CONFIG_PCI
-	extern int broken_hp_bios_irq9;
-	if (broken_hp_bios_irq9 == 0)
-	{
-		broken_hp_bios_irq9 = 1;
-		printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", d->ident);
-	}
-#endif
-	return 0;
-}
-
-/*
  * Work around broken Acer TravelMate 360 Notebooks which assign Cardbus to
  * IRQ 11 even though it is actually wired to IRQ 10
  */
@@ -839,13 +822,6 @@ static __initdata struct dmi_blacklist d
 			NO_MATCH, NO_MATCH
 			} },
 	 
-	{ fix_broken_hp_bios_irq9, "HP Pavilion N5400 Series Laptop", {
-			MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
-			MATCH(DMI_BIOS_VERSION, "GE.M1.03"),
-			MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook Model GE"),
-			MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736")
-			} },
-
 	{ fix_acer_tm360_irqrouting, "Acer TravelMate 36x Laptop", {
 			MATCH(DMI_SYS_VENDOR, "Acer"),
 			MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
diff -puN arch/i386/pci/irq.c~hp-pavilion-use-dmi-api arch/i386/pci/irq.c
--- 25/arch/i386/pci/irq.c~hp-pavilion-use-dmi-api	2004-06-08 01:11:50.334947544 -0700
+++ 25-akpm/arch/i386/pci/irq.c	2004-06-08 01:13:48.433993760 -0700
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/dmi.h>
 #include <asm/io.h>
 #include <asm/smp.h>
 #include <asm/io_apic.h>
@@ -22,7 +23,7 @@
 #define PIRQ_SIGNATURE	(('$' << 0) + ('P' << 8) + ('I' << 16) + ('R' << 24))
 #define PIRQ_VERSION 0x0100
 
-int broken_hp_bios_irq9;
+static int broken_hp_bios_irq9;
 int acer_tm360_irqrouting;
 
 static struct irq_routing_table *pirq_table;
@@ -902,6 +903,33 @@ static void __init pcibios_fixup_irqs(vo
 	}
 }
 
+/*
+ * Work around broken HP Pavilion Notebooks which assign USB to
+ * IRQ 9 even though it is actually wired to IRQ 11
+ */
+static int __init fix_broken_hp_bios_irq9(struct dmi_system_id *d)
+{
+	if (!broken_hp_bios_irq9) {
+		broken_hp_bios_irq9 = 1;
+		printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", d->ident);
+	}
+	return 0;
+}
+
+static struct dmi_system_id __initdata pciirq_dmi_table[] = {
+	{
+		.callback = fix_broken_hp_bios_irq9,
+		.ident = "HP Pavilion N5400 Series Laptop",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+			DMI_MATCH(DMI_BIOS_VERSION, "GE.M1.03"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook Model GE"),
+			DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"),
+		},
+	},
+	{ }
+};
+
 static int __init pcibios_irq_init(void)
 {
 	DBG("PCI: IRQ init\n");
@@ -909,6 +937,8 @@ static int __init pcibios_irq_init(void)
 	if (pcibios_enable_irq || raw_pci_ops == NULL)
 		return 0;
 
+	dmi_check_system(pciirq_dmi_table);
+
 	pirq_table = pirq_find_routing_table();
 
 #ifdef CONFIG_PCI_BIOS
diff -puN arch/i386/pci/visws.c~hp-pavilion-use-dmi-api arch/i386/pci/visws.c
--- 25/arch/i386/pci/visws.c~hp-pavilion-use-dmi-api	2004-06-08 01:11:50.335947392 -0700
+++ 25-akpm/arch/i386/pci/visws.c	2004-06-08 01:11:52.730583352 -0700
@@ -15,8 +15,6 @@
 #include "pci.h"
 
 
-int broken_hp_bios_irq9;
-
 extern struct pci_raw_ops pci_direct_conf1;
 
 static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; }
_