All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] MIPS: Fix various sparse warnings
@ 2017-08-23 18:17 ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

This series fixes various sparse warnings, mostly low hanging fruit.

Patches 1-7 include headers providing declarations of functions or
variables in files which provide their definitions. This clears up
sparse warnings & ensures that the prototypes of declarations &
definitions match.

Patch 8 fixes the type of a fault_addr argument used in the FPU
emulation code to be correct & avoid a lot of sparse warnings.

Patches 9 & 10 remove some dead code.

Patch 11 declares a bunch of things which we don't use outside of the
translation unit that defines them static.

Applies atop v4.13-rc6.

Paul Burton (11):
  MIPS: generic: Include asm/bootinfo.h for plat_fdt_relocated()
  MIPS: generic: Include asm/time.h for get_c0_*_int()
  MIPS: Include asm/setup.h for cpu_cache_init()
  MIPS: Include linux/cpu.h for arch_cpu_idle()
  MIPS: Include asm/delay.h for __{,n,u}delay()
  MIPS: Include elf-randomize.h for arch_mmap_rnd() &
    arch_randomize_brk()
  MIPS: Include linux/initrd.h for free_initrd_mem()
  MIPS: math-emu: Correct user fault_addr type
  MIPS: Remove __invalidate_kernel_vmap_range
  MIPS: Remove plat_timer_setup()
  MIPS: Declare various variables & functions static

 arch/mips/generic/init.c              |  5 +++++
 arch/mips/generic/irq.c               |  1 +
 arch/mips/include/asm/fpu_emulator.h  |  2 +-
 arch/mips/kernel/cpu-probe.c          |  2 +-
 arch/mips/kernel/idle.c               |  1 +
 arch/mips/kernel/mips-r2-to-r6-emul.c |  6 +++---
 arch/mips/kernel/pm-cps.c             |  2 +-
 arch/mips/kernel/time.c               | 14 --------------
 arch/mips/kernel/unaligned.c          |  2 +-
 arch/mips/lib/delay.c                 |  1 +
 arch/mips/math-emu/cp1emu.c           |  8 ++++----
 arch/mips/mm/cache.c                  |  2 +-
 arch/mips/mm/dma-default.c            |  4 ++--
 arch/mips/mm/init.c                   |  1 +
 arch/mips/mm/mmap.c                   |  1 +
 15 files changed, 24 insertions(+), 28 deletions(-)

-- 
2.14.1

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 00/11] MIPS: Fix various sparse warnings
@ 2017-08-23 18:17 ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

This series fixes various sparse warnings, mostly low hanging fruit.

Patches 1-7 include headers providing declarations of functions or
variables in files which provide their definitions. This clears up
sparse warnings & ensures that the prototypes of declarations &
definitions match.

Patch 8 fixes the type of a fault_addr argument used in the FPU
emulation code to be correct & avoid a lot of sparse warnings.

Patches 9 & 10 remove some dead code.

Patch 11 declares a bunch of things which we don't use outside of the
translation unit that defines them static.

Applies atop v4.13-rc6.

Paul Burton (11):
  MIPS: generic: Include asm/bootinfo.h for plat_fdt_relocated()
  MIPS: generic: Include asm/time.h for get_c0_*_int()
  MIPS: Include asm/setup.h for cpu_cache_init()
  MIPS: Include linux/cpu.h for arch_cpu_idle()
  MIPS: Include asm/delay.h for __{,n,u}delay()
  MIPS: Include elf-randomize.h for arch_mmap_rnd() &
    arch_randomize_brk()
  MIPS: Include linux/initrd.h for free_initrd_mem()
  MIPS: math-emu: Correct user fault_addr type
  MIPS: Remove __invalidate_kernel_vmap_range
  MIPS: Remove plat_timer_setup()
  MIPS: Declare various variables & functions static

 arch/mips/generic/init.c              |  5 +++++
 arch/mips/generic/irq.c               |  1 +
 arch/mips/include/asm/fpu_emulator.h  |  2 +-
 arch/mips/kernel/cpu-probe.c          |  2 +-
 arch/mips/kernel/idle.c               |  1 +
 arch/mips/kernel/mips-r2-to-r6-emul.c |  6 +++---
 arch/mips/kernel/pm-cps.c             |  2 +-
 arch/mips/kernel/time.c               | 14 --------------
 arch/mips/kernel/unaligned.c          |  2 +-
 arch/mips/lib/delay.c                 |  1 +
 arch/mips/math-emu/cp1emu.c           |  8 ++++----
 arch/mips/mm/cache.c                  |  2 +-
 arch/mips/mm/dma-default.c            |  4 ++--
 arch/mips/mm/init.c                   |  1 +
 arch/mips/mm/mmap.c                   |  1 +
 15 files changed, 24 insertions(+), 28 deletions(-)

-- 
2.14.1

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/11] MIPS: generic: Include asm/bootinfo.h for plat_fdt_relocated()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton, Matt Redfearn

arch/mips/generic/init.c provides an implementation of the
plat_fdt_relocated() function, but doesn't include the asm/bootinfo.h
header which declares it. This leads to a warning from sparse:

arch/mips/generic/init.c:94:13: warning: symbol 'plat_fdt_relocated' was
  not declared. Should it be static?

Fix this by including asm/bootinfo.h to get the declaration of
plat_fdt_relocated(). We also #ifdef our definition of
plat_fdt_relocated() such that it is only provided when
CONFIG_RELOCATABLE is set, matching the header & avoiding the redundant
function for non-relocatable kernels.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/generic/init.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
index 3f32b376d30e..15a7fb8e2a2e 100644
--- a/arch/mips/generic/init.c
+++ b/arch/mips/generic/init.c
@@ -16,6 +16,7 @@
 #include <linux/of_fdt.h>
 #include <linux/of_platform.h>
 
+#include <asm/bootinfo.h>
 #include <asm/fw/fw.h>
 #include <asm/irq_cpu.h>
 #include <asm/machine.h>
@@ -88,6 +89,8 @@ void __init *plat_get_fdt(void)
 	return (void *)fdt;
 }
 
+#ifdef CONFIG_RELOCATABLE
+
 void __init plat_fdt_relocated(void *new_location)
 {
 	/*
@@ -101,6 +104,8 @@ void __init plat_fdt_relocated(void *new_location)
 		fw_arg1 = (unsigned long)new_location;
 }
 
+#endif /* CONFIG_RELOCATABLE */
+
 void __init plat_mem_setup(void)
 {
 	if (mach && mach->fixup_fdt)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 01/11] MIPS: generic: Include asm/bootinfo.h for plat_fdt_relocated()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton, Matt Redfearn

arch/mips/generic/init.c provides an implementation of the
plat_fdt_relocated() function, but doesn't include the asm/bootinfo.h
header which declares it. This leads to a warning from sparse:

arch/mips/generic/init.c:94:13: warning: symbol 'plat_fdt_relocated' was
  not declared. Should it be static?

Fix this by including asm/bootinfo.h to get the declaration of
plat_fdt_relocated(). We also #ifdef our definition of
plat_fdt_relocated() such that it is only provided when
CONFIG_RELOCATABLE is set, matching the header & avoiding the redundant
function for non-relocatable kernels.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/generic/init.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
index 3f32b376d30e..15a7fb8e2a2e 100644
--- a/arch/mips/generic/init.c
+++ b/arch/mips/generic/init.c
@@ -16,6 +16,7 @@
 #include <linux/of_fdt.h>
 #include <linux/of_platform.h>
 
+#include <asm/bootinfo.h>
 #include <asm/fw/fw.h>
 #include <asm/irq_cpu.h>
 #include <asm/machine.h>
@@ -88,6 +89,8 @@ void __init *plat_get_fdt(void)
 	return (void *)fdt;
 }
 
