Skip to contentSkip to conversation

powerpc: Sparse fixes for numa.c

PATCH New Robert C Jennings 1 participant 3 messages Oct 28, 2013 PowerPC

lore
Share & tools
lore
#0 lore raw

v2 cover powerpc: Sparse fixes for numa.c

Cleaning out some stashed fixes for sparse warnings found while working on 3be7db6: (powerpc: VPHN topology change updates all siblings)

I don't see a reason why the declarations in arch/powerpc/kernel/setup.h can't live in arch/powerpc/include/asm/setup.h and .../mm/numa.c should include these definitions.

Robert C Jennings (2):
powerpc: Fix warnings for arch/powerpc/mm/numa.c
powerpc: Move local setup.h declarations to arch includes

 arch/powerpc/include/asm/setup.h   | 4 ++++
 arch/powerpc/kernel/module.c       | 3 +--
 arch/powerpc/kernel/module_32.c    | 3 +--
 arch/powerpc/kernel/module_64.c    | 3 +--
 arch/powerpc/kernel/setup-common.c | 2 --
 arch/powerpc/kernel/setup.h        | 9 ---------
 arch/powerpc/kernel/setup_32.c     | 2 --
 arch/powerpc/kernel/setup_64.c     | 2 --
 arch/powerpc/kernel/vdso.c         | 3 +--
 arch/powerpc/mm/numa.c             | 8 ++++----
 10 files changed, 12 insertions(+), 27 deletions(-)
 delete mode 100644 arch/powerpc/kernel/setup.h
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH v2 1/2 powerpc: Fix warnings for arch/powerpc/mm/numa.c

Simple fixes for sparse warnings in this file.

Resolves:
arch/powerpc/mm/numa.c:198:24:
warning: Using plain integer as NULL pointer

arch/powerpc/mm/numa.c:1157:5:
warning: symbol 'hot_add_node_scn_to_nid' was not declared.
Should it be static?

arch/powerpc/mm/numa.c:1238:28:
warning: Using plain integer as NULL pointer

arch/powerpc/mm/numa.c:1538:6:
warning: symbol 'topology_schedule_update' was not declared.
Should it be static?

---
v1 -> v2: No changes in this patch

---
 arch/powerpc/mm/numa.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/mm/numa.c +4 -4
index c916127..33d6784 100644
@@ -195,7 +195,7 @@ static const __be32 *of_get_usable_memory(struct device_node *memory)
 	u32 len;
 	prop = of_get_property(memory, "linux,drconf-usable-memory", &len);
 	if (!prop || len < sizeof(unsigned int))
-		return 0;
+		return NULL;
 	return prop;
 }
 
@@ -1154,7 +1154,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
  * represented in the device tree as a node (i.e. memory@XXXX) for
  * each memblock.
  */
