Skip to contentSkip to conversation

x86: fix compile waring building without CONFIG_SYSCTL

PATCH In review Li Zefan 3 participants 6 messages Feb 3, 2008 – Feb 17, 2008 x86

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 x86: fix compile waring building without CONFIG_SYSCTL

building without CONFIG_SYSCTL:

arch/x86/kernel/nmi_64.c:50: warning: 'unknown_nmi_panic_callback' declared 'static' but never defined

This patch also fixes nmi_32.c

---
 arch/x86/kernel/nmi_32.c |    3 ++-
 arch/x86/kernel/nmi_64.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/kernel/nmi_32.c +2 -1
index edd4136..7e5ee4f 100644
@@ -46,8 +46,9 @@ static unsigned int nmi_hz = HZ;
 
 static DEFINE_PER_CPU(short, wd_enabled);
 
-/* local prototypes */
+#ifdef CONFIG_SYSCTL
 static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
+#endif
 
 static int endflag __initdata = 0;
 
arch/x86/kernel/nmi_64.c +2 -1
index fb99484..8fff383 100644
@@ -46,8 +46,9 @@ static unsigned int nmi_hz = HZ;
 
 static DEFINE_PER_CPU(short, wd_enabled);
 
-/* local prototypes */
+#ifdef CONFIG_SYSCTL
 static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
+#endif
 
 /* Run after command line and cpu_init init, but before all other checks */
 void nmi_watchdog_default(void)
Signature · 1 line
1.5.4.rc3
#1 lore raw

arch/x86/kernel/nmi_32.c static unsigned int nmi_hz = HZ; · line 51

Quoted 3 lines · Li Zefan
arch/x86/kernel/nmi_32.c +2 -0
+#ifdef CONFIG_SYSCTL
 static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
+#endif

instead of adding another #ifdef, a much cleaner solution would be to just reorder do_nmi_callback() with unknown_nmi_panic_callback(), and eliminate the prototype altogether.

Ingo

author
#2 lore raw
Quoted 10 lines · Ingo Molnar

arch/x86/kernel/nmi_32.c static unsigned int nmi_hz = HZ; · line 51

Quoted 3 lines · Li Zefan
arch/x86/kernel/nmi_32.c +2 -0
+#ifdef CONFIG_SYSCTL
 static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
+#endif

instead of adding another #ifdef, a much cleaner solution would be to just reorder do_nmi_callback() with unknown_nmi_panic_callback(), and eliminate the prototype altogether.

Quoted 2 lines

Ingo

I was wondering if a smaller patch will be better. But no doult cleaner code is better. :)

author
#3 lore raw

PATCH 1/1 x86: fix compile warning building without CONFIG_SYSCTL

building without CONFIG_SYSCTL:

arch/x86/kernel/nmi_64.c:50: warning: 'unknown_nmi_panic_callback' declared 'static' but never defined

This patch also fixes nmi_32.c

---
 arch/x86/kernel/nmi_32.c |   21 +++++++++------------
 arch/x86/kernel/nmi_64.c |   21 +++++++++------------
 2 files changed, 18 insertions(+), 24 deletions(-)
arch/x86/kernel/nmi_32.c +9 -12
index edd4136..6a0aa70 100644
@@ -46,9 +46,6 @@ static unsigned int nmi_hz = HZ;
 
 static DEFINE_PER_CPU(short, wd_enabled);
 
-/* local prototypes */
-static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
-
 static int endflag __initdata = 0;
 
 #ifdef CONFIG_SMP
@@ -391,15 +388,6 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
 	return rc;
 }
 
-int do_nmi_callback(struct pt_regs * regs, int cpu)
-{
-#ifdef CONFIG_SYSCTL
-	if (unknown_nmi_panic)
-		return unknown_nmi_panic_callback(regs, cpu);
-#endif
-	return 0;
-}
-
 #ifdef CONFIG_SYSCTL
 
 static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
@@ -453,6 +441,15 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
 
 #endif
 