+#ifdef CONFIG_RELOCATABLE
+
 void __init plat_fdt_relocated(void *new_location)
 {
 	/*
@@ -101,6 +104,8 @@ void __init plat_fdt_relocated(void *new_location)
 		fw_arg1 = (unsigned long)new_location;
 }
 
+#endif /* CONFIG_RELOCATABLE */
+
 void __init plat_mem_setup(void)
 {
 	if (mach && mach->fixup_fdt)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 02/11] MIPS: generic: Include asm/time.h for get_c0_*_int()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/generic/irq.c provides implementations of the
get_c0_compare_int() & get_c0_perfcount_int() functions, but doesn't
include the asm/time.h header which declares them. This leads to
warnings from sparse:

  arch/mips/generic/irq.c:36:5: warning: symbol 'get_c0_perfcount_int'
    was not declared. Should it be static?
  arch/mips/generic/irq.c:52:14: warning: symbol 'get_c0_compare_int'
    was not declared. Should it be static?

Fix this by including asm/time.h to get the declarations of
get_c0_compare_int() & get_c0_perfcount_int().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/generic/irq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/generic/irq.c b/arch/mips/generic/irq.c
index 14064bdd91dd..efe359ce2576 100644
--- a/arch/mips/generic/irq.c
+++ b/arch/mips/generic/irq.c
@@ -16,6 +16,7 @@
 #include <linux/types.h>
 
 #include <asm/irq.h>
+#include <asm/time.h>
 
 int get_c0_fdc_int(void)
 {
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 02/11] MIPS: generic: Include asm/time.h for get_c0_*_int()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/generic/irq.c provides implementations of the
get_c0_compare_int() & get_c0_perfcount_int() functions, but doesn't
include the asm/time.h header which declares them. This leads to
warnings from sparse:

  arch/mips/generic/irq.c:36:5: warning: symbol 'get_c0_perfcount_int'
    was not declared. Should it be static?
  arch/mips/generic/irq.c:52:14: warning: symbol 'get_c0_compare_int'
    was not declared. Should it be static?

Fix this by including asm/time.h to get the declarations of
get_c0_compare_int() & get_c0_perfcount_int().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/generic/irq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/generic/irq.c b/arch/mips/generic/irq.c
index 14064bdd91dd..efe359ce2576 100644
--- a/arch/mips/generic/irq.c
+++ b/arch/mips/generic/irq.c
@@ -16,6 +16,7 @@
 #include <linux/types.h>
 
 #include <asm/irq.h>
+#include <asm/time.h>
 
 int get_c0_fdc_int(void)
 {
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 03/11] MIPS: Include asm/setup.h for cpu_cache_init()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/mm/cache.c provides our implementation of the cpu_cache_init()
function, but doesn't include the asm/setup.h header which declares it.
This leads to a warning from sparse:

  arch/mips/mm/cache.c:274:6: warning: symbol 'cpu_cache_init' was not
    declared. Should it be static?

Fix this by including asm/setup.h to get the declaration of
cpu_cache_init().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/mm/cache.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 899e46279902..0324e1085b16 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -20,6 +20,7 @@
 #include <asm/processor.h>
 #include <asm/cpu.h>
 #include <asm/cpu-features.h>
+#include <asm/setup.h>
 
 /* Cache operations. */
 void (*flush_cache_all)(void);
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 03/11] MIPS: Include asm/setup.h for cpu_cache_init()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/mm/cache.c provides our implementation of the cpu_cache_init()
function, but doesn't include the asm/setup.h header which declares it.
This leads to a warning from sparse:

  arch/mips/mm/cache.c:274:6: warning: symbol 'cpu_cache_init' was not
    declared. Should it be static?

Fix this by including asm/setup.h to get the declaration of
cpu_cache_init().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/mm/cache.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 899e46279902..0324e1085b16 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -20,6 +20,7 @@
 #include <asm/processor.h>
 #include <asm/cpu.h>
 #include <asm/cpu-features.h>
+#include <asm/setup.h>
 
 /* Cache operations. */
 void (*flush_cache_all)(void);
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 04/11] MIPS: Include linux/cpu.h for arch_cpu_idle()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/kernel/idle.c provides our implementation of the
arch_cpu_idle() function, but doesn't include the linux/cpu.h header
which declares it. This leads to a warning from sparse:

  arch/mips/kernel/idle.c:256:6: warning: symbol 'arch_cpu_idle' was not
    declared. Should it be static?

Fix this by including linux/cpu.h to get the declaration of
arch_cpu_idle().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/kernel/idle.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/kernel/idle.c b/arch/mips/kernel/idle.c
index 60ab4c44d305..7c246b69c545 100644
--- a/arch/mips/kernel/idle.c
+++ b/arch/mips/kernel/idle.c
@@ -11,6 +11,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <linux/cpu.h>
 #include <linux/export.h>
 #include <linux/init.h>
 #include <linux/irqflags.h>
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 04/11] MIPS: Include linux/cpu.h for arch_cpu_idle()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/kernel/idle.c provides our implementation of the
arch_cpu_idle() function, but doesn't include the linux/cpu.h header
which declares it. This leads to a warning from sparse:

  arch/mips/kernel/idle.c:256:6: warning: symbol 'arch_cpu_idle' was not
    declared. Should it be static?

Fix this by including linux/cpu.h to get the declaration of
arch_cpu_idle().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/kernel/idle.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/kernel/idle.c b/arch/mips/kernel/idle.c
index 60ab4c44d305..7c246b69c545 100644
--- a/arch/mips/kernel/idle.c
+++ b/arch/mips/kernel/idle.c
@@ -11,6 +11,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <linux/cpu.h>
 #include <linux/export.h>
 #include <linux/init.h>
 #include <linux/irqflags.h>
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 05/11] MIPS: Include asm/delay.h for __{,n,u}delay()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/lib/delay.c provides our implementations of the __delay(),
__ndelay() & __udelay() functions, but doesn't include the asm/delay.h
header which declares them. This leads to warnings from sparse:

  arch/mips/lib/delay.c:26:6: warning: symbol '__delay' was not
    declared. Should it be static?
  arch/mips/lib/delay.c:50:6: warning: symbol '__udelay' was not
    declared. Should it be static?
  arch/mips/lib/delay.c:58:6: warning: symbol '__ndelay' was not
    declared. Should it be static?

