x86, apic: streamline the ->multi_timer_check() quirk

only NUMAQ uses this quirk: to prevent the timer IRQ from being added
on secondary nodes.

All other genapic templates can have a NULL ->multi_timer_check()
callback.

Also, extend the generic code to treat a NULL pointer accordingly.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/include/asm/bigsmp/apic.h b/arch/x86/include/asm/bigsmp/apic.h
index 321ea47..df59298 100644
--- a/arch/x86/include/asm/bigsmp/apic.h
+++ b/arch/x86/include/asm/bigsmp/apic.h
@@ -62,11 +62,6 @@
 		"Physflat", nr_ioapics);
 }
 
-static inline int multi_timer_check(int apic, int irq)
-{
-	return (0);
-}
-
 static inline int apicid_to_node(int logical_apicid)
 {
 	return apicid_2_node[hard_smp_processor_id()];
diff --git a/arch/x86/include/asm/es7000/apic.h b/arch/x86/include/asm/es7000/apic.h
index f118300..632e4cd 100644
--- a/arch/x86/include/asm/es7000/apic.h
+++ b/arch/x86/include/asm/es7000/apic.h
@@ -82,11 +82,6 @@
 			nr_ioapics, cpus_addr(*es7000_target_cpus())[0]);
 }
 
-static inline int multi_timer_check(int apic, int irq)
-{
-	return 0;
-}
-
 static inline int apicid_to_node(int logical_apicid)
 {
 	return 0;
diff --git a/arch/x86/include/asm/mach-default/mach_apic.h b/arch/x86/include/asm/mach-default/mach_apic.h
index d446774..f418d47 100644
--- a/arch/x86/include/asm/mach-default/mach_apic.h
+++ b/arch/x86/include/asm/mach-default/mach_apic.h
@@ -104,11 +104,6 @@
 	return phys_map;
 }
 
-static inline int multi_timer_check(int apic, int irq)
-{
-	return 0;
-}
-
 /* Mapping from cpu number to logical apicid */
 static inline int cpu_to_logical_apicid(int cpu)
 {
diff --git a/arch/x86/include/asm/mach-generic/mach_apic.h b/arch/x86/include/asm/mach-generic/mach_apic.h
index ddf3692..bdea0a7 100644
--- a/arch/x86/include/asm/mach-generic/mach_apic.h
+++ b/arch/x86/include/asm/mach-generic/mach_apic.h
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define multi_timer_check (apic->multi_timer_check)
 #define apicid_to_node (apic->apicid_to_node)
 #define cpu_to_logical_apicid (apic->cpu_to_logical_apicid) 
 #define cpu_present_to_apicid (apic->cpu_present_to_apicid)
diff --git a/arch/x86/include/asm/numaq/apic.h b/arch/x86/include/asm/numaq/apic.h
index 2feb7e7..22bdf3d 100644
--- a/arch/x86/include/asm/numaq/apic.h
+++ b/arch/x86/include/asm/numaq/apic.h
@@ -43,7 +43,7 @@
  * Skip adding the timer int on secondary nodes, which causes
  * a small but painful rift in the time-space continuum.
  */
-static inline int multi_timer_check(int apic, int irq)
+static inline int numaq_multi_timer_check(int apic, int irq)
 {
 	return apic != 0 && irq == 0;
 }
diff --git a/arch/x86/include/asm/summit/apic.h b/arch/x86/include/asm/summit/apic.h
index 7ec2696..acb7bd1 100644
--- a/arch/x86/include/asm/summit/apic.h
+++ b/arch/x86/include/asm/summit/apic.h
@@ -64,11 +64,6 @@
 	apic_write(APIC_LDR, val);
 }
 
-static inline int multi_timer_check(int apic, int irq)
-{
-	return 0;
-}
-
 static inline int summit_apic_id_registered(void)
 {
 	return 1;
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c
index db79ad9..282ea11 100644
--- a/arch/x86/kernel/io_apic.c
+++ b/arch/x86/kernel/io_apic.c
@@ -1618,10 +1618,15 @@
 			}
 
 			irq = pin_2_irq(idx, apic_id, pin);
-#ifdef CONFIG_X86_32
-			if (multi_timer_check(apic_id, irq))
+
+			/*
+			 * Skip the timer IRQ if there's a quirk handler
+			 * installed and if it returns 1:
+			 */
+			if (apic->multi_timer_check &&
+					apic->multi_timer_check(apic_id, irq))
 				continue;
-#endif
+
 			desc = irq_to_desc_alloc_cpu(irq, cpu);
 			if (!desc) {
 				printk(KERN_INFO "can not get irq_desc for %d\n", irq);
diff --git a/arch/x86/mach-generic/bigsmp.c b/arch/x86/mach-generic/bigsmp.c
index ad3837a..d074956 100644
--- a/arch/x86/mach-generic/bigsmp.c
+++ b/arch/x86/mach-generic/bigsmp.c
@@ -79,7 +79,7 @@
 
 	.ioapic_phys_id_map		= bigsmp_ioapic_phys_id_map,
 	.setup_apic_routing		= bigsmp_setup_apic_routing,
-	.multi_timer_check		= multi_timer_check,
+	.multi_timer_check		= NULL,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
diff --git a/arch/x86/mach-generic/default.c b/arch/x86/mach-generic/default.c
index 67f287f..6a21aa7 100644
--- a/arch/x86/mach-generic/default.c
+++ b/arch/x86/mach-generic/default.c
@@ -60,7 +60,7 @@
 
 	.ioapic_phys_id_map		= default_ioapic_phys_id_map,
 	.setup_apic_routing		= default_setup_apic_routing,
-	.multi_timer_check		= multi_timer_check,
+	.multi_timer_check		= NULL,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
diff --git a/arch/x86/mach-generic/es7000.c b/arch/x86/mach-generic/es7000.c
index f611729..0be59a5 100644
--- a/arch/x86/mach-generic/es7000.c
+++ b/arch/x86/mach-generic/es7000.c
@@ -121,7 +121,7 @@
 
 	.ioapic_phys_id_map		= es7000_ioapic_phys_id_map,
 	.setup_apic_routing		= es7000_setup_apic_routing,
-	.multi_timer_check		= multi_timer_check,
+	.multi_timer_check		= NULL,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
diff --git a/arch/x86/mach-generic/numaq.c b/arch/x86/mach-generic/numaq.c
index 8c137f4..da4ed65 100644
--- a/arch/x86/mach-generic/numaq.c
+++ b/arch/x86/mach-generic/numaq.c
@@ -66,7 +66,7 @@
 
 	.ioapic_phys_id_map		= numaq_ioapic_phys_id_map,
 	.setup_apic_routing		= numaq_setup_apic_routing,
-	.multi_timer_check		= multi_timer_check,
+	.multi_timer_check		= numaq_multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
diff --git a/arch/x86/mach-generic/summit.c b/arch/x86/mach-generic/summit.c
index 0698566..b618a186 100644
--- a/arch/x86/mach-generic/summit.c
+++ b/arch/x86/mach-generic/summit.c
@@ -59,7 +59,7 @@
 
 	.ioapic_phys_id_map		= summit_ioapic_phys_id_map,
 	.setup_apic_routing		= summit_setup_apic_routing,
-	.multi_timer_check		= multi_timer_check,
+	.multi_timer_check		= NULL,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,