+int do_nmi_callback(struct pt_regs *regs, int cpu)
+{
+#ifdef CONFIG_SYSCTL
+	if (unknown_nmi_panic)
+		return unknown_nmi_panic_callback(regs, cpu);
+#endif
+	return 0;
+}
+
 void __trigger_all_cpu_backtrace(void)
 {
 	int i;
arch/x86/kernel/nmi_64.c +9 -12
index fb99484..9a4fde7 100644
@@ -46,9 +46,6 @@ static unsigned int nmi_hz = HZ;
 
 static DEFINE_PER_CPU(short, wd_enabled);
 
-/* local prototypes */
-static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
-
 /* Run after command line and cpu_init init, but before all other checks */
 void nmi_watchdog_default(void)
 {
@@ -394,15 +391,6 @@ asmlinkage __kprobes void do_nmi(struct pt_regs * regs, long error_code)
 	nmi_exit();
 }
 
-int do_nmi_callback(struct pt_regs * regs, int cpu)
-{
-#ifdef CONFIG_SYSCTL
-	if (unknown_nmi_panic)
-		return unknown_nmi_panic_callback(regs, cpu);
-#endif
-	return 0;
-}
-
 void stop_nmi(void)
 {
 	acpi_nmi_disable();
@@ -464,6 +452,15 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
 
 #endif
 
+int do_nmi_callback(struct pt_regs *regs, int cpu)
+{
+#ifdef CONFIG_SYSCTL
+	if (unknown_nmi_panic)
+		return unknown_nmi_panic_callback(regs, cpu);
+#endif
+	return 0;
+}
+
 void __trigger_all_cpu_backtrace(void)
 {
 	int i;
Signature · 1 line
1.5.4.rc3
Applied
#4 lore raw

Re: [PATCH] x86: fix compile warning building without CONFIG_SYSCTL

Quoted 6 lines · Li Zefan

building without CONFIG_SYSCTL:

arch/x86/kernel/nmi_64.c:50: warning: 'unknown_nmi_panic_callback' declared 'static' but never defined

This patch also fixes nmi_32.c

thanks, applied.

Ingo

#5 lore raw

Re: [PATCH] x86: fix compile warning building without CONFIG_SYSCTL

In reply to Li Zefan
Quoted 7 lines · Li Zefan

building without CONFIG_SYSCTL:

arch/x86/kernel/nmi_64.c:50: warning: 'unknown_nmi_panic_callback' declared 'static' but never defined

This patch also fixes nmi_32.c

Applied. Thanks,

tglx

Quoted 105 lines
---
 arch/x86/kernel/nmi_32.c |   21 +++++++++------------
 arch/x86/kernel/nmi_64.c |   21 +++++++++------------
 2 files changed, 18 insertions(+), 24 deletions(-)
arch/x86/kernel/nmi_32.c +9 -12
index edd4136..6a0aa70 100644
@@ -46,9 +46,6 @@ static unsigned int nmi_hz = HZ;
 
 static DEFINE_PER_CPU(short, wd_enabled);
 
-/* local prototypes */
-static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
-
 static int endflag __initdata = 0;
 
 #ifdef CONFIG_SMP
@@ -391,15 +388,6 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
 	return rc;
 }
 
-int do_nmi_callback(struct pt_regs * regs, int cpu)
-{
-#ifdef CONFIG_SYSCTL
-	if (unknown_nmi_panic)
-		return unknown_nmi_panic_callback(regs, cpu);
-#endif
-	return 0;
-}
-
 #ifdef CONFIG_SYSCTL
 
 static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
@@ -453,6 +441,15 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
 
 #endif
 
+int do_nmi_callback(struct pt_regs *regs, int cpu)
+{
+#ifdef CONFIG_SYSCTL
+	if (unknown_nmi_panic)
+		return unknown_nmi_panic_callback(regs, cpu);
+#endif
+	return 0;
+}
+
 void __trigger_all_cpu_backtrace(void)
 {
 	int i;
arch/x86/kernel/nmi_64.c +9 -12
index fb99484..9a4fde7 100644
@@ -46,9 +46,6 @@ static unsigned int nmi_hz = HZ;
 
 static DEFINE_PER_CPU(short, wd_enabled);
 
-/* local prototypes */
-static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
-
 /* Run after command line and cpu_init init, but before all other checks */
 void nmi_watchdog_default(void)
 {
@@ -394,15 +391,6 @@ asmlinkage __kprobes void do_nmi(struct pt_regs * regs, long error_code)
 	nmi_exit();
 }
 
-int do_nmi_callback(struct pt_regs * regs, int cpu)
-{
-#ifdef CONFIG_SYSCTL
-	if (unknown_nmi_panic)
-		return unknown_nmi_panic_callback(regs, cpu);
-#endif
-	return 0;
-}
-
 void stop_nmi(void)
 {
 	acpi_nmi_disable();
@@ -464,6 +452,15 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
 
 #endif
 
+int do_nmi_callback(struct pt_regs *regs, int cpu)
+{
+#ifdef CONFIG_SYSCTL
+	if (unknown_nmi_panic)
+		return unknown_nmi_panic_callback(regs, cpu);
+#endif
+	return 0;
+}
+
 void __trigger_all_cpu_backtrace(void)
 {
 	int i;
Signature · 6 lines
1.5.4.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/