Fix this by including asm/delay.h to get the declarations of __delay(),
__ndelay() & __udelay().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/lib/delay.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/lib/delay.c b/arch/mips/lib/delay.c
index 2307a3cb2714..0025438957be 100644
--- a/arch/mips/lib/delay.c
+++ b/arch/mips/lib/delay.c
@@ -15,6 +15,7 @@
 
 #include <asm/asm.h>
 #include <asm/compiler.h>
+#include <asm/delay.h>
 #include <asm/war.h>
 
 #ifndef CONFIG_CPU_DADDI_WORKAROUNDS
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 05/11] MIPS: Include asm/delay.h for __{,n,u}delay()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/lib/delay.c provides our implementations of the __delay(),
__ndelay() & __udelay() functions, but doesn't include the asm/delay.h
header which declares them. This leads to warnings from sparse:

  arch/mips/lib/delay.c:26:6: warning: symbol '__delay' was not
    declared. Should it be static?
  arch/mips/lib/delay.c:50:6: warning: symbol '__udelay' was not
    declared. Should it be static?
  arch/mips/lib/delay.c:58:6: warning: symbol '__ndelay' was not
    declared. Should it be static?

Fix this by including asm/delay.h to get the declarations of __delay(),
__ndelay() & __udelay().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/lib/delay.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/lib/delay.c b/arch/mips/lib/delay.c
index 2307a3cb2714..0025438957be 100644
--- a/arch/mips/lib/delay.c
+++ b/arch/mips/lib/delay.c
@@ -15,6 +15,7 @@
 
 #include <asm/asm.h>
 #include <asm/compiler.h>
+#include <asm/delay.h>
 #include <asm/war.h>
 
 #ifndef CONFIG_CPU_DADDI_WORKAROUNDS
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/11] MIPS: Include elf-randomize.h for arch_mmap_rnd() & arch_randomize_brk()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/mm/mmap.c provides our implementations of the arch_mmap_rnd()
& arch_randomize_brk() functions, but doesn't include the
linux/elf-randomize.h header which declares them. This leads to warnings
from sparse:

  arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
    declared. Should it be static?
  arch/mips/mm/mmap.c:190:15: warning: symbol 'arch_randomize_brk' was
    not declared. Should it be static?

Fix this by including linux/elf-randomize.h to get the declarations of
arch_mmap_rnd() & arch_randomize_brk().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/mm/mmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 28adeabe851f..33d3251ecd37 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -7,6 +7,7 @@
  *   written by Ralf Baechle <ralf@linux-mips.org>
  */
 #include <linux/compiler.h>
+#include <linux/elf-randomize.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/11] MIPS: Include elf-randomize.h for arch_mmap_rnd() & arch_randomize_brk()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/mm/mmap.c provides our implementations of the arch_mmap_rnd()
& arch_randomize_brk() functions, but doesn't include the
linux/elf-randomize.h header which declares them. This leads to warnings
from sparse:

  arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
    declared. Should it be static?
  arch/mips/mm/mmap.c:190:15: warning: symbol 'arch_randomize_brk' was
    not declared. Should it be static?

Fix this by including linux/elf-randomize.h to get the declarations of
arch_mmap_rnd() & arch_randomize_brk().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/mm/mmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 28adeabe851f..33d3251ecd37 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -7,6 +7,7 @@
  *   written by Ralf Baechle <ralf@linux-mips.org>
  */
 #include <linux/compiler.h>
+#include <linux/elf-randomize.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 07/11] MIPS: Include linux/initrd.h for free_initrd_mem()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/mm/init.c provides our implementation of free_initrd_mem(),
but doesn't include the linux/initrd.h header which declares them. This
leads to a warning from sparse:

  arch/mips/mm/init.c:501:6: warning: symbol 'free_initrd_mem' was not
    declared. Should it be static?

Fix this by including linux/initrd.h to get the declaration of
free_initrd_mem().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/mm/init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 8ce2983a7015..5f6ea7d746de 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -31,6 +31,7 @@
 #include <linux/gfp.h>
 #include <linux/kcore.h>
 #include <linux/export.h>
+#include <linux/initrd.h>
 
 #include <asm/asm-offsets.h>
 #include <asm/bootinfo.h>
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 07/11] MIPS: Include linux/initrd.h for free_initrd_mem()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

arch/mips/mm/init.c provides our implementation of free_initrd_mem(),
but doesn't include the linux/initrd.h header which declares them. This
leads to a warning from sparse:

  arch/mips/mm/init.c:501:6: warning: symbol 'free_initrd_mem' was not
    declared. Should it be static?

Fix this by including linux/initrd.h to get the declaration of
free_initrd_mem().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/mm/init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 8ce2983a7015..5f6ea7d746de 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -31,6 +31,7 @@
 #include <linux/gfp.h>
 #include <linux/kcore.h>
 #include <linux/export.h>
+#include <linux/initrd.h>
 
 #include <asm/asm-offsets.h>
 #include <asm/bootinfo.h>
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 08/11] MIPS: math-emu: Correct user fault_addr type
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

The fault_addr argument to fpu_emulator_cop1Handler(), fpux_emu() and
cop1Emulate() has up until now been declared as:

  void *__user *fault_addr

This is essentially a pointer in user memory which points to a pointer
to void. This is not the intent for our code, which is actually
operating on a pointer to a pointer to void where the pointer to void is
pointing at user memory. ie. the pointer is in kernel memory & points to
user memory.

This mismatch produces a lot of sparse warnings that look like this:

arch/mips/math-emu/cp1emu.c:1485:45:
   warning: incorrect type in assignment (different address spaces)
      expected void *[noderef] <asn:1><noident>
      got unsigned int [noderef] [usertype] <asn:1>*[assigned] va

Fix these by modifying the declaration of the fault_addr argument to:

  void __user **fault_addr

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/include/asm/fpu_emulator.h | 2 +-
 arch/mips/math-emu/cp1emu.c          | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h
index c05369e0b8d6..8e50fa3623e3 100644
--- a/arch/mips/include/asm/fpu_emulator.h
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -62,7 +62,7 @@ do {									\
 
 extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
 				    struct mips_fpu_struct *ctx, int has_fpu,
-				    void *__user *fault_addr);
+				    void __user **fault_addr);
 void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
 		     struct task_struct *tsk);
 int process_fpemu_return(int sig, void __user *fault_addr,
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index f08a7b4facb9..24d873a03327 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -58,7 +58,7 @@ static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *,
 	mips_instruction);
 
 static int fpux_emu(struct pt_regs *,
-	struct mips_fpu_struct *, mips_instruction, void *__user *);
+	struct mips_fpu_struct *, mips_instruction, void __user **);
 
 /* Control registers */
 
