Skip to contentSkip to conversation

arch/i386/kernel/nmi.c: fix compiler warning

PATCH Lee Revell 3 participants 3 messages Jan 26, 2006 – Jan 27, 2006

lore
Share & tools
lore

Lee Revell

author
#0 lore raw

arch/i386/kernel/nmi.c: In function 'check_nmi_watchdog':
arch/i386/kernel/nmi.c:139: warning: statement with no effect

arch/i386/kernel/nmi.c renamed from arch/i386/kernel/nmi.c~ +2 -0
@@ -135,8 +135,10 @@
 
 	printk(KERN_INFO "Testing NMI watchdog ... ");
 
+#ifdef CONFIG_SMP
 	if (nmi_watchdog == NMI_LOCAL_APIC)
 		smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
+#endif
 
 	for (cpu = 0; cpu < NR_CPUS; cpu++)
 		prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count;
#1 lore raw
Quoted 2 lines · Lee Revell

arch/i386/kernel/nmi.c: In function 'check_nmi_watchdog':
arch/i386/kernel/nmi.c:139: warning: statement with no effect

A more generic solution:

include/linux/smp.h +16 -3
index 9dfa3ee..be4e598 100644
@@ -90,12 +90,25 @@ void smp_prepare_boot_cpu(void);
 #else /* !SMP */
 
 /*
- *	These macros fold the SMP functionality into a single CPU system
+ *	These macros and inlines fold the SMP functionality
+ *	for single CPU systems
  */
 #define raw_smp_processor_id()			0
 #define hard_smp_processor_id()			0
-#define smp_call_function(func,info,retry,wait)	({ 0; })
-#define on_each_cpu(func,info,retry,wait)	({ func(info); 0; })
+
+static inline int smp_call_function(void (*func) (void *info), void *info,
+			      int retry, int wait)
+{
+	return 0;
+}
+
+static inline int on_each_cpu(void (*func) (void *info), void *info,
+			      int retry, int wait)
+{
+	func(info);
+	return 0;
+}
+
 static inline void smp_send_reschedule(int cpu) { }
 #define num_booting_cpus()			1
 #define smp_prepare_boot_cpu()			do {} while (0)
#2 lore raw
Quoted 11 lines · Joe Perches
include/linux/smp.h +2 -1
@@ -90,12 +90,25 @@ void smp_prepare_boot_cpu(void);
 #else /* !SMP */
 
 /*
- *	These macros fold the SMP functionality into a single CPU system
+ *	These macros and inlines fold the SMP functionality
+ *	for single CPU systems
  */

include/linux/smp.h void smp_prepare_boot_cpu(void); · line 103

Quoted 10 lines
include/linux/smp.h +6 -2
 #define raw_smp_processor_id()			0
 #define hard_smp_processor_id()			0
-#define smp_call_function(func,info,retry,wait)	({ 0; })
-#define on_each_cpu(func,info,retry,wait)	({ func(info); 0; })
+
+static inline int smp_call_function(void (*func) (void *info), void *info,
+			      int retry, int wait)
+{
+	return 0;
+}

I think we tried this before and it broke things. Because there are callback functions which are inside CONFIG_SMP. With the macro, they don't get referred to at all. Wth the inline, the compiler needs to see their definition and errors out.