-int hot_add_node_scn_to_nid(unsigned long scn_addr)
+static int hot_add_node_scn_to_nid(unsigned long scn_addr)
 {
 	struct device_node *memory;
 	int nid = -1;
@@ -1235,7 +1235,7 @@ static u64 hot_add_drconf_memory_max(void)
         struct device_node *memory = NULL;
         unsigned int drconf_cell_cnt = 0;
         u64 lmb_size = 0;
-	const __be32 *dm = 0;
+	const __be32 *dm = NULL;
 
         memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
         if (memory) {
@@ -1535,7 +1535,7 @@ static void topology_work_fn(struct work_struct *work)
 }
 static DECLARE_WORK(topology_work, topology_work_fn);
 
-void topology_schedule_update(void)
+static void topology_schedule_update(void)
 {
 	schedule_work(&topology_work);
 }
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH v2 2/2 powerpc: Move local setup.h declarations to arch includes

In reply to Robert C Jennings

Move the few declarations from arch/powerpc/kernel/setup.h into arch/powerpc/include/asm/setup.h. This resolves a sparse warning for arch/powerpc/mm/numa.c which defines do_init_bootmem() but can't include the setup.h header in the prior path.

Resolves:
arch/powerpc/mm/numa.c:998:13:
warning: symbol 'do_init_bootmem' was not declared.
Should it be static?

---
v1 -> v2:
Removed do_early_xmon (unused since 47679283)
Removed 'extern' keyword

---
 arch/powerpc/include/asm/setup.h   | 4 ++++
 arch/powerpc/kernel/module.c       | 3 +--
 arch/powerpc/kernel/module_32.c    | 3 +--
 arch/powerpc/kernel/module_64.c    | 3 +--
 arch/powerpc/kernel/setup-common.c | 2 --
 arch/powerpc/kernel/setup.h        | 9 ---------
 arch/powerpc/kernel/setup_32.c     | 2 --
 arch/powerpc/kernel/setup_64.c     | 2 --
 arch/powerpc/kernel/vdso.c         | 3 +--
 9 files changed, 8 insertions(+), 23 deletions(-)
 delete mode 100644 arch/powerpc/kernel/setup.h
arch/powerpc/include/asm/setup.h +4 -0
index d3ca855..703a841 100644
@@ -23,6 +23,10 @@ extern void reloc_got2(unsigned long);
 
 #define PTRRELOC(x)	((typeof(x)) add_reloc_offset((unsigned long)(x)))
 
+void check_for_initrd(void);
+void do_init_bootmem(void);
+void setup_panic(void);
+
 #endif /* !__ASSEMBLY__ */
 
 #endif	/* _ASM_POWERPC_SETUP_H */
arch/powerpc/kernel/module.c +1 -2
index 2d27570..9547381 100644
@@ -25,8 +25,7 @@
 #include <asm/uaccess.h>
 #include <asm/firmware.h>
 #include <linux/sort.h>
-
-#include "setup.h"
+#include <asm/setup.h>
 
 LIST_HEAD(module_bug_list);
 
arch/powerpc/kernel/module_32.c +1 -2
index 2e3200c..6cff040 100644
@@ -26,8 +26,7 @@
 #include <linux/cache.h>
 #include <linux/bug.h>
 #include <linux/sort.h>
-
-#include "setup.h"
+#include <asm/setup.h>
 
 #if 0
 #define DEBUGP printk
arch/powerpc/kernel/module_64.c +1 -2
index a102f44..12664c1 100644
@@ -26,8 +26,7 @@
 #include <asm/firmware.h>
 #include <asm/code-patching.h>
 #include <linux/sort.h>
-
-#include "setup.h"
+#include <asm/setup.h>
 
 /* FIXME: We don't do .init separately.  To do this, we'd need to have
    a separate r2 value in the init and core section, and stub between
arch/powerpc/kernel/setup-common.c +0 -2
index 3d261c0..febc804 100644
@@ -62,8 +62,6 @@
 #include <mm/mmu_decl.h>
 #include <asm/fadump.h>
 
-#include "setup.h"
-
 #ifdef DEBUG
 #include <asm/udbg.h>
 #define DBG(fmt...) udbg_printf(fmt)
arch/powerpc/kernel/setup.h deleted +0 -9
deleted file mode 100644
index 4c67ad7..0000000
@@ -1,9 +0,0 @@
-#ifndef _POWERPC_KERNEL_SETUP_H
-#define _POWERPC_KERNEL_SETUP_H
-
-void check_for_initrd(void);
-void do_init_bootmem(void);
-void setup_panic(void);
-extern int do_early_xmon;
-
-#endif /* _POWERPC_KERNEL_SETUP_H */
arch/powerpc/kernel/setup_32.c +0 -2
index a4bbcae..b903dc5 100644
@@ -40,8 +40,6 @@
 #include <asm/mmu_context.h>
 #include <asm/epapr_hcalls.h>
 
-#include "setup.h"
-
 #define DBG(fmt...)
 
 extern void bootx_init(unsigned long r4, unsigned long phys);
arch/powerpc/kernel/setup_64.c +0 -2
index 278ca93..4085aaa 100644
@@ -68,8 +68,6 @@
 #include <asm/hugetlb.h>
 #include <asm/epapr_hcalls.h>
 
-#include "setup.h"
-
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
 #else
arch/powerpc/kernel/vdso.c +1 -2
index 1d9c926..094e45c 100644
@@ -34,8 +34,7 @@
 #include <asm/firmware.h>
 #include <asm/vdso.h>
 #include <asm/vdso_datapage.h>
-
-#include "setup.h"
+#include <asm/setup.h>
 
 #undef DEBUG
 
Signature · 1 line
1.8.1.2