@@ -973,7 +973,7 @@ static inline void cop1_ctc(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
  */
 
 static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
-		struct mm_decoded_insn dec_insn, void *__user *fault_addr)
+		struct mm_decoded_insn dec_insn, void __user **fault_addr)
 {
 	unsigned long contpc = xcp->cp0_epc + dec_insn.pc_inc;
 	unsigned int cond, cbit, bit0;
@@ -1460,7 +1460,7 @@ DEF3OP(nmadd, dp, ieee754dp_mul, ieee754dp_add, ieee754dp_neg);
 DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg);
 
 static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
-	mips_instruction ir, void *__user *fault_addr)
+	mips_instruction ir, void __user **fault_addr)
 {
 	unsigned rcsr = 0;	/* resulting csr */
 
@@ -2553,7 +2553,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
  * For simplicity we always terminate upon an ISA mode switch.
  */
 int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
-	int has_fpu, void *__user *fault_addr)
+	int has_fpu, void __user **fault_addr)
 {
 	unsigned long oldepc, prevepc;
 	struct mm_decoded_insn dec_insn;
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 08/11] MIPS: math-emu: Correct user fault_addr type
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

The fault_addr argument to fpu_emulator_cop1Handler(), fpux_emu() and
cop1Emulate() has up until now been declared as:

  void *__user *fault_addr

This is essentially a pointer in user memory which points to a pointer
to void. This is not the intent for our code, which is actually
operating on a pointer to a pointer to void where the pointer to void is
pointing at user memory. ie. the pointer is in kernel memory & points to
user memory.

This mismatch produces a lot of sparse warnings that look like this:

arch/mips/math-emu/cp1emu.c:1485:45:
   warning: incorrect type in assignment (different address spaces)
      expected void *[noderef] <asn:1><noident>
      got unsigned int [noderef] [usertype] <asn:1>*[assigned] va

Fix these by modifying the declaration of the fault_addr argument to:

  void __user **fault_addr

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/include/asm/fpu_emulator.h | 2 +-
 arch/mips/math-emu/cp1emu.c          | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h
index c05369e0b8d6..8e50fa3623e3 100644
--- a/arch/mips/include/asm/fpu_emulator.h
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -62,7 +62,7 @@ do {									\
 
 extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
 				    struct mips_fpu_struct *ctx, int has_fpu,
-				    void *__user *fault_addr);
+				    void __user **fault_addr);
 void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
 		     struct task_struct *tsk);
 int process_fpemu_return(int sig, void __user *fault_addr,
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index f08a7b4facb9..24d873a03327 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -58,7 +58,7 @@ static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *,
 	mips_instruction);
 
 static int fpux_emu(struct pt_regs *,
-	struct mips_fpu_struct *, mips_instruction, void *__user *);
+	struct mips_fpu_struct *, mips_instruction, void __user **);
 
 /* Control registers */
 
@@ -973,7 +973,7 @@ static inline void cop1_ctc(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
  */
 
 static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
-		struct mm_decoded_insn dec_insn, void *__user *fault_addr)
+		struct mm_decoded_insn dec_insn, void __user **fault_addr)
 {
 	unsigned long contpc = xcp->cp0_epc + dec_insn.pc_inc;
 	unsigned int cond, cbit, bit0;
@@ -1460,7 +1460,7 @@ DEF3OP(nmadd, dp, ieee754dp_mul, ieee754dp_add, ieee754dp_neg);
 DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg);
 
 static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
-	mips_instruction ir, void *__user *fault_addr)
+	mips_instruction ir, void __user **fault_addr)
 {
 	unsigned rcsr = 0;	/* resulting csr */
 
@@ -2553,7 +2553,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
  * For simplicity we always terminate upon an ISA mode switch.
  */
 int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
-	int has_fpu, void *__user *fault_addr)
+	int has_fpu, void __user **fault_addr)
 {
 	unsigned long oldepc, prevepc;
 	struct mm_decoded_insn dec_insn;
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 09/11] MIPS: Remove __invalidate_kernel_vmap_range
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

The __invalidate_kernel_vmap_range function pointer global variable
isn't used anywhere. Remove it.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/mm/cache.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 0324e1085b16..44ac64d51827 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -45,7 +45,6 @@ void (*__flush_cache_vunmap)(void);
 
 void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);
 EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range);
-void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size);
 
 /* MIPS specific cache operations */
 void (*flush_cache_sigtramp)(unsigned long addr);
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 09/11] MIPS: Remove __invalidate_kernel_vmap_range
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

The __invalidate_kernel_vmap_range function pointer global variable
isn't used anywhere. Remove it.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/mm/cache.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 0324e1085b16..44ac64d51827 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -45,7 +45,6 @@ void (*__flush_cache_vunmap)(void);
 
 void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);
 EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range);
-void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size);
 
 /* MIPS specific cache operations */
 void (*flush_cache_sigtramp)(unsigned long addr);
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 10/11] MIPS: Remove plat_timer_setup()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

The plat_timer_setup() function is entirely unused - nothing calls it,
and no platforms provide it. Perhaps our dummy implementation was once
useful as an aid in forward porting platforms, but its time has long
since passed so let's remove the dead code.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/kernel/time.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index c036157fb891..a6ebc8135112 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -72,20 +72,6 @@ EXPORT_SYMBOL(perf_irq);
 unsigned int mips_hpt_frequency;
 EXPORT_SYMBOL_GPL(mips_hpt_frequency);
 
-/*
- * This function exists in order to cause an error due to a duplicate
- * definition if platform code should have its own implementation.  The hook
- * to use instead is plat_time_init.  plat_time_init does not receive the
- * irqaction pointer argument anymore.	This is because any function which
- * initializes an interrupt timer now takes care of its own request_irq rsp.
- * setup_irq calls and each clock_event_device should use its own
- * struct irqrequest.
- */
-void __init plat_timer_setup(void)
-{
-	BUG();
-}
-
 static __init int cpu_has_mfc0_count_bug(void)
 {
 	switch (current_cpu_type()) {
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 10/11] MIPS: Remove plat_timer_setup()
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

The plat_timer_setup() function is entirely unused - nothing calls it,
and no platforms provide it. Perhaps our dummy implementation was once
useful as an aid in forward porting platforms, but its time has long
since passed so let's remove the dead code.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---

 arch/mips/kernel/time.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index c036157fb891..a6ebc8135112 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -72,20 +72,6 @@ EXPORT_SYMBOL(perf_irq);
 unsigned int mips_hpt_frequency;
 EXPORT_SYMBOL_GPL(mips_hpt_frequency);
 
-/*
- * This function exists in order to cause an error due to a duplicate
- * definition if platform code should have its own implementation.  The hook
- * to use instead is plat_time_init.  plat_time_init does not receive the
- * irqaction pointer argument anymore.	This is because any function which
- * initializes an interrupt timer now takes care of its own request_irq rsp.
- * setup_irq calls and each clock_event_device should use its own
- * struct irqrequest.
- */
-void __init plat_timer_setup(void)
-{
-	BUG();
-}
-
 static __init int cpu_has_mfc0_count_bug(void)
 {
 	switch (current_cpu_type()) {
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 11/11] MIPS: Declare various variables & functions static
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

We currently have various variables & functions which are only used
within a single translation unit, but which we don't declare static.
This causes various sparse warnings of the form:

  arch/mips/kernel/mips-r2-to-r6-emul.c:49:1: warning: symbol
    'mipsr2emustats' was not declared. Should it be static?

  arch/mips/kernel/unaligned.c:1381:11: warning: symbol 'reg16to32st'
    was not declared. Should it be static?

  arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
    declared. Should it be static?

Fix these & others by declaring various affected variables & functions
static, avoiding the sparse warnings & redundant symbols.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org

---

 arch/mips/kernel/cpu-probe.c          | 2 +-
 arch/mips/kernel/mips-r2-to-r6-emul.c | 6 +++---
 arch/mips/kernel/pm-cps.c             | 2 +-
 arch/mips/kernel/unaligned.c          | 2 +-
 arch/mips/mm/dma-default.c            | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index d08afc7dc507..17df18b87b9d 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -326,7 +326,7 @@ static int __init fpu_disable(char *s)
 
 __setup("nofpu", fpu_disable);
 
-int mips_dsp_disabled;
+static int mips_dsp_disabled;
 
 static int __init dsp_disable(char *s)
 {
diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
index ae64c8f56a8c..ac23b4f09f02 100644
--- a/arch/mips/kernel/mips-r2-to-r6-emul.c
+++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
@@ -46,9 +46,9 @@
 #define LL	"ll "
 #define SC	"sc "
 
-DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
-DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
-DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
+static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
+static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
+static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
 
 extern const unsigned int fpucondbit[8];
 
diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c
index d99416094ba9..2121ed635824 100644
--- a/arch/mips/kernel/pm-cps.c
+++ b/arch/mips/kernel/pm-cps.c
@@ -49,7 +49,7 @@ static DEFINE_PER_CPU_READ_MOSTLY(cps_nc_entry_fn[CPS_PM_STATE_COUNT],
 				  nc_asm_enter);
 
 /* Bitmap indicating which states are supported by the system */
-DECLARE_BITMAP(state_support, CPS_PM_STATE_COUNT);
+static DECLARE_BITMAP(state_support, CPS_PM_STATE_COUNT);
 
 /*
  * Indicates the number of coupled VPEs ready to operate in a non-coherent
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 5eaf2578ac04..2d0b912f9e3e 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -1378,7 +1378,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
 const int reg16to32[] = { 16, 17, 2, 3, 4, 5, 6, 7 };
 
 /* Recode table from 16-bit STORE register notation to 32-bit GPR. */
-const int reg16to32st[] = { 0, 17, 2, 3, 4, 5, 6, 7 };
+static const int reg16to32st[] = { 0, 17, 2, 3, 4, 5, 6, 7 };
 
 static void emulate_load_store_microMIPS(struct pt_regs *regs,
 					 void __user *addr)
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 8e78251eccc2..81bd6b7b9282 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -409,12 +409,12 @@ static void mips_dma_sync_sg_for_device(struct device *dev,
 	}
 }
 
-int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
+static int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 	return 0;
 }
 
-int mips_dma_supported(struct device *dev, u64 mask)
+static int mips_dma_supported(struct device *dev, u64 mask)
 {
 	return plat_dma_supported(dev, mask);
 }
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 11/11] MIPS: Declare various variables & functions static
@ 2017-08-23 18:17   ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-23 18:17 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle, trivial; +Cc: Paul Burton

We currently have various variables & functions which are only used
within a single translation unit, but which we don't declare static.
This causes various sparse warnings of the form:

  arch/mips/kernel/mips-r2-to-r6-emul.c:49:1: warning: symbol
    'mipsr2emustats' was not declared. Should it be static?

  arch/mips/kernel/unaligned.c:1381:11: warning: symbol 'reg16to32st'
    was not declared. Should it be static?

  arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
    declared. Should it be static?

Fix these & others by declaring various affected variables & functions
static, avoiding the sparse warnings & redundant symbols.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org

---

 arch/mips/kernel/cpu-probe.c          | 2 +-
 arch/mips/kernel/mips-r2-to-r6-emul.c | 6 +++---
 arch/mips/kernel/pm-cps.c             | 2 +-
 arch/mips/kernel/unaligned.c          | 2 +-
 arch/mips/mm/dma-default.c            | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index d08afc7dc507..17df18b87b9d 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -326,7 +326,7 @@ static int __init fpu_disable(char *s)
 
 __setup("nofpu", fpu_disable);
 
-int mips_dsp_disabled;
+static int mips_dsp_disabled;
 
 static int __init dsp_disable(char *s)
 {
diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
index ae64c8f56a8c..ac23b4f09f02 100644
--- a/arch/mips/kernel/mips-r2-to-r6-emul.c
+++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
@@ -46,9 +46,9 @@
 #define LL	"ll "
 #define SC	"sc "
 
-DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
-DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
-DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
+static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
+static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
+static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
 
 extern const unsigned int fpucondbit[8];
 
diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c
index d99416094ba9..2121ed635824 100644
--- a/arch/mips/kernel/pm-cps.c
+++ b/arch/mips/kernel/pm-cps.c
@@ -49,7 +49,7 @@ static DEFINE_PER_CPU_READ_MOSTLY(cps_nc_entry_fn[CPS_PM_STATE_COUNT],
 				  nc_asm_enter);
 
 /* Bitmap indicating which states are supported by the system */
-DECLARE_BITMAP(state_support, CPS_PM_STATE_COUNT);
+static DECLARE_BITMAP(state_support, CPS_PM_STATE_COUNT);
 
 /*
  * Indicates the number of coupled VPEs ready to operate in a non-coherent
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 5eaf2578ac04..2d0b912f9e3e 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -1378,7 +1378,7 @@ static void emulate_load_store_insn(struct pt_regs *regs,
 const int reg16to32[] = { 16, 17, 2, 3, 4, 5, 6, 7 };
 
 /* Recode table from 16-bit STORE register notation to 32-bit GPR. */
-const int reg16to32st[] = { 0, 17, 2, 3, 4, 5, 6, 7 };
+static const int reg16to32st[] = { 0, 17, 2, 3, 4, 5, 6, 7 };
 
 static void emulate_load_store_microMIPS(struct pt_regs *regs,
 					 void __user *addr)
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 8e78251eccc2..81bd6b7b9282 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -409,12 +409,12 @@ static void mips_dma_sync_sg_for_device(struct device *dev,
 	}
 }
 
-int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
+static int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 	return 0;
 }
 
-int mips_dma_supported(struct device *dev, u64 mask)
+static int mips_dma_supported(struct device *dev, u64 mask)
 {
 	return plat_dma_supported(dev, mask);
 }
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/11] MIPS: Fix various sparse warnings
  2017-08-23 18:17 ` Paul Burton
                   ` (11 preceding siblings ...)
  (?)
@ 2017-08-25 21:20 ` Florian Fainelli
  -1 siblings, 0 replies; 30+ messages in thread
From: Florian Fainelli @ 2017-08-25 21:20 UTC (permalink / raw)
  To: Paul Burton, linux-mips, Ralf Baechle, trivial

On 08/23/2017 11:17 AM, Paul Burton wrote:
> This series fixes various sparse warnings, mostly low hanging fruit.
> 
> Patches 1-7 include headers providing declarations of functions or
> variables in files which provide their definitions. This clears up
> sparse warnings & ensures that the prototypes of declarations &
> definitions match.
> 
> Patch 8 fixes the type of a fault_addr argument used in the FPU
> emulation code to be correct & avoid a lot of sparse warnings.
> 
> Patches 9 & 10 remove some dead code.
> 
> Patch 11 declares a bunch of things which we don't use outside of the
> translation unit that defines them static.
> 
> Applies atop v4.13-rc6.

FWIW:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> 
> Paul Burton (11):
>   MIPS: generic: Include asm/bootinfo.h for plat_fdt_relocated()
>   MIPS: generic: Include asm/time.h for get_c0_*_int()
>   MIPS: Include asm/setup.h for cpu_cache_init()
>   MIPS: Include linux/cpu.h for arch_cpu_idle()
>   MIPS: Include asm/delay.h for __{,n,u}delay()
>   MIPS: Include elf-randomize.h for arch_mmap_rnd() &
>     arch_randomize_brk()
>   MIPS: Include linux/initrd.h for free_initrd_mem()
>   MIPS: math-emu: Correct user fault_addr type
>   MIPS: Remove __invalidate_kernel_vmap_range
>   MIPS: Remove plat_timer_setup()
>   MIPS: Declare various variables & functions static
> 
>  arch/mips/generic/init.c              |  5 +++++
>  arch/mips/generic/irq.c               |  1 +
>  arch/mips/include/asm/fpu_emulator.h  |  2 +-
>  arch/mips/kernel/cpu-probe.c          |  2 +-
>  arch/mips/kernel/idle.c               |  1 +
>  arch/mips/kernel/mips-r2-to-r6-emul.c |  6 +++---
>  arch/mips/kernel/pm-cps.c             |  2 +-
>  arch/mips/kernel/time.c               | 14 --------------
>  arch/mips/kernel/unaligned.c          |  2 +-
>  arch/mips/lib/delay.c                 |  1 +
>  arch/mips/math-emu/cp1emu.c           |  8 ++++----
>  arch/mips/mm/cache.c                  |  2 +-
>  arch/mips/mm/dma-default.c            |  4 ++--
>  arch/mips/mm/init.c                   |  1 +
>  arch/mips/mm/mmap.c                   |  1 +
>  15 files changed, 24 insertions(+), 28 deletions(-)
> 


-- 
Florian

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 11/11] MIPS: Declare various variables & functions static
@ 2017-08-29 10:07     ` Marcin Nowakowski
  0 siblings, 0 replies; 30+ messages in thread
From: Marcin Nowakowski @ 2017-08-29 10:07 UTC (permalink / raw)
  To: Paul Burton, linux-mips, Ralf Baechle, trivial

Hi Paul,

On 23.08.2017 20:17, Paul Burton wrote:
> We currently have various variables & functions which are only used
> within a single translation unit, but which we don't declare static.
> This causes various sparse warnings of the form:
> 
>    arch/mips/kernel/mips-r2-to-r6-emul.c:49:1: warning: symbol
>      'mipsr2emustats' was not declared. Should it be static?
> 
>    arch/mips/kernel/unaligned.c:1381:11: warning: symbol 'reg16to32st'
>      was not declared. Should it be static?
> 
>    arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
>      declared. Should it be static?
> 
> Fix these & others by declaring various affected variables & functions
> static, avoiding the sparse warnings & redundant symbols.
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: linux-mips@linux-mips.org
> 
> ---
> 
>   arch/mips/kernel/cpu-probe.c          | 2 +-
>   arch/mips/kernel/mips-r2-to-r6-emul.c | 6 +++---
>   arch/mips/kernel/pm-cps.c             | 2 +-
>   arch/mips/kernel/unaligned.c          | 2 +-
>   arch/mips/mm/dma-default.c            | 4 ++--
>   5 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
> index d08afc7dc507..17df18b87b9d 100644
> --- a/arch/mips/kernel/cpu-probe.c
> +++ b/arch/mips/kernel/cpu-probe.c
> @@ -326,7 +326,7 @@ static int __init fpu_disable(char *s)
>   
>   __setup("nofpu", fpu_disable);
>   
> -int mips_dsp_disabled;
> +static int mips_dsp_disabled;
>   
>   static int __init dsp_disable(char *s)
>   {
> diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
> index ae64c8f56a8c..ac23b4f09f02 100644
> --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
> +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
> @@ -46,9 +46,9 @@
>   #define LL	"ll "
>   #define SC	"sc "
>   
> -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> -DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> +static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
>   

This leads to the following:

../arch/mips/kernel/mips-r2-to-r6-emul.c:51:56: error: 
‘mipsr2bremustats’ defined but not used [-Werror=unused-variable]
  static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
                                                         ^
../include/linux/percpu-defs.h:105:19: note: in definition of macro 
‘DEFINE_PER_CPU_SECTION’
   __typeof__(type) name
                    ^~~~
../arch/mips/kernel/mips-r2-to-r6-emul.c:51:8: note: in expansion of 
macro ‘DEFINE_PER_CPU’
  static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
         ^~~~~~~~~~~~~~
../arch/mips/kernel/mips-r2-to-r6-emul.c:50:54: error: 
‘mipsr2bdemustats’ defined but not used [-Werror=unused-variable]
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
                                                       ^
../include/linux/percpu-defs.h:105:19: note: in definition of macro 
‘DEFINE_PER_CPU_SECTION’
   __typeof__(type) name
                    ^~~~
../arch/mips/kernel/mips-r2-to-r6-emul.c:50:8: note: in expansion of 
macro ‘DEFINE_PER_CPU’
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
         ^~~~~~~~~~~~~~
../arch/mips/kernel/mips-r2-to-r6-emul.c:49:54: error: ‘mipsr2emustats’ 
defined but not used [-Werror=unused-variable]
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
                                                       ^
../include/linux/percpu-defs.h:105:19: note: in definition of macro 
‘DEFINE_PER_CPU_SECTION’
   __typeof__(type) name
                    ^~~~
../arch/mips/kernel/mips-r2-to-r6-emul.c:49:8: note: in expansion of 
macro ‘DEFINE_PER_CPU’
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);


when CONFIG_DEBUG_FS=n (eg. malta_qemu_32r6_defconfig)

Since these are not used without DEBUG_FS then I guess the following 
patch should be ok:

diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c 
b/arch/mips/kernel/mips-r2-to-r6-emul.c
index 3bd721c..eb18b18 100644
--- a/arch/mips/kernel/mips-r2-to-r6-emul.c
+++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
@@ -46,9 +46,11 @@
  #define LL     "ll "
  #define SC     "sc "

+#ifdef CONFIG_DEBUG_FS
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
  static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
+#endif

if you're OK with it then I guess it may be best for Ralf to fold this 
change into your patch?

Marcin

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 11/11] MIPS: Declare various variables & functions static
@ 2017-08-29 10:07     ` Marcin Nowakowski
  0 siblings, 0 replies; 30+ messages in thread
From: Marcin Nowakowski @ 2017-08-29 10:07 UTC (permalink / raw)
  To: Paul Burton, linux-mips, Ralf Baechle, trivial

Hi Paul,

On 23.08.2017 20:17, Paul Burton wrote:
> We currently have various variables & functions which are only used
> within a single translation unit, but which we don't declare static.
> This causes various sparse warnings of the form:
> 
>    arch/mips/kernel/mips-r2-to-r6-emul.c:49:1: warning: symbol
>      'mipsr2emustats' was not declared. Should it be static?
> 
>    arch/mips/kernel/unaligned.c:1381:11: warning: symbol 'reg16to32st'
>      was not declared. Should it be static?
> 
>    arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
>      declared. Should it be static?
> 
> Fix these & others by declaring various affected variables & functions
> static, avoiding the sparse warnings & redundant symbols.
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: linux-mips@linux-mips.org
> 
> ---
> 
>   arch/mips/kernel/cpu-probe.c          | 2 +-
>   arch/mips/kernel/mips-r2-to-r6-emul.c | 6 +++---
>   arch/mips/kernel/pm-cps.c             | 2 +-
>   arch/mips/kernel/unaligned.c          | 2 +-
>   arch/mips/mm/dma-default.c            | 4 ++--
>   5 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
> index d08afc7dc507..17df18b87b9d 100644
> --- a/arch/mips/kernel/cpu-probe.c
> +++ b/arch/mips/kernel/cpu-probe.c
> @@ -326,7 +326,7 @@ static int __init fpu_disable(char *s)
>   
>   __setup("nofpu", fpu_disable);
>   
> -int mips_dsp_disabled;
> +static int mips_dsp_disabled;
>   
>   static int __init dsp_disable(char *s)
>   {
> diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
> index ae64c8f56a8c..ac23b4f09f02 100644
> --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
> +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
> @@ -46,9 +46,9 @@
>   #define LL	"ll "
>   #define SC	"sc "
>   
> -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> -DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> +static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
>   

This leads to the following:

../arch/mips/kernel/mips-r2-to-r6-emul.c:51:56: error: 
‘mipsr2bremustats’ defined but not used [-Werror=unused-variable]
  static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
                                                         ^
../include/linux/percpu-defs.h:105:19: note: in definition of macro 
‘DEFINE_PER_CPU_SECTION’
   __typeof__(type) name
                    ^~~~
../arch/mips/kernel/mips-r2-to-r6-emul.c:51:8: note: in expansion of 
macro ‘DEFINE_PER_CPU’
  static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
         ^~~~~~~~~~~~~~
../arch/mips/kernel/mips-r2-to-r6-emul.c:50:54: error: 
‘mipsr2bdemustats’ defined but not used [-Werror=unused-variable]
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
                                                       ^
../include/linux/percpu-defs.h:105:19: note: in definition of macro 
‘DEFINE_PER_CPU_SECTION’
   __typeof__(type) name
                    ^~~~
../arch/mips/kernel/mips-r2-to-r6-emul.c:50:8: note: in expansion of 
macro ‘DEFINE_PER_CPU’
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
         ^~~~~~~~~~~~~~
../arch/mips/kernel/mips-r2-to-r6-emul.c:49:54: error: ‘mipsr2emustats’ 
defined but not used [-Werror=unused-variable]
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
                                                       ^
../include/linux/percpu-defs.h:105:19: note: in definition of macro 
‘DEFINE_PER_CPU_SECTION’
   __typeof__(type) name
                    ^~~~
../arch/mips/kernel/mips-r2-to-r6-emul.c:49:8: note: in expansion of 
macro ‘DEFINE_PER_CPU’
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);


when CONFIG_DEBUG_FS=n (eg. malta_qemu_32r6_defconfig)

Since these are not used without DEBUG_FS then I guess the following 
patch should be ok:

diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c 
b/arch/mips/kernel/mips-r2-to-r6-emul.c
index 3bd721c..eb18b18 100644
--- a/arch/mips/kernel/mips-r2-to-r6-emul.c
+++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
@@ -46,9 +46,11 @@
  #define LL     "ll "
  #define SC     "sc "

+#ifdef CONFIG_DEBUG_FS
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
  static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
  static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
+#endif

if you're OK with it then I guess it may be best for Ralf to fold this 
change into your patch?

Marcin

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 11/11] MIPS: Declare various variables & functions static
@ 2017-08-29 16:44       ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-29 16:44 UTC (permalink / raw)
  To: Marcin Nowakowski, ralf; +Cc: linux-mips, trivial

[-- Attachment #1: Type: text/plain, Size: 5010 bytes --]

Hi Marcin,

On Tuesday, 29 August 2017 03:05:55 PDT Marcin Nowakowski wrote:
> On 23.08.2017 20:17, Paul Burton wrote:
> > We currently have various variables & functions which are only used
> > within a single translation unit, but which we don't declare static.
> > 
> > This causes various sparse warnings of the form:
> >    arch/mips/kernel/mips-r2-to-r6-emul.c:49:1: warning: symbol
> >    
> >      'mipsr2emustats' was not declared. Should it be static?
> >    
> >    arch/mips/kernel/unaligned.c:1381:11: warning: symbol 'reg16to32st'
> >    
> >      was not declared. Should it be static?
> >    
> >    arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
> >    
> >      declared. Should it be static?
> > 
> > Fix these & others by declaring various affected variables & functions
> > static, avoiding the sparse warnings & redundant symbols.
> > 
> > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > Cc: Ralf Baechle <ralf@linux-mips.org>
> > Cc: linux-mips@linux-mips.org
> > 
> > ---
> > 
> >   arch/mips/kernel/cpu-probe.c          | 2 +-
> >   arch/mips/kernel/mips-r2-to-r6-emul.c | 6 +++---
> >   arch/mips/kernel/pm-cps.c             | 2 +-
> >   arch/mips/kernel/unaligned.c          | 2 +-
> >   arch/mips/mm/dma-default.c            | 4 ++--
> >   5 files changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c
> > b/arch/mips/kernel/mips-r2-to-r6-emul.c index ae64c8f56a8c..ac23b4f09f02
> > 100644
> > --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
> > +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
> > @@ -46,9 +46,9 @@
> > 
> >   #define LL	"ll "
> >   #define SC	"sc "
> > 
> > -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> > -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> > -DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> > +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> > +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> > +static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> 
> This leads to the following:
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:51:56: error:
> ‘mipsr2bremustats’ defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
>                                                          ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:51:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
>          ^~~~~~~~~~~~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:50:54: error:
> ‘mipsr2bdemustats’ defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>                                                        ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:50:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>          ^~~~~~~~~~~~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:49:54: error: ‘mipsr2emustats’
> defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
>                                                        ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:49:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> 
> 
> when CONFIG_DEBUG_FS=n (eg. malta_qemu_32r6_defconfig)
> 
> Since these are not used without DEBUG_FS then I guess the following
> patch should be ok:
> 
> diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c
> b/arch/mips/kernel/mips-r2-to-r6-emul.c
> index 3bd721c..eb18b18 100644
> --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
> +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
> @@ -46,9 +46,11 @@
>   #define LL     "ll "
>   #define SC     "sc "
> 
> +#ifdef CONFIG_DEBUG_FS
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> +#endif
> 
> if you're OK with it then I guess it may be best for Ralf to fold this
> change into your patch?

D'oh! That looks like a reasonable fix to me - could you fold it in Ralf?

Thanks,
    Paul

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 11/11] MIPS: Declare various variables & functions static
@ 2017-08-29 16:44       ` Paul Burton
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Burton @ 2017-08-29 16:44 UTC (permalink / raw)
  To: Marcin Nowakowski, ralf; +Cc: linux-mips, trivial

[-- Attachment #1: Type: text/plain, Size: 5010 bytes --]

Hi Marcin,

On Tuesday, 29 August 2017 03:05:55 PDT Marcin Nowakowski wrote:
> On 23.08.2017 20:17, Paul Burton wrote:
> > We currently have various variables & functions which are only used
> > within a single translation unit, but which we don't declare static.
> > 
> > This causes various sparse warnings of the form:
> >    arch/mips/kernel/mips-r2-to-r6-emul.c:49:1: warning: symbol
> >    
> >      'mipsr2emustats' was not declared. Should it be static?
> >    
> >    arch/mips/kernel/unaligned.c:1381:11: warning: symbol 'reg16to32st'
> >    
> >      was not declared. Should it be static?
> >    
> >    arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
> >    
> >      declared. Should it be static?
> > 
> > Fix these & others by declaring various affected variables & functions
> > static, avoiding the sparse warnings & redundant symbols.
> > 
> > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > Cc: Ralf Baechle <ralf@linux-mips.org>
> > Cc: linux-mips@linux-mips.org
> > 
> > ---
> > 
> >   arch/mips/kernel/cpu-probe.c          | 2 +-
> >   arch/mips/kernel/mips-r2-to-r6-emul.c | 6 +++---
> >   arch/mips/kernel/pm-cps.c             | 2 +-
> >   arch/mips/kernel/unaligned.c          | 2 +-
> >   arch/mips/mm/dma-default.c            | 4 ++--
> >   5 files changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c
> > b/arch/mips/kernel/mips-r2-to-r6-emul.c index ae64c8f56a8c..ac23b4f09f02
> > 100644
> > --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
> > +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
> > @@ -46,9 +46,9 @@
> > 
> >   #define LL	"ll "
> >   #define SC	"sc "
> > 
> > -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> > -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> > -DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> > +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> > +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> > +static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> 
> This leads to the following:
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:51:56: error:
> ‘mipsr2bremustats’ defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
>                                                          ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:51:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
>          ^~~~~~~~~~~~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:50:54: error:
> ‘mipsr2bdemustats’ defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>                                                        ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:50:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>          ^~~~~~~~~~~~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:49:54: error: ‘mipsr2emustats’
> defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
>                                                        ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:49:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> 
> 
> when CONFIG_DEBUG_FS=n (eg. malta_qemu_32r6_defconfig)
> 
> Since these are not used without DEBUG_FS then I guess the following
> patch should be ok:
> 
> diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c
> b/arch/mips/kernel/mips-r2-to-r6-emul.c
> index 3bd721c..eb18b18 100644
> --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
> +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
> @@ -46,9 +46,11 @@
>   #define LL     "ll "
>   #define SC     "sc "
> 
> +#ifdef CONFIG_DEBUG_FS
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> +#endif
> 
> if you're OK with it then I guess it may be best for Ralf to fold this
> change into your patch?

D'oh! That looks like a reasonable fix to me - could you fold it in Ralf?

Thanks,
    Paul

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 11/11] MIPS: Declare various variables & functions static
  2017-08-29 16:44       ` Paul Burton
  (?)
@ 2017-08-29 16:46       ` Ralf Baechle
  -1 siblings, 0 replies; 30+ messages in thread
From: Ralf Baechle @ 2017-08-29 16:46 UTC (permalink / raw)
  To: Paul Burton; +Cc: Marcin Nowakowski, linux-mips, trivial

On Tue, Aug 29, 2017 at 09:44:16AM -0700, Paul Burton wrote:

> > +#ifdef CONFIG_DEBUG_FS
> >   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> >   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> >   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> > +#endif
> > 
> > if you're OK with it then I guess it may be best for Ralf to fold this
> > change into your patch?
> 
> D'oh! That looks like a reasonable fix to me - could you fold it in Ralf?

Done that a few hours ago.

  Ralf

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2017-08-29 16:46 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 18:17 [PATCH 00/11] MIPS: Fix various sparse warnings Paul Burton
2017-08-23 18:17 ` Paul Burton
2017-08-23 18:17 ` [PATCH 01/11] MIPS: generic: Include asm/bootinfo.h for plat_fdt_relocated() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 02/11] MIPS: generic: Include asm/time.h for get_c0_*_int() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 03/11] MIPS: Include asm/setup.h for cpu_cache_init() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 04/11] MIPS: Include linux/cpu.h for arch_cpu_idle() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 05/11] MIPS: Include asm/delay.h for __{,n,u}delay() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 06/11] MIPS: Include elf-randomize.h for arch_mmap_rnd() & arch_randomize_brk() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 07/11] MIPS: Include linux/initrd.h for free_initrd_mem() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 08/11] MIPS: math-emu: Correct user fault_addr type Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 09/11] MIPS: Remove __invalidate_kernel_vmap_range Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 10/11] MIPS: Remove plat_timer_setup() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 11/11] MIPS: Declare various variables & functions static Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-29 10:07   ` Marcin Nowakowski
2017-08-29 10:07     ` Marcin Nowakowski
     [not found]   ` <787b1a5b-2e77-41cc-235f-6dfd882b225a@imgtec.com>
2017-08-29 16:44     ` Paul Burton
2017-08-29 16:44       ` Paul Burton
2017-08-29 16:46       ` Ralf Baechle
2017-08-25 21:20 ` [PATCH 00/11] MIPS: Fix various sparse warnings Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.