2018-03-22 20:21:48

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 00/19] powerpc/ppc32: make W=1 compilation errors free

Here is another batch for warnings treated as error on ppc32. Tested with:

$ make ARCH=powerpc ppc32_defconfig
$ make -j8 ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- W=1

Using:

$ powerpc-linux-gnu-gcc --version
powerpc-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516

Mathieu Malaterre (19):
powerpc/powermac: Mark variable x as unused
powerpc/powermac: Mark variable x as unused
powerpc: Mark variables as unused
powerpc/kvm: Mark variable tmp unused
powerpc/chrp/setup: Add attribute unused and make some functions
static
powerpc: Make function btext_initialize static
powerpc/powermac: Make some functions static
powerpc/tau: Make some function static
powerpc/chrp/pci: Make some functions static
powerpc/chrp/time: Make some functions static, add missing header
include
powerpc/powermac: Move pmac_pfunc_base_install prototype to header
file
powerpc/powermac: Add missing prototype for note_bootable_part()
powerpc/52xx: Add missing functions prototypes
powerpc/altivec: Add missing prototypes for altivec
powerpc: Add missing prototype
powerpc/powermac: Add missing include of header pmac.h
powerpc/32: Add a missing include header
powerpc: Add a missing include header
powerpc/tau: Synchronize function prototypes and body

arch/powerpc/include/asm/mpc52xx.h | 6 +++---
arch/powerpc/include/asm/pmac_pfunc.h | 1 +
arch/powerpc/include/asm/rheap.h | 3 +++
arch/powerpc/kernel/btext.c | 2 +-
arch/powerpc/kernel/irq.c | 2 +-
arch/powerpc/kernel/kvm.c | 2 +-
arch/powerpc/kernel/pci_32.c | 1 +
arch/powerpc/kernel/prom_init.c | 4 ++--
arch/powerpc/kernel/setup-common.c | 6 ------
arch/powerpc/kernel/setup.h | 6 ++++++
arch/powerpc/kernel/tau_6xx.c | 15 +++++++++------
arch/powerpc/kernel/vecemu.c | 1 +
arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
arch/powerpc/platforms/chrp/pci.c | 8 ++++----
arch/powerpc/platforms/chrp/setup.c | 10 +++++-----
arch/powerpc/platforms/chrp/time.c | 6 ++++--
arch/powerpc/platforms/powermac/bootx_init.c | 2 +-
arch/powerpc/platforms/powermac/pci.c | 10 +++++-----
arch/powerpc/platforms/powermac/setup.c | 1 +
arch/powerpc/platforms/powermac/smp.c | 1 -
arch/powerpc/platforms/powermac/time.c | 4 +++-
arch/powerpc/platforms/powermac/udbg_scc.c | 2 +-
22 files changed, 67 insertions(+), 40 deletions(-)

--
2.11.0



2018-03-22 20:22:32

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 13/19] powerpc/52xx: Add missing functions prototypes

The function prototypes were declared within a `#ifdef CONFIG_PPC_LITE5200`
block which would prevent them from being visible when compiling
`mpc52xx_pm.c`. Move the prototypes outside of the `#ifdef` block to fix
the following warnings treated as errors with W=1:

arch/powerpc/platforms/52xx/mpc52xx_pm.c:58:5: error: no previous prototype for ‘mpc52xx_pm_prepare’ [-Werror=missing-prototypes]
arch/powerpc/platforms/52xx/mpc52xx_pm.c:113:5: error: no previous prototype for ‘mpc52xx_pm_enter’ [-Werror=missing-prototypes]
arch/powerpc/platforms/52xx/mpc52xx_pm.c:181:6: error: no previous prototype for ‘mpc52xx_pm_finish’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/include/asm/mpc52xx.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
index e94cede14522..0f6b3cbb119f 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -350,14 +350,14 @@ extern struct mpc52xx_suspend mpc52xx_suspend;
extern int __init mpc52xx_pm_init(void);
extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level);

-#ifdef CONFIG_PPC_LITE5200
-extern int __init lite5200_pm_init(void);
-
/* lite5200 calls mpc5200 suspend functions, so here they are */
extern int mpc52xx_pm_prepare(void);
extern int mpc52xx_pm_enter(suspend_state_t);
extern void mpc52xx_pm_finish(void);
extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */
+
+#ifdef CONFIG_PPC_LITE5200
+extern int __init lite5200_pm_init(void);
#endif
#endif /* CONFIG_PM */

--
2.11.0


2018-03-22 20:22:40

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 17/19] powerpc/32: Add a missing include header

The header file <linux/syscalls.h> was missing from the includes. Fix the
following warning, treated as error with W=1:

arch/powerpc/kernel/pci_32.c:286:6: error: no previous prototype for ‘sys_pciconfig_iobase’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/kernel/pci_32.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 85ad2f78b889..51cba7d7a4fd 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -11,6 +11,7 @@
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/bootmem.h>
+#include <linux/syscalls.h>
#include <linux/irq.h>
#include <linux/list.h>
#include <linux/of.h>
--
2.11.0


2018-03-22 20:22:51

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 19/19] powerpc/tau: Synchronize function prototypes and body

Some function prototypes and body for Thermal Assist Units were not in
sync. Update the function definition to match the existing function
declaration found in `setup-common.c`, changing an `int` return type to a
`u32` return type. Move the prototypes to a header file. Fix the following
warnings, treated as error with W=1:

arch/powerpc/kernel/tau_6xx.c:257:5: error: no previous prototype for ‘cpu_temp_both’ [-Werror=missing-prototypes]
arch/powerpc/kernel/tau_6xx.c:262:5: error: no previous prototype for ‘cpu_temp’ [-Werror=missing-prototypes]
arch/powerpc/kernel/tau_6xx.c:267:5: error: no previous prototype for ‘tau_interrupts’ [-Werror=missing-prototypes]

Compile tested with CONFIG_TAU_INT.

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/kernel/irq.c | 2 +-
arch/powerpc/kernel/setup-common.c | 6 ------
arch/powerpc/kernel/setup.h | 6 ++++++
arch/powerpc/kernel/tau_6xx.c | 7 +++++--
4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index f88038847790..3777b6e09142 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -89,7 +89,7 @@ atomic_t ppc_n_lost_interrupts;

#ifdef CONFIG_TAU_INT
extern int tau_initialized;
-extern int tau_interrupts(int);
+extern u32 tau_interrupts(unsigned long cpu);
#endif
#endif /* CONFIG_PPC32 */

diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index d73ec518ef80..bd3675c3984b 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -192,12 +192,6 @@ void machine_halt(void)
machine_hang();
}

-
-#ifdef CONFIG_TAU
-extern u32 cpu_temp(unsigned long cpu);
-extern u32 cpu_temp_both(unsigned long cpu);
-#endif /* CONFIG_TAU */
-
#ifdef CONFIG_SMP
DEFINE_PER_CPU(unsigned int, cpu_pvr);
#endif
diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h
index d768023a04bd..3c9c19430439 100644
--- a/arch/powerpc/kernel/setup.h
+++ b/arch/powerpc/kernel/setup.h
@@ -70,4 +70,10 @@ void kvm_cma_reserve(void);
static inline void kvm_cma_reserve(void) { };
#endif

+#ifdef CONFIG_TAU
+extern u32 cpu_temp(unsigned long cpu);
+extern u32 cpu_temp_both(unsigned long cpu);
+extern u32 tau_interrupts(unsigned long cpu);
+#endif /* CONFIG_TAU */
+
#endif /* __ARCH_POWERPC_KERNEL_SETUP_H */
diff --git a/arch/powerpc/kernel/tau_6xx.c b/arch/powerpc/kernel/tau_6xx.c
index 1fc6a89a978e..e2ab8a111b69 100644
--- a/arch/powerpc/kernel/tau_6xx.c
+++ b/arch/powerpc/kernel/tau_6xx.c
@@ -27,6 +27,9 @@
#include <asm/cache.h>
#include <asm/8xx_immap.h>
#include <asm/machdep.h>
+#include <asm/asm-prototypes.h>
+
+#include "setup.h"

static struct tau_temp
{
@@ -259,12 +262,12 @@ u32 cpu_temp_both(unsigned long cpu)
return ((tau[cpu].high << 16) | tau[cpu].low);
}

-int cpu_temp(unsigned long cpu)
+u32 cpu_temp(unsigned long cpu)
{
return ((tau[cpu].high + tau[cpu].low) / 2);
}

-int tau_interrupts(unsigned long cpu)
+u32 tau_interrupts(unsigned long cpu)
{
return (tau[cpu].interrupts);
}
--
2.11.0


2018-03-22 20:23:18

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 18/19] powerpc: Add a missing include header

The header file <asm/switch_to.h> was missing from the includes. Fix the
following warning, treated as error with W=1:

arch/powerpc/kernel/vecemu.c:260:5: error: no previous prototype for ‘emulate_altivec’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/kernel/vecemu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kernel/vecemu.c b/arch/powerpc/kernel/vecemu.c
index 8812085883fd..4acd3fb2b38e 100644
--- a/arch/powerpc/kernel/vecemu.c
+++ b/arch/powerpc/kernel/vecemu.c
@@ -8,6 +8,7 @@
#include <linux/sched.h>
#include <asm/ptrace.h>
#include <asm/processor.h>
+#include <asm/switch_to.h>
#include <linux/uaccess.h>

/* Functions in vector.S */
--
2.11.0


2018-03-22 20:23:47

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 16/19] powerpc/powermac: Add missing include of header pmac.h

The header `pmac.h` was not included, leading to the following warnings,
treated as error with W=1:

arch/powerpc/platforms/powermac/time.c:69:13: error: no previous prototype for ‘pmac_time_init’ [-Werror=missing-prototypes]
arch/powerpc/platforms/powermac/time.c:207:15: error: no previous prototype for ‘pmac_get_boot_time’ [-Werror=missing-prototypes]
arch/powerpc/platforms/powermac/time.c:222:6: error: no previous prototype for ‘pmac_get_rtc_time’ [-Werror=missing-prototypes]
arch/powerpc/platforms/powermac/time.c:240:5: error: no previous prototype for ‘pmac_set_rtc_time’ [-Werror=missing-prototypes]
arch/powerpc/platforms/powermac/time.c:259:12: error: no previous prototype for ‘via_calibrate_decr’ [-Werror=missing-prototypes]
arch/powerpc/platforms/powermac/time.c:311:13: error: no previous prototype for ‘pmac_calibrate_decr’ [-Werror=missing-prototypes]

The function `via_calibrate_decr` was made static to silence a warning.

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/platforms/powermac/time.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index 274af6fa388e..5cc6fa40fcc4 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -34,6 +34,8 @@
#include <asm/nvram.h>
#include <asm/smu.h>

+#include "pmac.h"
+
#undef DEBUG

#ifdef DEBUG
@@ -256,7 +258,7 @@ int pmac_set_rtc_time(struct rtc_time *tm)
* Calibrate the decrementer register using VIA timer 1.
* This is used both on powermacs and CHRP machines.
*/
-int __init via_calibrate_decr(void)
+static int __init via_calibrate_decr(void)
{
struct device_node *vias;
volatile unsigned char __iomem *via;
--
2.11.0


2018-03-22 20:24:07

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec

Some functions prototypes were missing for the non-altivec code. Add the
missing prototypes directly in xor_vmx, fix warnings treated as errors with
W=1:

arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype for ‘xor_altivec_2’ [-Werror=missing-prototypes]
arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype for ‘xor_altivec_3’ [-Werror=missing-prototypes]
arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype for ‘xor_altivec_4’ [-Werror=missing-prototypes]
arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype for ‘xor_altivec_5’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/arch/powerpc/lib/xor_vmx.h b/arch/powerpc/lib/xor_vmx.h
index 5c2b0839b179..2173e3c84151 100644
--- a/arch/powerpc/lib/xor_vmx.h
+++ b/arch/powerpc/lib/xor_vmx.h
@@ -19,3 +19,17 @@ void __xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
void __xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
unsigned long *v2_in, unsigned long *v3_in,
unsigned long *v4_in, unsigned long *v5_in);
+
+void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in);
+
+void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in, unsigned long *v3_in);
+
+void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in, unsigned long *v3_in,
+ unsigned long *v4_in);
+
+void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in, unsigned long *v3_in,
+ unsigned long *v4_in, unsigned long *v5_in);
--
2.11.0


2018-03-22 20:24:12

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 15/19] powerpc: Add missing prototype

Add one missing prototype for function rh_dump_blk. Fix warning treated as
error in W=1:

arch/powerpc/lib/rheap.c:740:6: error: no previous prototype for ‘rh_dump_blk’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/include/asm/rheap.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/include/asm/rheap.h b/arch/powerpc/include/asm/rheap.h
index 172381769cfc..e75d96de19a0 100644
--- a/arch/powerpc/include/asm/rheap.h
+++ b/arch/powerpc/include/asm/rheap.h
@@ -83,6 +83,9 @@ extern int rh_get_stats(rh_info_t * info, int what, int max_stats,
/* Simple dump of remote heap info */
extern void rh_dump(rh_info_t * info);

+/* Simple dump of remote info block */
+extern void rh_dump_blk(rh_info_t *info, rh_block_t *blk);
+
/* Set owner of taken block */
extern int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner);

--
2.11.0


2018-03-22 20:24:28

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 09/19] powerpc/chrp/pci: Make some functions static

These functions can all be static, make it so. Fix warnings treated as
errors with W=1:

arch/powerpc/platforms/chrp/pci.c:34:5: error: no previous prototype for ‘gg2_read_config’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/pci.c:61:5: error: no previous prototype for ‘gg2_write_config’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/pci.c:97:5: error: no previous prototype for ‘rtas_read_config’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/pci.c:112:5: error: no previous prototype for ‘rtas_write_config’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/platforms/chrp/pci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 0f512d35f7c5..84e1fedb3796 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -31,7 +31,7 @@ void __iomem *gg2_pci_config_base;
* limit the bus number to 3 bits
*/

-int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
+static int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
int len, u32 *val)
{
volatile void __iomem *cfg_data;
@@ -58,7 +58,7 @@ int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
return PCIBIOS_SUCCESSFUL;
}

-int gg2_write_config(struct pci_bus *bus, unsigned int devfn, int off,
+static int gg2_write_config(struct pci_bus *bus, unsigned int devfn, int off,
int len, u32 val)
{
volatile void __iomem *cfg_data;
@@ -94,7 +94,7 @@ static struct pci_ops gg2_pci_ops =
/*
* Access functions for PCI config space using RTAS calls.
*/
-int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
+static int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
int len, u32 *val)
{
struct pci_controller *hose = pci_bus_to_host(bus);
@@ -109,7 +109,7 @@ int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
}

-int rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
+static int rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
int len, u32 val)
{
struct pci_controller *hose = pci_bus_to_host(bus);
--
2.11.0


2018-03-22 20:24:45

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 10/19] powerpc/chrp/time: Make some functions static, add missing header include

Add a missing include <platforms/chrp/chrp.h>.

These functions can all be static, make it so. Fix warnings treated as
errors with W=1:

arch/powerpc/platforms/chrp/time.c:41:13: error: no previous prototype for ‘chrp_time_init’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/time.c:66:5: error: no previous prototype for ‘chrp_cmos_clock_read’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/time.c:74:6: error: no previous prototype for ‘chrp_cmos_clock_write’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/time.c:86:5: error: no previous prototype for ‘chrp_set_rtc_time’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/time.c:130:6: error: no previous prototype for ‘chrp_get_rtc_time’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/platforms/chrp/time.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 03d115aaa191..acde7bbe0716 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -28,6 +28,8 @@
#include <asm/sections.h>
#include <asm/time.h>

+#include <platforms/chrp/chrp.h>
+
extern spinlock_t rtc_lock;

#define NVRAM_AS0 0x74
@@ -63,7 +65,7 @@ long __init chrp_time_init(void)
return 0;
}

-int chrp_cmos_clock_read(int addr)
+static int chrp_cmos_clock_read(int addr)
{
if (nvram_as1 != 0)
outb(addr>>8, nvram_as1);
@@ -71,7 +73,7 @@ int chrp_cmos_clock_read(int addr)
return (inb(nvram_data));
}

-void chrp_cmos_clock_write(unsigned long val, int addr)
+static void chrp_cmos_clock_write(unsigned long val, int addr)
{
if (nvram_as1 != 0)
outb(addr>>8, nvram_as1);
--
2.11.0


2018-03-22 20:25:21

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 11/19] powerpc/powermac: Move pmac_pfunc_base_install prototype to header file

The pmac_pfunc_base_install prototype was declared in powermac/smp.c since
function was used there, move it to pmac_pfunc.h header to be visible in
pfunc_base.c. Fix a warning treated as error with W=1:

arch/powerpc/platforms/powermac/pfunc_base.c:330:12: error: no previous prototype for ‘pmac_pfunc_base_install’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/include/asm/pmac_pfunc.h | 1 +
arch/powerpc/platforms/powermac/smp.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/pmac_pfunc.h b/arch/powerpc/include/asm/pmac_pfunc.h
index 73bd8f28f2a8..99f7a288789a 100644
--- a/arch/powerpc/include/asm/pmac_pfunc.h
+++ b/arch/powerpc/include/asm/pmac_pfunc.h
@@ -245,6 +245,7 @@ extern void pmf_put_function(struct pmf_function *func);

extern int pmf_call_one(struct pmf_function *func, struct pmf_args *args);

+extern int pmac_pfunc_base_install(void);

/* Suspend/resume code called by via-pmu directly for now */
extern void pmac_pfunc_base_suspend(void);
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 95275e0e2efa..447da6db450a 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -65,7 +65,6 @@
#endif

extern void __secondary_start_pmac_0(void);
-extern int pmac_pfunc_base_install(void);

static void (*pmac_tb_freeze)(int freeze);
static u64 timebase;
--
2.11.0


2018-03-22 20:25:35

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 08/19] powerpc/tau: Make some function static

These functions can all be static, make it so. Fix warnings treated as
errors with W=1:

arch/powerpc/kernel/tau_6xx.c:53:6: error: no previous prototype for ‘set_thresholds’ [-Werror=missing-prototypes]
arch/powerpc/kernel/tau_6xx.c:73:6: error: no previous prototype for ‘TAUupdate’ [-Werror=missing-prototypes]
arch/powerpc/kernel/tau_6xx.c:208:13: error: no previous prototype for ‘TAU_init_smp’ [-Werror=missing-prototypes]
arch/powerpc/kernel/tau_6xx.c:220:12: error: no previous prototype for ‘TAU_init’ [-Werror=missing-prototypes]
arch/powerpc/kernel/tau_6xx.c:126:6: error: no previous prototype for ‘TAUException’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/kernel/tau_6xx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/tau_6xx.c b/arch/powerpc/kernel/tau_6xx.c
index 8cdd852aedd1..1fc6a89a978e 100644
--- a/arch/powerpc/kernel/tau_6xx.c
+++ b/arch/powerpc/kernel/tau_6xx.c
@@ -50,7 +50,7 @@ struct timer_list tau_timer;
#define shrink_timer 2*HZ /* period between shrinking the window */
#define min_window 2 /* minimum window size, degrees C */

-void set_thresholds(unsigned long cpu)
+static void set_thresholds(unsigned long cpu)
{
#ifdef CONFIG_TAU_INT
/*
@@ -70,7 +70,7 @@ void set_thresholds(unsigned long cpu)
#endif
}

-void TAUupdate(int cpu)
+static void TAUupdate(int cpu)
{
unsigned thrm;

@@ -205,7 +205,7 @@ static void tau_timeout_smp(struct timer_list *unused)

int tau_initialized = 0;

-void __init TAU_init_smp(void * info)
+static void __init TAU_init_smp(void *info)
{
unsigned long cpu = smp_processor_id();

@@ -217,7 +217,7 @@ void __init TAU_init_smp(void * info)
set_thresholds(cpu);
}

-int __init TAU_init(void)
+static int __init TAU_init(void)
{
/* We assume in SMP that if one CPU has TAU support, they
* all have it --BenH
--
2.11.0


2018-03-22 20:25:44

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 12/19] powerpc/powermac: Add missing prototype for note_bootable_part()

Add a missing prototype for function `note_bootable_part` to silence a
warning treated as error with W=1:

arch/powerpc/platforms/powermac/setup.c:361:12: error: no previous prototype for ‘note_bootable_part’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/platforms/powermac/setup.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index ab668cb72263..e3d00f8af441 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -352,6 +352,7 @@ static int pmac_late_init(void)
}
machine_late_initcall(powermac, pmac_late_init);

+extern void note_bootable_part(dev_t dev, int part, int goodness);
/*
* This is __ref because we check for "initializing" before
* touching any of the __init sensitive things and "initializing"
--
2.11.0


2018-03-22 20:25:45

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 06/19] powerpc: Make function btext_initialize static

This function can be static, make it so, this fix a warning treated as
error with W=1:

arch/powerpc/kernel/btext.c:173:5: error: no previous prototype for ‘btext_initialize’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/kernel/btext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 6537cba1a758..38ae3ffe44f6 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -170,7 +170,7 @@ void btext_map(void)
boot_text_mapped = 1;
}

-int btext_initialize(struct device_node *np)
+static int btext_initialize(struct device_node *np)
{
unsigned int width, height, depth, pitch;
unsigned long address = 0;
--
2.11.0


2018-03-22 20:25:53

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 05/19] powerpc/chrp/setup: Add attribute unused and make some functions static

Add gcc attribute unused to silence a warning.

These functions can all be static, make it so. Fix warnings treated as
errors with W=1:

arch/powerpc/platforms/chrp/setup.c:97:6: error: no previous prototype for ‘chrp_show_cpuinfo’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/setup.c:302:13: error: no previous prototype for ‘chrp_setup_arch’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/setup.c:385:16: error: variable ‘idu_size’ set but not used [-Werror=unused-but-set-variable]
arch/powerpc/platforms/chrp/setup.c:526:13: error: no previous prototype for ‘chrp_init_IRQ’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/setup.c:559:1: error: no previous prototype for ‘chrp_init2’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/platforms/chrp/setup.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 481ed133e04b..85df479fd631 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -94,7 +94,7 @@ static const char *chrp_names[] = {
"Total Impact Briq"
};

-void chrp_show_cpuinfo(struct seq_file *m)
+static void chrp_show_cpuinfo(struct seq_file *m)
{
int i, sdramen;
unsigned int t;
@@ -299,7 +299,7 @@ static __init void chrp_init(void)
of_node_put(node);
}

-void __init chrp_setup_arch(void)
+static void __init chrp_setup_arch(void)
{
struct device_node *root = of_find_node_by_path("/");
const char *machine = NULL;
@@ -382,7 +382,7 @@ static void __init chrp_find_openpic(void)
{
struct device_node *np, *root;
int len, i, j;
- int isu_size, idu_size;
+ int isu_size, idu_size __maybe_unused;
const unsigned int *iranges, *opprop = NULL;
int oplen = 0;
unsigned long opaddr;
@@ -523,7 +523,7 @@ static void __init chrp_find_8259(void)
}
}

-void __init chrp_init_IRQ(void)
+static void __init chrp_init_IRQ(void)
{
#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
struct device_node *kbd;
@@ -555,7 +555,7 @@ void __init chrp_init_IRQ(void)
#endif
}

-void __init
+static void __init
chrp_init2(void)
{
#ifdef CONFIG_NVRAM
--
2.11.0


2018-03-22 20:26:04

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 07/19] powerpc/powermac: Make some functions static

These functions can all be static, make it so. Fix warnings treated as
errors with W=1:

arch/powerpc/platforms/powermac/pci.c:1022:6: error: no previous prototype for ‘pmac_pci_fixup_ohci’ [-Werror=missing-prototypes]
arch/powerpc/platforms/powermac/pci.c:1057:6: error: no previous prototype for ‘pmac_pci_fixup_cardbus’ [-Werror=missing-prototypes]
arch/powerpc/platforms/powermac/pci.c:1094:6: error: no previous prototype for ‘pmac_pci_fixup_pciata’ [-Werror=missing-prototypes]

Also add gcc attribute unused to fix a warning treated as error with W=1:

arch/powerpc/platforms/powermac/pci.c:784:19: error: variable ‘has_address’ set but not used [-Werror=unused-but-set-variable]
arch/powerpc/platforms/powermac/pci.c:907:22: error: variable ‘ht’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/platforms/powermac/pci.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 0b8174a79993..d3b9818dd880 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -781,7 +781,7 @@ static int __init pmac_add_bridge(struct device_node *dev)
struct resource rsrc;
char *disp_name;
const int *bus_range;
- int primary = 1, has_address = 0;
+ int primary = 1, has_address __maybe_unused = 0;

DBG("Adding PCI host bridge %pOF\n", dev);

@@ -904,7 +904,7 @@ static int pmac_pci_root_bridge_prepare(struct pci_host_bridge *bridge)
void __init pmac_pci_init(void)
{
struct device_node *np, *root;
- struct device_node *ht = NULL;
+ struct device_node *ht __maybe_unused = NULL;

pci_set_flags(PCI_CAN_SKIP_ISA_ALIGN);

@@ -1019,7 +1019,7 @@ static bool pmac_pci_enable_device_hook(struct pci_dev *dev)
return true;
}

-void pmac_pci_fixup_ohci(struct pci_dev *dev)
+static void pmac_pci_fixup_ohci(struct pci_dev *dev)
{
struct device_node *node = pci_device_to_OF_node(dev);

@@ -1054,7 +1054,7 @@ void __init pmac_pcibios_after_init(void)
}
}

-void pmac_pci_fixup_cardbus(struct pci_dev* dev)
+static void pmac_pci_fixup_cardbus(struct pci_dev *dev)
{
if (!machine_is(powermac))
return;
@@ -1091,7 +1091,7 @@ void pmac_pci_fixup_cardbus(struct pci_dev* dev)

DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_ANY_ID, pmac_pci_fixup_cardbus);

-void pmac_pci_fixup_pciata(struct pci_dev* dev)
+static void pmac_pci_fixup_pciata(struct pci_dev *dev)
{
u8 progif = 0;

--
2.11.0


2018-03-22 20:26:06

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 02/19] powerpc/powermac: Mark variable x as unused

Since the value of x is never intended to be read, declare it with gcc
attribute as unused. Fix warning treated as error with W=1:

arch/powerpc/platforms/powermac/udbg_scc.c:76:9: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/platforms/powermac/udbg_scc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c
index d83135a9830e..c38ca406df1a 100644
--- a/arch/powerpc/platforms/powermac/udbg_scc.c
+++ b/arch/powerpc/platforms/powermac/udbg_scc.c
@@ -73,7 +73,7 @@ void udbg_scc_init(int force_scc)
struct device_node *stdout = NULL, *escc = NULL, *macio = NULL;
struct device_node *ch, *ch_def = NULL, *ch_a = NULL;
const char *path;
- int i, x;
+ int i, x __maybe_unused;

escc = of_find_node_by_name(NULL, "escc");
if (escc == NULL)
--
2.11.0


2018-03-22 20:26:15

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 04/19] powerpc/kvm: Mark variable tmp unused

Add gcc attribute unused to variable tmp. Fix warning treated as error with
W=1:

arch/powerpc/kernel/kvm.c:675:6: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/kernel/kvm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 9ad37f827a97..cd3c088283f9 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -672,7 +672,7 @@ static void kvm_use_magic_page(void)
{
u32 *p;
u32 *start, *end;
- u32 tmp;
+ u32 tmp __maybe_unused;
u32 features;

/* Tell the host to map the magic page to -4096 on all CPUs */
--
2.11.0


2018-03-22 20:26:28

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 03/19] powerpc: Mark variables as unused

Add gcc attribute unused for two variables. Fix warnings treated as errors
with W=1:

arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/kernel/prom_init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index acf4b2e0530c..6a3ac4522144 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -603,7 +603,7 @@ static void __init early_cmdline_parse(void)
const char *opt;

char *p;
- int l = 0;
+ int l __maybe_unused = 0;

prom_cmd_line[0] = 0;
p = prom_cmd_line;
@@ -1385,7 +1385,7 @@ static void __init reserve_mem(u64 base, u64 size)
static void __init prom_init_mem(void)
{
phandle node;
- char *path, type[64];
+ char *path __maybe_unused, type[64];
unsigned int plen;
cell_t *p, *endp;
__be32 val;
--
2.11.0


2018-03-22 20:26:33

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 01/19] powerpc/powermac: Mark variable x as unused

Since the value of x is never intended to be read, declare it with gcc
attribute as unused. Fix warning treated as error with W=1:

arch/powerpc/platforms/powermac/bootx_init.c:471:21: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/platforms/powermac/bootx_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
index c3c9bbb3573a..d3ce55dae78f 100644
--- a/arch/powerpc/platforms/powermac/bootx_init.c
+++ b/arch/powerpc/platforms/powermac/bootx_init.c
@@ -468,7 +468,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
boot_infos_t *bi = (boot_infos_t *) r4;
unsigned long hdr;
unsigned long space;
- unsigned long ptr, x;
+ unsigned long ptr, x __maybe_unused;
char *model;
unsigned long offset = reloc_offset();

--
2.11.0


2018-03-23 09:20:00

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 01/19] powerpc/powermac: Mark variable x as unused



Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
> Since the value of x is never intended to be read, declare it with gcc
> attribute as unused. Fix warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/bootx_init.c:471:21: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/platforms/powermac/bootx_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
> index c3c9bbb3573a..d3ce55dae78f 100644
> --- a/arch/powerpc/platforms/powermac/bootx_init.c
> +++ b/arch/powerpc/platforms/powermac/bootx_init.c
> @@ -468,7 +468,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
> boot_infos_t *bi = (boot_infos_t *) r4;
> unsigned long hdr;
> unsigned long space;
> - unsigned long ptr, x;
> + unsigned long ptr, x __maybe_unused;

Why not use fault_in_pages_readable() instead of the hardcoded part that
uses x ?

If you decide to keep it as is, at least x should be declared inside the
if (bi->version < 4)

Christophe


> char *model;
> unsigned long offset = reloc_offset();
>
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 09:40:35

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 02/19] powerpc/powermac: Mark variable x as unused



Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
> Since the value of x is never intended to be read, declare it with gcc
> attribute as unused. Fix warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/udbg_scc.c:76:9: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/platforms/powermac/udbg_scc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c
> index d83135a9830e..c38ca406df1a 100644
> --- a/arch/powerpc/platforms/powermac/udbg_scc.c
> +++ b/arch/powerpc/platforms/powermac/udbg_scc.c
> @@ -73,7 +73,7 @@ void udbg_scc_init(int force_scc)
> struct device_node *stdout = NULL, *escc = NULL, *macio = NULL;
> struct device_node *ch, *ch_def = NULL, *ch_a = NULL;
> const char *path;
> - int i, x;
> + int i, x __maybe_unused;

You could just replace 'x = in_8(sccc)' by 'in_8(sccc)' and get rid of
the x.

Christophe


>
> escc = of_find_node_by_name(NULL, "escc");
> if (escc == NULL)
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 11:03:36

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 05/19] powerpc/chrp/setup: Add attribute unused and make some functions static



Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
> Add gcc attribute unused to silence a warning.
>
> These functions can all be static, make it so. Fix warnings treated as
> errors with W=1:
>
> arch/powerpc/platforms/chrp/setup.c:97:6: error: no previous prototype for ‘chrp_show_cpuinfo’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/setup.c:302:13: error: no previous prototype for ‘chrp_setup_arch’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/setup.c:385:16: error: variable ‘idu_size’ set but not used [-Werror=unused-but-set-variable]
> arch/powerpc/platforms/chrp/setup.c:526:13: error: no previous prototype for ‘chrp_init_IRQ’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/setup.c:559:1: error: no previous prototype for ‘chrp_init2’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/platforms/chrp/setup.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
> index 481ed133e04b..85df479fd631 100644
> --- a/arch/powerpc/platforms/chrp/setup.c
> +++ b/arch/powerpc/platforms/chrp/setup.c
> @@ -94,7 +94,7 @@ static const char *chrp_names[] = {
> "Total Impact Briq"
> };
>
> -void chrp_show_cpuinfo(struct seq_file *m)
> +static void chrp_show_cpuinfo(struct seq_file *m)
> {
> int i, sdramen;
> unsigned int t;
> @@ -299,7 +299,7 @@ static __init void chrp_init(void)
> of_node_put(node);
> }
>
> -void __init chrp_setup_arch(void)
> +static void __init chrp_setup_arch(void)
> {
> struct device_node *root = of_find_node_by_path("/");
> const char *machine = NULL;
> @@ -382,7 +382,7 @@ static void __init chrp_find_openpic(void)
> {
> struct device_node *np, *root;
> int len, i, j;
> - int isu_size, idu_size;
> + int isu_size, idu_size __maybe_unused;

idu_size is never used, you could remove it completely

Christophe

> const unsigned int *iranges, *opprop = NULL;
> int oplen = 0;
> unsigned long opaddr;
> @@ -523,7 +523,7 @@ static void __init chrp_find_8259(void)
> }
> }
>
> -void __init chrp_init_IRQ(void)
> +static void __init chrp_init_IRQ(void)
> {
> #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
> struct device_node *kbd;
> @@ -555,7 +555,7 @@ void __init chrp_init_IRQ(void)
> #endif
> }
>
> -void __init
> +static void __init
> chrp_init2(void)
> {
> #ifdef CONFIG_NVRAM
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 11:06:43

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 07/19] powerpc/powermac: Make some functions static



Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
> These functions can all be static, make it so. Fix warnings treated as
> errors with W=1:
>
> arch/powerpc/platforms/powermac/pci.c:1022:6: error: no previous prototype for ‘pmac_pci_fixup_ohci’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/pci.c:1057:6: error: no previous prototype for ‘pmac_pci_fixup_cardbus’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/pci.c:1094:6: error: no previous prototype for ‘pmac_pci_fixup_pciata’ [-Werror=missing-prototypes]
>
> Also add gcc attribute unused to fix a warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/pci.c:784:19: error: variable ‘has_address’ set but not used [-Werror=unused-but-set-variable]
> arch/powerpc/platforms/powermac/pci.c:907:22: error: variable ‘ht’ set but not used [-Werror=unused-but-set-variable]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/platforms/powermac/pci.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
> index 0b8174a79993..d3b9818dd880 100644
> --- a/arch/powerpc/platforms/powermac/pci.c
> +++ b/arch/powerpc/platforms/powermac/pci.c
> @@ -781,7 +781,7 @@ static int __init pmac_add_bridge(struct device_node *dev)
> struct resource rsrc;
> char *disp_name;
> const int *bus_range;
> - int primary = 1, has_address = 0;
> + int primary = 1, has_address __maybe_unused = 0;

YOu could remove it completely, it is never used

>
> DBG("Adding PCI host bridge %pOF\n", dev);
>
> @@ -904,7 +904,7 @@ static int pmac_pci_root_bridge_prepare(struct pci_host_bridge *bridge)
> void __init pmac_pci_init(void)
> {
> struct device_node *np, *root;
> - struct device_node *ht = NULL;
> + struct device_node *ht __maybe_unused = NULL;

Shouldn't ht be enclosed into #ifdef CONFIG_PPC64 instead ?

Christophe

>
> pci_set_flags(PCI_CAN_SKIP_ISA_ALIGN);
>
> @@ -1019,7 +1019,7 @@ static bool pmac_pci_enable_device_hook(struct pci_dev *dev)
> return true;
> }
>
> -void pmac_pci_fixup_ohci(struct pci_dev *dev)
> +static void pmac_pci_fixup_ohci(struct pci_dev *dev)
> {
> struct device_node *node = pci_device_to_OF_node(dev);
>
> @@ -1054,7 +1054,7 @@ void __init pmac_pcibios_after_init(void)
> }
> }
>
> -void pmac_pci_fixup_cardbus(struct pci_dev* dev)
> +static void pmac_pci_fixup_cardbus(struct pci_dev *dev)
> {
> if (!machine_is(powermac))
> return;
> @@ -1091,7 +1091,7 @@ void pmac_pci_fixup_cardbus(struct pci_dev* dev)
>
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_ANY_ID, pmac_pci_fixup_cardbus);
>
> -void pmac_pci_fixup_pciata(struct pci_dev* dev)
> +static void pmac_pci_fixup_pciata(struct pci_dev *dev)
> {
> u8 progif = 0;
>
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 11:23:38

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 04/19] powerpc/kvm: Mark variable tmp unused



Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
> Add gcc attribute unused to variable tmp. Fix warning treated as error with
> W=1:
>
> arch/powerpc/kernel/kvm.c:675:6: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/kernel/kvm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
> index 9ad37f827a97..cd3c088283f9 100644
> --- a/arch/powerpc/kernel/kvm.c
> +++ b/arch/powerpc/kernel/kvm.c
> @@ -672,7 +672,7 @@ static void kvm_use_magic_page(void)
> {
> u32 *p;
> u32 *start, *end;
> - u32 tmp;
> + u32 tmp __maybe_unused;
> u32 features;
>
> /* Tell the host to map the magic page to -4096 on all CPUs */
>

This fonction should use fault_in_pages_readable() instead of
hardcoding the verification.

Christophe

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 11:42:44

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 03/19] powerpc: Mark variables as unused



Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
> Add gcc attribute unused for two variables. Fix warnings treated as errors
> with W=1:
>
> arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/kernel/prom_init.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index acf4b2e0530c..6a3ac4522144 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -603,7 +603,7 @@ static void __init early_cmdline_parse(void)
> const char *opt;
>
> char *p;
> - int l = 0;
> + int l __maybe_unused = 0;
>
> prom_cmd_line[0] = 0;
> p = prom_cmd_line;
> @@ -1385,7 +1385,7 @@ static void __init reserve_mem(u64 base, u64 size)
> static void __init prom_init_mem(void)
> {
> phandle node;
> - char *path, type[64];
> + char *path __maybe_unused, type[64];

path is only used if DEBUG_PROM is defined, so it should be enclosed
into #ifdef DEBUG_PROM

Christophe

> unsigned int plen;
> cell_t *p, *endp;
> __be32 val;
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 12:15:13

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 11/19] powerpc/powermac: Move pmac_pfunc_base_install prototype to header file



Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
> The pmac_pfunc_base_install prototype was declared in powermac/smp.c since
> function was used there, move it to pmac_pfunc.h header to be visible in
> pfunc_base.c. Fix a warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/pfunc_base.c:330:12: error: no previous prototype for ‘pmac_pfunc_base_install’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/include/asm/pmac_pfunc.h | 1 +
> arch/powerpc/platforms/powermac/smp.c | 1 -
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/pmac_pfunc.h b/arch/powerpc/include/asm/pmac_pfunc.h
> index 73bd8f28f2a8..99f7a288789a 100644
> --- a/arch/powerpc/include/asm/pmac_pfunc.h
> +++ b/arch/powerpc/include/asm/pmac_pfunc.h
> @@ -245,6 +245,7 @@ extern void pmf_put_function(struct pmf_function *func);
>
> extern int pmf_call_one(struct pmf_function *func, struct pmf_args *args);
>
> +extern int pmac_pfunc_base_install(void);


extern keyword is not needed

Christophe

>
> /* Suspend/resume code called by via-pmu directly for now */
> extern void pmac_pfunc_base_suspend(void);
> diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
> index 95275e0e2efa..447da6db450a 100644
> --- a/arch/powerpc/platforms/powermac/smp.c
> +++ b/arch/powerpc/platforms/powermac/smp.c
> @@ -65,7 +65,6 @@
> #endif
>
> extern void __secondary_start_pmac_0(void);
> -extern int pmac_pfunc_base_install(void);
>
> static void (*pmac_tb_freeze)(int freeze);
> static u64 timebase;
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 12:15:19

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 12/19] powerpc/powermac: Add missing prototype for note_bootable_part()



Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
> Add a missing prototype for function `note_bootable_part` to silence a
> warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/setup.c:361:12: error: no previous prototype for ‘note_bootable_part’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/platforms/powermac/setup.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
> index ab668cb72263..e3d00f8af441 100644
> --- a/arch/powerpc/platforms/powermac/setup.c
> +++ b/arch/powerpc/platforms/powermac/setup.c
> @@ -352,6 +352,7 @@ static int pmac_late_init(void)
> }
> machine_late_initcall(powermac, pmac_late_init);
>
> +extern void note_bootable_part(dev_t dev, int part, int goodness);

extern keyword is not needed

Christophe

> /*
> * This is __ref because we check for "initializing" before
> * touching any of the __init sensitive things and "initializing"
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 12:19:39

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 13/19] powerpc/52xx: Add missing functions prototypes



Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
> The function prototypes were declared within a `#ifdef CONFIG_PPC_LITE5200`
> block which would prevent them from being visible when compiling
> `mpc52xx_pm.c`. Move the prototypes outside of the `#ifdef` block to fix
> the following warnings treated as errors with W=1:
>
> arch/powerpc/platforms/52xx/mpc52xx_pm.c:58:5: error: no previous prototype for ‘mpc52xx_pm_prepare’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/52xx/mpc52xx_pm.c:113:5: error: no previous prototype for ‘mpc52xx_pm_enter’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/52xx/mpc52xx_pm.c:181:6: error: no previous prototype for ‘mpc52xx_pm_finish’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/include/asm/mpc52xx.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
> index e94cede14522..0f6b3cbb119f 100644
> --- a/arch/powerpc/include/asm/mpc52xx.h
> +++ b/arch/powerpc/include/asm/mpc52xx.h
> @@ -350,14 +350,14 @@ extern struct mpc52xx_suspend mpc52xx_suspend;
> extern int __init mpc52xx_pm_init(void);
> extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level);
>
> -#ifdef CONFIG_PPC_LITE5200
> -extern int __init lite5200_pm_init(void);
> -
> /* lite5200 calls mpc5200 suspend functions, so here they are */
> extern int mpc52xx_pm_prepare(void);
> extern int mpc52xx_pm_enter(suspend_state_t);
> extern void mpc52xx_pm_finish(void);
> extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */
> +
> +#ifdef CONFIG_PPC_LITE5200
> +extern int __init lite5200_pm_init(void);

extern keyword is not needed

Christophe

> #endif
> #endif /* CONFIG_PM */
>
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 12:21:13

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec



Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
> Some functions prototypes were missing for the non-altivec code. Add the
> missing prototypes directly in xor_vmx, fix warnings treated as errors with
> W=1:
>
> arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype for ‘xor_altivec_2’ [-Werror=missing-prototypes]
> arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype for ‘xor_altivec_3’ [-Werror=missing-prototypes]
> arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype for ‘xor_altivec_4’ [-Werror=missing-prototypes]
> arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype for ‘xor_altivec_5’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/arch/powerpc/lib/xor_vmx.h b/arch/powerpc/lib/xor_vmx.h
> index 5c2b0839b179..2173e3c84151 100644
> --- a/arch/powerpc/lib/xor_vmx.h
> +++ b/arch/powerpc/lib/xor_vmx.h
> @@ -19,3 +19,17 @@ void __xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
> void __xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
> unsigned long *v2_in, unsigned long *v3_in,
> unsigned long *v4_in, unsigned long *v5_in);
> +
> +void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
> + unsigned long *v2_in);
> +

Only used in one place, should be static instead of adding it in a .h

Same for the other ones.

Christophe


> +void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
> + unsigned long *v2_in, unsigned long *v3_in);
> +
> +void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
> + unsigned long *v2_in, unsigned long *v3_in,
> + unsigned long *v4_in);
> +
> +void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
> + unsigned long *v2_in, unsigned long *v3_in,
> + unsigned long *v4_in, unsigned long *v5_in);
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 12:21:55

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 15/19] powerpc: Add missing prototype



Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
> Add one missing prototype for function rh_dump_blk. Fix warning treated as
> error in W=1:
>
> arch/powerpc/lib/rheap.c:740:6: error: no previous prototype for ‘rh_dump_blk’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/include/asm/rheap.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/rheap.h b/arch/powerpc/include/asm/rheap.h
> index 172381769cfc..e75d96de19a0 100644
> --- a/arch/powerpc/include/asm/rheap.h
> +++ b/arch/powerpc/include/asm/rheap.h
> @@ -83,6 +83,9 @@ extern int rh_get_stats(rh_info_t * info, int what, int max_stats,
> /* Simple dump of remote heap info */
> extern void rh_dump(rh_info_t * info);
>
> +/* Simple dump of remote info block */
> +extern void rh_dump_blk(rh_info_t *info, rh_block_t *blk);
> +

Only used in one place, should be static

Christophe

> /* Set owner of taken block */
> extern int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner);
>
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 12:23:45

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 19/19] powerpc/tau: Synchronize function prototypes and body



Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
> Some function prototypes and body for Thermal Assist Units were not in
> sync. Update the function definition to match the existing function
> declaration found in `setup-common.c`, changing an `int` return type to a
> `u32` return type. Move the prototypes to a header file. Fix the following
> warnings, treated as error with W=1:
>
> arch/powerpc/kernel/tau_6xx.c:257:5: error: no previous prototype for ‘cpu_temp_both’ [-Werror=missing-prototypes]
> arch/powerpc/kernel/tau_6xx.c:262:5: error: no previous prototype for ‘cpu_temp’ [-Werror=missing-prototypes]
> arch/powerpc/kernel/tau_6xx.c:267:5: error: no previous prototype for ‘tau_interrupts’ [-Werror=missing-prototypes]
>
> Compile tested with CONFIG_TAU_INT.
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/kernel/irq.c | 2 +-
> arch/powerpc/kernel/setup-common.c | 6 ------
> arch/powerpc/kernel/setup.h | 6 ++++++
> arch/powerpc/kernel/tau_6xx.c | 7 +++++--
> 4 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
> index f88038847790..3777b6e09142 100644
> --- a/arch/powerpc/kernel/irq.c
> +++ b/arch/powerpc/kernel/irq.c
> @@ -89,7 +89,7 @@ atomic_t ppc_n_lost_interrupts;
>
> #ifdef CONFIG_TAU_INT
> extern int tau_initialized;
> -extern int tau_interrupts(int);
> +extern u32 tau_interrupts(unsigned long cpu);
> #endif
> #endif /* CONFIG_PPC32 */
>
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index d73ec518ef80..bd3675c3984b 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -192,12 +192,6 @@ void machine_halt(void)
> machine_hang();
> }
>
> -
> -#ifdef CONFIG_TAU
> -extern u32 cpu_temp(unsigned long cpu);
> -extern u32 cpu_temp_both(unsigned long cpu);
> -#endif /* CONFIG_TAU */
> -
> #ifdef CONFIG_SMP
> DEFINE_PER_CPU(unsigned int, cpu_pvr);
> #endif
> diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h
> index d768023a04bd..3c9c19430439 100644
> --- a/arch/powerpc/kernel/setup.h
> +++ b/arch/powerpc/kernel/setup.h
> @@ -70,4 +70,10 @@ void kvm_cma_reserve(void);
> static inline void kvm_cma_reserve(void) { };
> #endif
>
> +#ifdef CONFIG_TAU
> +extern u32 cpu_temp(unsigned long cpu);
> +extern u32 cpu_temp_both(unsigned long cpu);
> +extern u32 tau_interrupts(unsigned long cpu);

extern keyword is not needed


Christophe

> +#endif /* CONFIG_TAU */
> +
> #endif /* __ARCH_POWERPC_KERNEL_SETUP_H */
> diff --git a/arch/powerpc/kernel/tau_6xx.c b/arch/powerpc/kernel/tau_6xx.c
> index 1fc6a89a978e..e2ab8a111b69 100644
> --- a/arch/powerpc/kernel/tau_6xx.c
> +++ b/arch/powerpc/kernel/tau_6xx.c
> @@ -27,6 +27,9 @@
> #include <asm/cache.h>
> #include <asm/8xx_immap.h>
> #include <asm/machdep.h>
> +#include <asm/asm-prototypes.h>
> +
> +#include "setup.h"
>
> static struct tau_temp
> {
> @@ -259,12 +262,12 @@ u32 cpu_temp_both(unsigned long cpu)
> return ((tau[cpu].high << 16) | tau[cpu].low);
> }
>
> -int cpu_temp(unsigned long cpu)
> +u32 cpu_temp(unsigned long cpu)
> {
> return ((tau[cpu].high + tau[cpu].low) / 2);
> }
>
> -int tau_interrupts(unsigned long cpu)
> +u32 tau_interrupts(unsigned long cpu)
> {
> return (tau[cpu].interrupts);
> }
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-03-23 12:26:23

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec

On Fri, Mar 23, 2018 at 1:19 PM, christophe leroy
<[email protected]> wrote:
>
>
> Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
>>
>> Some functions prototypes were missing for the non-altivec code. Add the
>> missing prototypes directly in xor_vmx, fix warnings treated as errors
>> with
>> W=1:
>>
>> arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype for
>> ‘xor_altivec_2’ [-Werror=missing-prototypes]
>> arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype for
>> ‘xor_altivec_3’ [-Werror=missing-prototypes]
>> arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype for
>> ‘xor_altivec_4’ [-Werror=missing-prototypes]
>> arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype for
>> ‘xor_altivec_5’ [-Werror=missing-prototypes]
>>
>> Signed-off-by: Mathieu Malaterre <[email protected]>
>> ---
>> arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>>
>> diff --git a/arch/powerpc/lib/xor_vmx.h b/arch/powerpc/lib/xor_vmx.h
>> index 5c2b0839b179..2173e3c84151 100644
>> --- a/arch/powerpc/lib/xor_vmx.h
>> +++ b/arch/powerpc/lib/xor_vmx.h
>> @@ -19,3 +19,17 @@ void __xor_altivec_4(unsigned long bytes, unsigned long
>> *v1_in,
>> void __xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>> unsigned long *v2_in, unsigned long *v3_in,
>> unsigned long *v4_in, unsigned long *v5_in);
>> +
>> +void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
>> + unsigned long *v2_in);
>> +
>
>
> Only used in one place, should be static instead of adding it in a .h
>
> Same for the other ones.

$ git grep xor_altivec_2
[...]
arch/powerpc/lib/xor_vmx_glue.c:EXPORT_SYMBOL(xor_altivec_2);

Are you sure I can change this function to static ?

> Christophe
>
>
>> +void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
>> + unsigned long *v2_in, unsigned long *v3_in);
>> +
>> +void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
>> + unsigned long *v2_in, unsigned long *v3_in,
>> + unsigned long *v4_in);
>> +
>> +void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>> + unsigned long *v2_in, unsigned long *v3_in,
>> + unsigned long *v4_in, unsigned long *v5_in);
>>
>
> ---
> L'absence de virus dans ce courrier électronique a été vérifiée par le
> logiciel antivirus Avast.
> https://www.avast.com/antivirus
>

2018-03-24 20:12:17

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec

Mathieu Malaterre <[email protected]> a écrit :

> On Fri, Mar 23, 2018 at 1:19 PM, christophe leroy
> <[email protected]> wrote:
>>
>>
>> Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
>>>
>>> Some functions prototypes were missing for the non-altivec code. Add the
>>> missing prototypes directly in xor_vmx, fix warnings treated as errors
>>> with
>>> W=1:
>>>
>>> arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype for
>>> ‘xor_altivec_2’ [-Werror=missing-prototypes]
>>> arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype for
>>> ‘xor_altivec_3’ [-Werror=missing-prototypes]
>>> arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype for
>>> ‘xor_altivec_4’ [-Werror=missing-prototypes]
>>> arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype for
>>> ‘xor_altivec_5’ [-Werror=missing-prototypes]
>>>
>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>> ---
>>> arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
>>> 1 file changed, 14 insertions(+)
>>>
>>> diff --git a/arch/powerpc/lib/xor_vmx.h b/arch/powerpc/lib/xor_vmx.h
>>> index 5c2b0839b179..2173e3c84151 100644
>>> --- a/arch/powerpc/lib/xor_vmx.h
>>> +++ b/arch/powerpc/lib/xor_vmx.h
>>> @@ -19,3 +19,17 @@ void __xor_altivec_4(unsigned long bytes, unsigned long
>>> *v1_in,
>>> void __xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>> unsigned long *v2_in, unsigned long *v3_in,
>>> unsigned long *v4_in, unsigned long *v5_in);
>>> +
>>> +void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
>>> + unsigned long *v2_in);
>>> +
>>
>>
>> Only used in one place, should be static instead of adding it in a .h
>>
>> Same for the other ones.
>
> $ git grep xor_altivec_2
> [...]
> arch/powerpc/lib/xor_vmx_glue.c:EXPORT_SYMBOL(xor_altivec_2);
>
> Are you sure I can change this function to static ?

Yes you are right. But in fact those fonctions are already defined in
asm/xor. h
So you just need to add the missing #include

Christophe

>
>> Christophe
>>
>>
>>> +void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
>>> + unsigned long *v2_in, unsigned long *v3_in);
>>> +
>>> +void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
>>> + unsigned long *v2_in, unsigned long *v3_in,
>>> + unsigned long *v4_in);
>>> +
>>> +void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>> + unsigned long *v2_in, unsigned long *v3_in,
>>> + unsigned long *v4_in, unsigned long *v5_in);
>>>
>>
>> ---
>> L'absence de virus dans ce courrier électronique a été vérifiée par le
>> logiciel antivirus Avast.
>> https://www.avast.com/antivirus
>>



2018-03-27 08:41:37

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec

Christophe,

On Sat, Mar 24, 2018 at 9:10 PM, LEROY Christophe
<[email protected]> wrote:
> Mathieu Malaterre <[email protected]> a écrit :
>
>
>> On Fri, Mar 23, 2018 at 1:19 PM, christophe leroy
>> <[email protected]> wrote:
>>>
>>>
>>>
>>> Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
>>>>
>>>>
>>>> Some functions prototypes were missing for the non-altivec code. Add the
>>>> missing prototypes directly in xor_vmx, fix warnings treated as errors
>>>> with
>>>> W=1:
>>>>
>>>> arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype
>>>> for
>>>> ‘xor_altivec_2’ [-Werror=missing-prototypes]
>>>> arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype
>>>> for
>>>> ‘xor_altivec_3’ [-Werror=missing-prototypes]
>>>> arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype
>>>> for
>>>> ‘xor_altivec_4’ [-Werror=missing-prototypes]
>>>> arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype
>>>> for
>>>> ‘xor_altivec_5’ [-Werror=missing-prototypes]
>>>>
>>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>>> ---
>>>> arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
>>>> 1 file changed, 14 insertions(+)
>>>>
>>>> diff --git a/arch/powerpc/lib/xor_vmx.h b/arch/powerpc/lib/xor_vmx.h
>>>> index 5c2b0839b179..2173e3c84151 100644
>>>> --- a/arch/powerpc/lib/xor_vmx.h
>>>> +++ b/arch/powerpc/lib/xor_vmx.h
>>>> @@ -19,3 +19,17 @@ void __xor_altivec_4(unsigned long bytes, unsigned
>>>> long
>>>> *v1_in,
>>>> void __xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>>> unsigned long *v2_in, unsigned long *v3_in,
>>>> unsigned long *v4_in, unsigned long
>>>> *v5_in);
>>>> +
>>>> +void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
>>>> + unsigned long *v2_in);
>>>> +
>>>
>>>
>>>
>>> Only used in one place, should be static instead of adding it in a .h
>>>
>>> Same for the other ones.
>>
>>
>> $ git grep xor_altivec_2
>> [...]
>> arch/powerpc/lib/xor_vmx_glue.c:EXPORT_SYMBOL(xor_altivec_2);
>>
>> Are you sure I can change this function to static ?
>
>
> Yes you are right. But in fact those fonctions are already defined in
> asm/xor. h
> So you just need to add the missing #include

I originally tried it, but this leads to:

CC arch/powerpc/lib/xor_vmx_glue.o
In file included from arch/powerpc/lib/xor_vmx_glue.c:16:0:
./arch/powerpc/include/asm/xor.h:39:15: error: variable
‘xor_block_altivec’ has initializer but incomplete type
static struct xor_block_template xor_block_altivec = {
^~~~~~~~~~~~~~~~~~
./arch/powerpc/include/asm/xor.h:40:2: error: unknown field ‘name’
specified in initializer
.name = "altivec",
^
[...]

The file <asm/xor.h> (powerpc) is pretty much expected to be included
after <include/linux/raid/xor.h>.

I did not want to tweak <asm/xor.h> to test for #ifdef _XOR_H just before

#ifdef _XOR_H
static struct xor_block_template xor_block_altivec = {
[...]

since this seems like a hack to me.

Is this ok to test for #ifdef _XOR_H in <arch/powerpc/include/asm/xor.h> ?

> Christophe
>
>
>>
>>> Christophe
>>>
>>>
>>>> +void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
>>>> + unsigned long *v2_in, unsigned long
>>>> *v3_in);
>>>> +
>>>> +void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
>>>> + unsigned long *v2_in, unsigned long *v3_in,
>>>> + unsigned long *v4_in);
>>>> +
>>>> +void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>>> + unsigned long *v2_in, unsigned long *v3_in,
>>>> + unsigned long *v4_in, unsigned long
>>>> *v5_in);
>>>>
>>>
>>> ---
>>> L'absence de virus dans ce courrier électronique a été vérifiée par le
>>> logiciel antivirus Avast.
>>> https://www.avast.com/antivirus
>>>
>
>

2018-03-27 15:59:42

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec

Mathieu Malaterre <[email protected]> a écrit :

> Christophe,
>
> On Sat, Mar 24, 2018 at 9:10 PM, LEROY Christophe
> <[email protected]> wrote:
>> Mathieu Malaterre <[email protected]> a écrit :
>>
>>
>>> On Fri, Mar 23, 2018 at 1:19 PM, christophe leroy
>>> <[email protected]> wrote:
>>>>
>>>>
>>>>
>>>> Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
>>>>>
>>>>>
>>>>> Some functions prototypes were missing for the non-altivec code. Add the
>>>>> missing prototypes directly in xor_vmx, fix warnings treated as errors
>>>>> with
>>>>> W=1:
>>>>>
>>>>> arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype
>>>>> for
>>>>> ‘xor_altivec_2’ [-Werror=missing-prototypes]
>>>>> arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype
>>>>> for
>>>>> ‘xor_altivec_3’ [-Werror=missing-prototypes]
>>>>> arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype
>>>>> for
>>>>> ‘xor_altivec_4’ [-Werror=missing-prototypes]
>>>>> arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype
>>>>> for
>>>>> ‘xor_altivec_5’ [-Werror=missing-prototypes]
>>>>>
>>>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>>>> ---
>>>>> arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
>>>>> 1 file changed, 14 insertions(+)
>>>>>
>>>>> diff --git a/arch/powerpc/lib/xor_vmx.h b/arch/powerpc/lib/xor_vmx.h
>>>>> index 5c2b0839b179..2173e3c84151 100644
>>>>> --- a/arch/powerpc/lib/xor_vmx.h
>>>>> +++ b/arch/powerpc/lib/xor_vmx.h
>>>>> @@ -19,3 +19,17 @@ void __xor_altivec_4(unsigned long bytes, unsigned
>>>>> long
>>>>> *v1_in,
>>>>> void __xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>>>> unsigned long *v2_in, unsigned long *v3_in,
>>>>> unsigned long *v4_in, unsigned long
>>>>> *v5_in);
>>>>> +
>>>>> +void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
>>>>> + unsigned long *v2_in);
>>>>> +
>>>>
>>>>
>>>>
>>>> Only used in one place, should be static instead of adding it in a .h
>>>>
>>>> Same for the other ones.
>>>
>>>
>>> $ git grep xor_altivec_2
>>> [...]
>>> arch/powerpc/lib/xor_vmx_glue.c:EXPORT_SYMBOL(xor_altivec_2);
>>>
>>> Are you sure I can change this function to static ?
>>
>>
>> Yes you are right. But in fact those fonctions are already defined in
>> asm/xor. h
>> So you just need to add the missing #include
>
> I originally tried it, but this leads to:
>
> CC arch/powerpc/lib/xor_vmx_glue.o
> In file included from arch/powerpc/lib/xor_vmx_glue.c:16:0:
> ./arch/powerpc/include/asm/xor.h:39:15: error: variable
> ‘xor_block_altivec’ has initializer but incomplete type
> static struct xor_block_template xor_block_altivec = {
> ^~~~~~~~~~~~~~~~~~
> ./arch/powerpc/include/asm/xor.h:40:2: error: unknown field ‘name’
> specified in initializer
> .name = "altivec",
> ^
> [...]
>
> The file <asm/xor.h> (powerpc) is pretty much expected to be included
> after <include/linux/raid/xor.h>.
>
> I did not want to tweak <asm/xor.h> to test for #ifdef _XOR_H just before
>
> #ifdef _XOR_H
> static struct xor_block_template xor_block_altivec = {
> [...]
>
> since this seems like a hack to me.
>
> Is this ok to test for #ifdef _XOR_H in <arch/powerpc/include/asm/xor.h> ?

What about including linux/raid/xor.h in asm/xor.h ?

Christophe
>
>> Christophe
>>
>>
>>>
>>>> Christophe
>>>>
>>>>
>>>>> +void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
>>>>> + unsigned long *v2_in, unsigned long
>>>>> *v3_in);
>>>>> +
>>>>> +void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
>>>>> + unsigned long *v2_in, unsigned long *v3_in,
>>>>> + unsigned long *v4_in);
>>>>> +
>>>>> +void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>>>> + unsigned long *v2_in, unsigned long *v3_in,
>>>>> + unsigned long *v4_in, unsigned long
>>>>> *v5_in);
>>>>>
>>>>
>>>> ---
>>>> L'absence de virus dans ce courrier électronique a été vérifiée par le
>>>> logiciel antivirus Avast.
>>>> https://www.avast.com/antivirus
>>>>
>>
>>



2018-03-27 17:35:35

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec

LEROY Christophe <[email protected]> a écrit :

> Mathieu Malaterre <[email protected]> a écrit :
>
>> Christophe,
>>
>> On Sat, Mar 24, 2018 at 9:10 PM, LEROY Christophe
>> <[email protected]> wrote:
>>> Mathieu Malaterre <[email protected]> a écrit :
>>>
>>>
>>>> On Fri, Mar 23, 2018 at 1:19 PM, christophe leroy
>>>> <[email protected]> wrote:
>>>>>
>>>>>
>>>>>
>>>>> Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
>>>>>>
>>>>>>
>>>>>> Some functions prototypes were missing for the non-altivec code. Add the
>>>>>> missing prototypes directly in xor_vmx, fix warnings treated as errors
>>>>>> with
>>>>>> W=1:
>>>>>>
>>>>>> arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype
>>>>>> for
>>>>>> ‘xor_altivec_2’ [-Werror=missing-prototypes]
>>>>>> arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype
>>>>>> for
>>>>>> ‘xor_altivec_3’ [-Werror=missing-prototypes]
>>>>>> arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype
>>>>>> for
>>>>>> ‘xor_altivec_4’ [-Werror=missing-prototypes]
>>>>>> arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype
>>>>>> for
>>>>>> ‘xor_altivec_5’ [-Werror=missing-prototypes]
>>>>>>
>>>>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>>>>> ---
>>>>>> arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
>>>>>> 1 file changed, 14 insertions(+)
>>>>>>
>>>>>> diff --git a/arch/powerpc/lib/xor_vmx.h b/arch/powerpc/lib/xor_vmx.h
>>>>>> index 5c2b0839b179..2173e3c84151 100644
>>>>>> --- a/arch/powerpc/lib/xor_vmx.h
>>>>>> +++ b/arch/powerpc/lib/xor_vmx.h
>>>>>> @@ -19,3 +19,17 @@ void __xor_altivec_4(unsigned long bytes, unsigned
>>>>>> long
>>>>>> *v1_in,
>>>>>> void __xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>>>>> unsigned long *v2_in, unsigned long *v3_in,
>>>>>> unsigned long *v4_in, unsigned long
>>>>>> *v5_in);
>>>>>> +
>>>>>> +void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
>>>>>> + unsigned long *v2_in);
>>>>>> +
>>>>>
>>>>>
>>>>>
>>>>> Only used in one place, should be static instead of adding it in a .h
>>>>>
>>>>> Same for the other ones.
>>>>
>>>>
>>>> $ git grep xor_altivec_2
>>>> [...]
>>>> arch/powerpc/lib/xor_vmx_glue.c:EXPORT_SYMBOL(xor_altivec_2);
>>>>
>>>> Are you sure I can change this function to static ?
>>>
>>>
>>> Yes you are right. But in fact those fonctions are already defined in
>>> asm/xor. h
>>> So you just need to add the missing #include
>>
>> I originally tried it, but this leads to:
>>
>> CC arch/powerpc/lib/xor_vmx_glue.o
>> In file included from arch/powerpc/lib/xor_vmx_glue.c:16:0:
>> ./arch/powerpc/include/asm/xor.h:39:15: error: variable
>> ‘xor_block_altivec’ has initializer but incomplete type
>> static struct xor_block_template xor_block_altivec = {
>> ^~~~~~~~~~~~~~~~~~
>> ./arch/powerpc/include/asm/xor.h:40:2: error: unknown field ‘name’
>> specified in initializer
>> .name = "altivec",
>> ^
>> [...]
>>
>> The file <asm/xor.h> (powerpc) is pretty much expected to be included
>> after <include/linux/raid/xor.h>.
>>
>> I did not want to tweak <asm/xor.h> to test for #ifdef _XOR_H just before
>>
>> #ifdef _XOR_H
>> static struct xor_block_template xor_block_altivec = {
>> [...]
>>
>> since this seems like a hack to me.
>>
>> Is this ok to test for #ifdef _XOR_H in <arch/powerpc/include/asm/xor.h> ?
>
> What about including linux/raid/xor.h in asm/xor.h ?

Or better: including linux/raid/xor.h then asm/xor.h in xor_vmx_glue.c ?

Christophe
>
> Christophe
>>
>>> Christophe
>>>
>>>
>>>>
>>>>> Christophe
>>>>>
>>>>>
>>>>>> +void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
>>>>>> + unsigned long *v2_in, unsigned long
>>>>>> *v3_in);
>>>>>> +
>>>>>> +void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
>>>>>> + unsigned long *v2_in, unsigned long *v3_in,
>>>>>> + unsigned long *v4_in);
>>>>>> +
>>>>>> +void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>>>>> + unsigned long *v2_in, unsigned long *v3_in,
>>>>>> + unsigned long *v4_in, unsigned long
>>>>>> *v5_in);
>>>>>>
>>>>>
>>>>> ---
>>>>> L'absence de virus dans ce courrier électronique a été vérifiée par le
>>>>> logiciel antivirus Avast.
>>>>> https://www.avast.com/antivirus
>>>>>
>>>
>>>



2018-03-28 07:29:33

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec

On Tue, Mar 27, 2018 at 7:33 PM, LEROY Christophe
<[email protected]> wrote:
> LEROY Christophe <[email protected]> a écrit :
>
>
>> Mathieu Malaterre <[email protected]> a écrit :
>>
>>> Christophe,
>>>
>>> On Sat, Mar 24, 2018 at 9:10 PM, LEROY Christophe
>>> <[email protected]> wrote:
>>>>
>>>> Mathieu Malaterre <[email protected]> a écrit :
>>>>
>>>>
>>>>> On Fri, Mar 23, 2018 at 1:19 PM, christophe leroy
>>>>> <[email protected]> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Some functions prototypes were missing for the non-altivec code. Add
>>>>>>> the
>>>>>>> missing prototypes directly in xor_vmx, fix warnings treated as
>>>>>>> errors
>>>>>>> with
>>>>>>> W=1:
>>>>>>>
>>>>>>> arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype
>>>>>>> for
>>>>>>> ‘xor_altivec_2’ [-Werror=missing-prototypes]
>>>>>>> arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype
>>>>>>> for
>>>>>>> ‘xor_altivec_3’ [-Werror=missing-prototypes]
>>>>>>> arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype
>>>>>>> for
>>>>>>> ‘xor_altivec_4’ [-Werror=missing-prototypes]
>>>>>>> arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype
>>>>>>> for
>>>>>>> ‘xor_altivec_5’ [-Werror=missing-prototypes]
>>>>>>>
>>>>>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>>>>>> ---
>>>>>>> arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
>>>>>>> 1 file changed, 14 insertions(+)
>>>>>>>
>>>>>>> diff --git a/arch/powerpc/lib/xor_vmx.h b/arch/powerpc/lib/xor_vmx.h
>>>>>>> index 5c2b0839b179..2173e3c84151 100644
>>>>>>> --- a/arch/powerpc/lib/xor_vmx.h
>>>>>>> +++ b/arch/powerpc/lib/xor_vmx.h
>>>>>>> @@ -19,3 +19,17 @@ void __xor_altivec_4(unsigned long bytes, unsigned
>>>>>>> long
>>>>>>> *v1_in,
>>>>>>> void __xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>>>>>> unsigned long *v2_in, unsigned long
>>>>>>> *v3_in,
>>>>>>> unsigned long *v4_in, unsigned long
>>>>>>> *v5_in);
>>>>>>> +
>>>>>>> +void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
>>>>>>> + unsigned long *v2_in);
>>>>>>> +
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Only used in one place, should be static instead of adding it in a .h
>>>>>>
>>>>>> Same for the other ones.
>>>>>
>>>>>
>>>>>
>>>>> $ git grep xor_altivec_2
>>>>> [...]
>>>>> arch/powerpc/lib/xor_vmx_glue.c:EXPORT_SYMBOL(xor_altivec_2);
>>>>>
>>>>> Are you sure I can change this function to static ?
>>>>
>>>>
>>>>
>>>> Yes you are right. But in fact those fonctions are already defined in
>>>> asm/xor. h
>>>> So you just need to add the missing #include
>>>
>>>
>>> I originally tried it, but this leads to:
>>>
>>> CC arch/powerpc/lib/xor_vmx_glue.o
>>> In file included from arch/powerpc/lib/xor_vmx_glue.c:16:0:
>>> ./arch/powerpc/include/asm/xor.h:39:15: error: variable
>>> ‘xor_block_altivec’ has initializer but incomplete type
>>> static struct xor_block_template xor_block_altivec = {
>>> ^~~~~~~~~~~~~~~~~~
>>> ./arch/powerpc/include/asm/xor.h:40:2: error: unknown field ‘name’
>>> specified in initializer
>>> .name = "altivec",
>>> ^
>>> [...]
>>>
>>> The file <asm/xor.h> (powerpc) is pretty much expected to be included
>>> after <include/linux/raid/xor.h>.
>>>
>>> I did not want to tweak <asm/xor.h> to test for #ifdef _XOR_H just before
>>>
>>> #ifdef _XOR_H
>>> static struct xor_block_template xor_block_altivec = {
>>> [...]
>>>
>>> since this seems like a hack to me.
>>>
>>> Is this ok to test for #ifdef _XOR_H in <arch/powerpc/include/asm/xor.h>
>>> ?
>>
>>
>> What about including linux/raid/xor.h in asm/xor.h ?

This leads to:

CALL ../arch/powerpc/kernel/systbl_chk.sh
In file included from ../arch/powerpc/include/asm/xor.h:57:0,
from ../arch/powerpc/lib/xor_vmx_glue.c:17:
../include/asm-generic/xor.h:688:34: error: ‘xor_block_32regs’ defined
but not used [-Werror=unused-variable]
static struct xor_block_template xor_block_32regs = {
^~~~~~~~~~~~~~~~
../include/asm-generic/xor.h:680:34: error: ‘xor_block_8regs’ defined
but not used [-Werror=unused-variable]
static struct xor_block_template xor_block_8regs = {
^~~~~~~~~~~~~~~
In file included from ../arch/powerpc/lib/xor_vmx_glue.c:17:0:
../arch/powerpc/include/asm/xor.h:39:34: error: ‘xor_block_altivec’
defined but not used [-Werror=unused-variable]
static struct xor_block_template xor_block_altivec = {
^~~~~~~~~~~~~~~~~
CALL ../arch/powerpc/kernel/prom_init_check.sh


>
> Or better: including linux/raid/xor.h then asm/xor.h in xor_vmx_glue.c ?
>
> Christophe
>
>>
>> Christophe
>>>
>>>
>>>> Christophe
>>>>
>>>>
>>>>>
>>>>>> Christophe
>>>>>>
>>>>>>
>>>>>>> +void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
>>>>>>> + unsigned long *v2_in, unsigned long
>>>>>>> *v3_in);
>>>>>>> +
>>>>>>> +void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
>>>>>>> + unsigned long *v2_in, unsigned long
>>>>>>> *v3_in,
>>>>>>> + unsigned long *v4_in);
>>>>>>> +
>>>>>>> +void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>>>>>> + unsigned long *v2_in, unsigned long
>>>>>>> *v3_in,
>>>>>>> + unsigned long *v4_in, unsigned long
>>>>>>> *v5_in);
>>>>>>>
>>>>>>
>>>>>> ---
>>>>>> L'absence de virus dans ce courrier électronique a été vérifiée par le
>>>>>> logiciel antivirus Avast.
>>>>>> https://www.avast.com/antivirus
>>>>>>
>>>>
>>>>
>
>

2018-03-28 11:55:23

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec

On Wed, Mar 28, 2018 at 9:26 AM, Mathieu Malaterre <[email protected]> wrote:
> On Tue, Mar 27, 2018 at 7:33 PM, LEROY Christophe
> <[email protected]> wrote:
>> LEROY Christophe <[email protected]> a écrit :
>>
>>
>>> Mathieu Malaterre <[email protected]> a écrit :
>>>
>>>> Christophe,
>>>>
>>>> On Sat, Mar 24, 2018 at 9:10 PM, LEROY Christophe
>>>> <[email protected]> wrote:
>>>>>
>>>>> Mathieu Malaterre <[email protected]> a écrit :
>>>>>
>>>>>
>>>>>> On Fri, Mar 23, 2018 at 1:19 PM, christophe leroy
>>>>>> <[email protected]> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Some functions prototypes were missing for the non-altivec code. Add
>>>>>>>> the
>>>>>>>> missing prototypes directly in xor_vmx, fix warnings treated as
>>>>>>>> errors
>>>>>>>> with
>>>>>>>> W=1:
>>>>>>>>
>>>>>>>> arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype
>>>>>>>> for
>>>>>>>> ‘xor_altivec_2’ [-Werror=missing-prototypes]
>>>>>>>> arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype
>>>>>>>> for
>>>>>>>> ‘xor_altivec_3’ [-Werror=missing-prototypes]
>>>>>>>> arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype
>>>>>>>> for
>>>>>>>> ‘xor_altivec_4’ [-Werror=missing-prototypes]
>>>>>>>> arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype
>>>>>>>> for
>>>>>>>> ‘xor_altivec_5’ [-Werror=missing-prototypes]
>>>>>>>>
>>>>>>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>>>>>>> ---
>>>>>>>> arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
>>>>>>>> 1 file changed, 14 insertions(+)
>>>>>>>>
>>>>>>>> diff --git a/arch/powerpc/lib/xor_vmx.h b/arch/powerpc/lib/xor_vmx.h
>>>>>>>> index 5c2b0839b179..2173e3c84151 100644
>>>>>>>> --- a/arch/powerpc/lib/xor_vmx.h
>>>>>>>> +++ b/arch/powerpc/lib/xor_vmx.h
>>>>>>>> @@ -19,3 +19,17 @@ void __xor_altivec_4(unsigned long bytes, unsigned
>>>>>>>> long
>>>>>>>> *v1_in,
>>>>>>>> void __xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>>>>>>> unsigned long *v2_in, unsigned long
>>>>>>>> *v3_in,
>>>>>>>> unsigned long *v4_in, unsigned long
>>>>>>>> *v5_in);
>>>>>>>> +
>>>>>>>> +void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
>>>>>>>> + unsigned long *v2_in);
>>>>>>>> +
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Only used in one place, should be static instead of adding it in a .h
>>>>>>>
>>>>>>> Same for the other ones.
>>>>>>
>>>>>>
>>>>>>
>>>>>> $ git grep xor_altivec_2
>>>>>> [...]
>>>>>> arch/powerpc/lib/xor_vmx_glue.c:EXPORT_SYMBOL(xor_altivec_2);
>>>>>>
>>>>>> Are you sure I can change this function to static ?
>>>>>
>>>>>
>>>>>
>>>>> Yes you are right. But in fact those fonctions are already defined in
>>>>> asm/xor. h
>>>>> So you just need to add the missing #include
>>>>
>>>>
>>>> I originally tried it, but this leads to:
>>>>
>>>> CC arch/powerpc/lib/xor_vmx_glue.o
>>>> In file included from arch/powerpc/lib/xor_vmx_glue.c:16:0:
>>>> ./arch/powerpc/include/asm/xor.h:39:15: error: variable
>>>> ‘xor_block_altivec’ has initializer but incomplete type
>>>> static struct xor_block_template xor_block_altivec = {
>>>> ^~~~~~~~~~~~~~~~~~
>>>> ./arch/powerpc/include/asm/xor.h:40:2: error: unknown field ‘name’
>>>> specified in initializer
>>>> .name = "altivec",
>>>> ^
>>>> [...]
>>>>
>>>> The file <asm/xor.h> (powerpc) is pretty much expected to be included
>>>> after <include/linux/raid/xor.h>.
>>>>
>>>> I did not want to tweak <asm/xor.h> to test for #ifdef _XOR_H just before
>>>>
>>>> #ifdef _XOR_H
>>>> static struct xor_block_template xor_block_altivec = {
>>>> [...]
>>>>
>>>> since this seems like a hack to me.
>>>>
>>>> Is this ok to test for #ifdef _XOR_H in <arch/powerpc/include/asm/xor.h>
>>>> ?
>>>
>>>
>>> What about including linux/raid/xor.h in asm/xor.h ?
>
> This leads to:
>
> CALL ../arch/powerpc/kernel/systbl_chk.sh
> In file included from ../arch/powerpc/include/asm/xor.h:57:0,
> from ../arch/powerpc/lib/xor_vmx_glue.c:17:
> ../include/asm-generic/xor.h:688:34: error: ‘xor_block_32regs’ defined
> but not used [-Werror=unused-variable]
> static struct xor_block_template xor_block_32regs = {
> ^~~~~~~~~~~~~~~~
> ../include/asm-generic/xor.h:680:34: error: ‘xor_block_8regs’ defined
> but not used [-Werror=unused-variable]
> static struct xor_block_template xor_block_8regs = {
> ^~~~~~~~~~~~~~~
> In file included from ../arch/powerpc/lib/xor_vmx_glue.c:17:0:
> ../arch/powerpc/include/asm/xor.h:39:34: error: ‘xor_block_altivec’
> defined but not used [-Werror=unused-variable]
> static struct xor_block_template xor_block_altivec = {
> ^~~~~~~~~~~~~~~~~
> CALL ../arch/powerpc/kernel/prom_init_check.sh
>

I'll prepare a patch which moves the prototypes from
arch/powerpc/include/asm/xor.h to
arch/powerpc/include/asm/xor_altivec.h (new file). I believe this
should be the simplest path.

>>
>> Or better: including linux/raid/xor.h then asm/xor.h in xor_vmx_glue.c ?
>>
>> Christophe
>>
>>>
>>> Christophe
>>>>
>>>>
>>>>> Christophe
>>>>>
>>>>>
>>>>>>
>>>>>>> Christophe
>>>>>>>
>>>>>>>
>>>>>>>> +void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
>>>>>>>> + unsigned long *v2_in, unsigned long
>>>>>>>> *v3_in);
>>>>>>>> +
>>>>>>>> +void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
>>>>>>>> + unsigned long *v2_in, unsigned long
>>>>>>>> *v3_in,
>>>>>>>> + unsigned long *v4_in);
>>>>>>>> +
>>>>>>>> +void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
>>>>>>>> + unsigned long *v2_in, unsigned long
>>>>>>>> *v3_in,
>>>>>>>> + unsigned long *v4_in, unsigned long
>>>>>>>> *v5_in);
>>>>>>>>
>>>>>>>
>>>>>>> ---
>>>>>>> L'absence de virus dans ce courrier électronique a été vérifiée par le
>>>>>>> logiciel antivirus Avast.
>>>>>>> https://www.avast.com/antivirus
>>>>>>>
>>>>>
>>>>>
>>
>>

2018-03-28 18:49:22

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2] powerpc/altivec: Add missing prototypes for altivec

Some functions prototypes were missing for the non-altivec code. Add the
missing prototypes in a new header file, fix warnings treated as errors
with W=1:

arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype for ‘xor_altivec_2’ [-Werror=missing-prototypes]
arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype for ‘xor_altivec_3’ [-Werror=missing-prototypes]
arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype for ‘xor_altivec_4’ [-Werror=missing-prototypes]
arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype for ‘xor_altivec_5’ [-Werror=missing-prototypes]

The prototypes were already present in <asm/xor.h> but this header file is
meant to be included after <include/linux/raid/xor.h>. Trying to re-use
<asm/xor.h> directly would lead to warnings such as:

arch/powerpc/include/asm/xor.h:39:15: error: variable ‘xor_block_altivec’ has initializer but incomplete type

Trying to re-use <asm/xor.h> after <include/linux/raid/xor.h> in
xor_vmx_glue.c would in turn trigger the following warnings:

include/asm-generic/xor.h:688:34: error: ‘xor_block_32regs’ defined but not used [-Werror=unused-variable]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/powerpc/include/asm/xor.h | 12 +-----------
arch/powerpc/include/asm/xor_altivec.h | 19 +++++++++++++++++++
arch/powerpc/lib/xor_vmx_glue.c | 1 +
3 files changed, 21 insertions(+), 11 deletions(-)
create mode 100644 arch/powerpc/include/asm/xor_altivec.h

diff --git a/arch/powerpc/include/asm/xor.h b/arch/powerpc/include/asm/xor.h
index a36c2069d8ed..7d6dc503349d 100644
--- a/arch/powerpc/include/asm/xor.h
+++ b/arch/powerpc/include/asm/xor.h
@@ -24,17 +24,7 @@

#include <asm/cputable.h>
#include <asm/cpu_has_feature.h>
-
-void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
- unsigned long *v2_in);
-void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
- unsigned long *v2_in, unsigned long *v3_in);
-void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
- unsigned long *v2_in, unsigned long *v3_in,
- unsigned long *v4_in);
-void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
- unsigned long *v2_in, unsigned long *v3_in,
- unsigned long *v4_in, unsigned long *v5_in);
+#include <asm/xor_altivec.h>

static struct xor_block_template xor_block_altivec = {
.name = "altivec",
diff --git a/arch/powerpc/include/asm/xor_altivec.h b/arch/powerpc/include/asm/xor_altivec.h
new file mode 100644
index 000000000000..6ca923510b59
--- /dev/null
+++ b/arch/powerpc/include/asm/xor_altivec.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_POWERPC_XOR_ALTIVEC_H
+#define _ASM_POWERPC_XOR_ALTIVEC_H
+
+#ifdef CONFIG_ALTIVEC
+
+void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in);
+void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in, unsigned long *v3_in);
+void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in, unsigned long *v3_in,
+ unsigned long *v4_in);
+void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in, unsigned long *v3_in,
+ unsigned long *v4_in, unsigned long *v5_in);
+
+#endif
+#endif /* _ASM_POWERPC_XOR_ALTIVEC_H */
diff --git a/arch/powerpc/lib/xor_vmx_glue.c b/arch/powerpc/lib/xor_vmx_glue.c
index 6521fe5e8cef..dab2b6bfcf36 100644
--- a/arch/powerpc/lib/xor_vmx_glue.c
+++ b/arch/powerpc/lib/xor_vmx_glue.c
@@ -13,6 +13,7 @@
#include <linux/export.h>
#include <linux/sched.h>
#include <asm/switch_to.h>
+#include <asm/xor_altivec.h>
#include "xor_vmx.h"

void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
--
2.11.0


2018-03-28 18:56:50

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v3] powerpc/altivec: Add missing prototypes for altivec

Some functions prototypes were missing for the non-altivec code. Add the
missing prototypes in a new header file, fix warnings treated as errors
with W=1:

arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype for ‘xor_altivec_2’ [-Werror=missing-prototypes]
arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype for ‘xor_altivec_3’ [-Werror=missing-prototypes]
arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype for ‘xor_altivec_4’ [-Werror=missing-prototypes]
arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype for ‘xor_altivec_5’ [-Werror=missing-prototypes]

The prototypes were already present in <asm/xor.h> but this header file is
meant to be included after <include/linux/raid/xor.h>. Trying to re-use
<asm/xor.h> directly would lead to warnings such as:

arch/powerpc/include/asm/xor.h:39:15: error: variable ‘xor_block_altivec’ has initializer but incomplete type

Trying to re-use <asm/xor.h> after <include/linux/raid/xor.h> in
xor_vmx_glue.c would in turn trigger the following warnings:

include/asm-generic/xor.h:688:34: error: ‘xor_block_32regs’ defined but not used [-Werror=unused-variable]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
v3: missing changelog, no other change
v2: new version where a separate header was introduced. Also update commit message explaining history.

arch/powerpc/include/asm/xor.h | 12 +-----------
arch/powerpc/include/asm/xor_altivec.h | 19 +++++++++++++++++++
arch/powerpc/lib/xor_vmx_glue.c | 1 +
3 files changed, 21 insertions(+), 11 deletions(-)
create mode 100644 arch/powerpc/include/asm/xor_altivec.h

diff --git a/arch/powerpc/include/asm/xor.h b/arch/powerpc/include/asm/xor.h
index a36c2069d8ed..7d6dc503349d 100644
--- a/arch/powerpc/include/asm/xor.h
+++ b/arch/powerpc/include/asm/xor.h
@@ -24,17 +24,7 @@

#include <asm/cputable.h>
#include <asm/cpu_has_feature.h>
-
-void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
- unsigned long *v2_in);
-void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
- unsigned long *v2_in, unsigned long *v3_in);
-void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
- unsigned long *v2_in, unsigned long *v3_in,
- unsigned long *v4_in);
-void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
- unsigned long *v2_in, unsigned long *v3_in,
- unsigned long *v4_in, unsigned long *v5_in);
+#include <asm/xor_altivec.h>

static struct xor_block_template xor_block_altivec = {
.name = "altivec",
diff --git a/arch/powerpc/include/asm/xor_altivec.h b/arch/powerpc/include/asm/xor_altivec.h
new file mode 100644
index 000000000000..6ca923510b59
--- /dev/null
+++ b/arch/powerpc/include/asm/xor_altivec.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_POWERPC_XOR_ALTIVEC_H
+#define _ASM_POWERPC_XOR_ALTIVEC_H
+
+#ifdef CONFIG_ALTIVEC
+
+void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in);
+void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in, unsigned long *v3_in);
+void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in, unsigned long *v3_in,
+ unsigned long *v4_in);
+void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
+ unsigned long *v2_in, unsigned long *v3_in,
+ unsigned long *v4_in, unsigned long *v5_in);
+
+#endif
+#endif /* _ASM_POWERPC_XOR_ALTIVEC_H */
diff --git a/arch/powerpc/lib/xor_vmx_glue.c b/arch/powerpc/lib/xor_vmx_glue.c
index 6521fe5e8cef..dab2b6bfcf36 100644
--- a/arch/powerpc/lib/xor_vmx_glue.c
+++ b/arch/powerpc/lib/xor_vmx_glue.c
@@ -13,6 +13,7 @@
#include <linux/export.h>
#include <linux/sched.h>
#include <asm/switch_to.h>
+#include <asm/xor_altivec.h>
#include "xor_vmx.h"

void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
--
2.11.0


2018-03-28 19:13:52

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH 11/19] powerpc/powermac: Move pmac_pfunc_base_install prototype to header file

On Fri, Mar 23, 2018 at 1:13 PM, christophe leroy
<[email protected]> wrote:
>
>
> Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
>>
>> The pmac_pfunc_base_install prototype was declared in powermac/smp.c since
>> function was used there, move it to pmac_pfunc.h header to be visible in
>> pfunc_base.c. Fix a warning treated as error with W=1:
>>
>> arch/powerpc/platforms/powermac/pfunc_base.c:330:12: error: no previous
>> prototype for ‘pmac_pfunc_base_install’ [-Werror=missing-prototypes]
>>
>> Signed-off-by: Mathieu Malaterre <[email protected]>
>> ---
>> arch/powerpc/include/asm/pmac_pfunc.h | 1 +
>> arch/powerpc/platforms/powermac/smp.c | 1 -
>> 2 files changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/include/asm/pmac_pfunc.h
>> b/arch/powerpc/include/asm/pmac_pfunc.h
>> index 73bd8f28f2a8..99f7a288789a 100644
>> --- a/arch/powerpc/include/asm/pmac_pfunc.h
>> +++ b/arch/powerpc/include/asm/pmac_pfunc.h
>> @@ -245,6 +245,7 @@ extern void pmf_put_function(struct pmf_function
>> *func);
>> extern int pmf_call_one(struct pmf_function *func, struct pmf_args
>> *args);
>> +extern int pmac_pfunc_base_install(void);
>
>
>
> extern keyword is not needed

I understand; but for consistency every single protoypes in this
header file actually use the extern keyword. Is there a guide/best
practice to refer to in this case ?

> Christophe
>
>> /* Suspend/resume code called by via-pmu directly for now */
>> extern void pmac_pfunc_base_suspend(void);
>> diff --git a/arch/powerpc/platforms/powermac/smp.c
>> b/arch/powerpc/platforms/powermac/smp.c
>> index 95275e0e2efa..447da6db450a 100644
>> --- a/arch/powerpc/platforms/powermac/smp.c
>> +++ b/arch/powerpc/platforms/powermac/smp.c
>> @@ -65,7 +65,6 @@
>> #endif
>> extern void __secondary_start_pmac_0(void);
>> -extern int pmac_pfunc_base_install(void);
>> static void (*pmac_tb_freeze)(int freeze);
>> static u64 timebase;
>>
>
> ---
> L'absence de virus dans ce courrier électronique a été vérifiée par le
> logiciel antivirus Avast.
> https://www.avast.com/antivirus
>

2018-03-28 19:15:29

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH 15/19] powerpc: Add missing prototype

On Fri, Mar 23, 2018 at 1:20 PM, christophe leroy
<[email protected]> wrote:
>
>
> Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
>>
>> Add one missing prototype for function rh_dump_blk. Fix warning treated as
>> error in W=1:
>>
>> arch/powerpc/lib/rheap.c:740:6: error: no previous prototype for
>> ‘rh_dump_blk’ [-Werror=missing-prototypes]
>>
>> Signed-off-by: Mathieu Malaterre <[email protected]>
>> ---
>> arch/powerpc/include/asm/rheap.h | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/powerpc/include/asm/rheap.h
>> b/arch/powerpc/include/asm/rheap.h
>> index 172381769cfc..e75d96de19a0 100644
>> --- a/arch/powerpc/include/asm/rheap.h
>> +++ b/arch/powerpc/include/asm/rheap.h
>> @@ -83,6 +83,9 @@ extern int rh_get_stats(rh_info_t * info, int what, int
>> max_stats,
>> /* Simple dump of remote heap info */
>> extern void rh_dump(rh_info_t * info);
>> +/* Simple dump of remote info block */
>> +extern void rh_dump_blk(rh_info_t *info, rh_block_t *blk);
>> +
>
>
> Only used in one place, should be static

Well here is what I see over here:

$ git grep rh_dump_blk
...
arch/powerpc/lib/rheap.c:EXPORT_SYMBOL_GPL(rh_dump_blk);



> Christophe
>
>> /* Set owner of taken block */
>> extern int rh_set_owner(rh_info_t * info, unsigned long start, const
>> char *owner);
>>
>
>
> ---
> L'absence de virus dans ce courrier électronique a été vérifiée par le
> logiciel antivirus Avast.
> https://www.avast.com/antivirus
>

2018-03-28 19:29:02

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2 01/19] powerpc/powermac: Mark variable x as unused

Since the value of x is never intended to be read, declare it with gcc
attribute as unused. Fix warning treated as error with W=1:

arch/powerpc/platforms/powermac/bootx_init.c:471:21: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
v2: move x variable within its local scope

arch/powerpc/platforms/powermac/bootx_init.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
index c3c9bbb3573a..d44e8571c1ec 100644
--- a/arch/powerpc/platforms/powermac/bootx_init.c
+++ b/arch/powerpc/platforms/powermac/bootx_init.c
@@ -468,7 +468,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
boot_infos_t *bi = (boot_infos_t *) r4;
unsigned long hdr;
unsigned long space;
- unsigned long ptr, x;
+ unsigned long ptr;
char *model;
unsigned long offset = reloc_offset();

@@ -562,6 +562,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
* MMU switched OFF, so this should not be useful anymore.
*/
if (bi->version < 4) {
+ unsigned long x __maybe_unused;
bootx_printf("Touching pages...\n");

/*
--
2.11.0


2018-03-28 19:32:01

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2 02/19] powerpc/powermac: Mark variable x as unused

Since the value of x is never intended to be read, remove it. Fix warning
treated as error with W=1:

arch/powerpc/platforms/powermac/udbg_scc.c:76:9: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v2: remove x completely

arch/powerpc/platforms/powermac/udbg_scc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c
index d83135a9830e..8901973ed683 100644
--- a/arch/powerpc/platforms/powermac/udbg_scc.c
+++ b/arch/powerpc/platforms/powermac/udbg_scc.c
@@ -73,7 +73,7 @@ void udbg_scc_init(int force_scc)
struct device_node *stdout = NULL, *escc = NULL, *macio = NULL;
struct device_node *ch, *ch_def = NULL, *ch_a = NULL;
const char *path;
- int i, x;
+ int i;

escc = of_find_node_by_name(NULL, "escc");
if (escc == NULL)
@@ -120,7 +120,7 @@ void udbg_scc_init(int force_scc)
mb();

for (i = 20000; i != 0; --i)
- x = in_8(sccc);
+ in_8(sccc);
out_8(sccc, 0x09); /* reset A or B side */
out_8(sccc, 0xc0);

--
2.11.0


2018-03-28 19:37:25

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2 05/19] powerpc/chrp/setup: Add attribute unused and make some functions static

Remove variable declaration idu_size and associated code since not used.

These functions can all be static, make it so. Fix warnings treated as
errors with W=1:

arch/powerpc/platforms/chrp/setup.c:97:6: error: no previous prototype for ‘chrp_show_cpuinfo’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/setup.c:302:13: error: no previous prototype for ‘chrp_setup_arch’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/setup.c:385:16: error: variable ‘idu_size’ set but not used [-Werror=unused-but-set-variable]
arch/powerpc/platforms/chrp/setup.c:526:13: error: no previous prototype for ‘chrp_init_IRQ’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/setup.c:559:1: error: no previous prototype for ‘chrp_init2’ [-Werror=missing-prototypes]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v2: Remove totally variable idu_size
arch/powerpc/platforms/chrp/setup.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 481ed133e04b..d6d8ffc0271e 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -94,7 +94,7 @@ static const char *chrp_names[] = {
"Total Impact Briq"
};

-void chrp_show_cpuinfo(struct seq_file *m)
+static void chrp_show_cpuinfo(struct seq_file *m)
{
int i, sdramen;
unsigned int t;
@@ -299,7 +299,7 @@ static __init void chrp_init(void)
of_node_put(node);
}

-void __init chrp_setup_arch(void)
+static void __init chrp_setup_arch(void)
{
struct device_node *root = of_find_node_by_path("/");
const char *machine = NULL;
@@ -382,7 +382,7 @@ static void __init chrp_find_openpic(void)
{
struct device_node *np, *root;
int len, i, j;
- int isu_size, idu_size;
+ int isu_size;
const unsigned int *iranges, *opprop = NULL;
int oplen = 0;
unsigned long opaddr;
@@ -427,11 +427,9 @@ static void __init chrp_find_openpic(void)
}

isu_size = 0;
- idu_size = 0;
if (len > 0 && iranges[1] != 0) {
printk(KERN_INFO "OpenPIC irqs %d..%d in IDU\n",
iranges[0], iranges[0] + iranges[1] - 1);
- idu_size = iranges[1];
}
if (len > 1)
isu_size = iranges[3];
@@ -523,7 +521,7 @@ static void __init chrp_find_8259(void)
}
}

-void __init chrp_init_IRQ(void)
+static void __init chrp_init_IRQ(void)
{
#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
struct device_node *kbd;
@@ -555,7 +553,7 @@ void __init chrp_init_IRQ(void)
#endif
}

-void __init
+static void __init
chrp_init2(void)
{
#ifdef CONFIG_NVRAM
--
2.11.0


2018-03-28 19:40:53

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2 07/19] powerpc/powermac: Make some functions static

These functions can all be static, make it so. Fix warnings treated as
errors with W=1:

arch/powerpc/platforms/powermac/pci.c:1022:6: error: no previous prototype for ‘pmac_pci_fixup_ohci’ [-Werror=missing-prototypes]
arch/powerpc/platforms/powermac/pci.c:1057:6: error: no previous prototype for ‘pmac_pci_fixup_cardbus’ [-Werror=missing-prototypes]
arch/powerpc/platforms/powermac/pci.c:1094:6: error: no previous prototype for ‘pmac_pci_fixup_pciata’ [-Werror=missing-prototypes]

Remove has_address declaration and assignment since not used. Also add gcc
attribute unused to fix a warning treated as error with W=1:

arch/powerpc/platforms/powermac/pci.c:784:19: error: variable ‘has_address’ set but not used [-Werror=unused-but-set-variable]
arch/powerpc/platforms/powermac/pci.c:907:22: error: variable ‘ht’ set but not used [-Werror=unused-but-set-variable]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v2: remove has_address variable since not used
arch/powerpc/platforms/powermac/pci.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 0b8174a79993..67c497093e0a 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -781,12 +781,12 @@ static int __init pmac_add_bridge(struct device_node *dev)
struct resource rsrc;
char *disp_name;
const int *bus_range;
- int primary = 1, has_address = 0;
+ int primary = 1;

DBG("Adding PCI host bridge %pOF\n", dev);

/* Fetch host bridge registers address */
- has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
+ of_address_to_resource(dev, 0, &rsrc);

/* Get bus range if any */
bus_range = of_get_property(dev, "bus-range", &len);
@@ -904,7 +904,7 @@ static int pmac_pci_root_bridge_prepare(struct pci_host_bridge *bridge)
void __init pmac_pci_init(void)
{
struct device_node *np, *root;
- struct device_node *ht = NULL;
+ struct device_node *ht __maybe_unused = NULL;

pci_set_flags(PCI_CAN_SKIP_ISA_ALIGN);

@@ -1019,7 +1019,7 @@ static bool pmac_pci_enable_device_hook(struct pci_dev *dev)
return true;
}

-void pmac_pci_fixup_ohci(struct pci_dev *dev)
+static void pmac_pci_fixup_ohci(struct pci_dev *dev)
{
struct device_node *node = pci_device_to_OF_node(dev);

@@ -1054,7 +1054,7 @@ void __init pmac_pcibios_after_init(void)
}
}

-void pmac_pci_fixup_cardbus(struct pci_dev* dev)
+static void pmac_pci_fixup_cardbus(struct pci_dev *dev)
{
if (!machine_is(powermac))
return;
@@ -1091,7 +1091,7 @@ void pmac_pci_fixup_cardbus(struct pci_dev* dev)

DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_ANY_ID, pmac_pci_fixup_cardbus);

-void pmac_pci_fixup_pciata(struct pci_dev* dev)
+static void pmac_pci_fixup_pciata(struct pci_dev *dev)
{
u8 progif = 0;

--
2.11.0


2018-03-28 19:59:37

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2 04/19] powerpc/kvm: Prefer fault_in_pages_readable function

Directly use fault_in_pages_readable instead of manual __get_user code. Fix
warning treated as error with W=1:

arch/powerpc/kernel/kvm.c:675:6: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v2: use fault_in_pages_readable instead
arch/powerpc/kernel/kvm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 9ad37f827a97..124c51030b75 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -25,6 +25,7 @@
#include <linux/kvm_para.h>
#include <linux/slab.h>
#include <linux/of.h>
+#include <linux/pagemap.h>

#include <asm/reg.h>
#include <asm/sections.h>
@@ -672,14 +673,13 @@ static void kvm_use_magic_page(void)
{
u32 *p;
u32 *start, *end;
- u32 tmp;
u32 features;

/* Tell the host to map the magic page to -4096 on all CPUs */
on_each_cpu(kvm_map_magic_page, &features, 1);

/* Quick self-test to see if the mapping works */
- if (__get_user(tmp, (u32*)KVM_MAGIC_PAGE)) {
+ if (!fault_in_pages_readable((const char *)KVM_MAGIC_PAGE, sizeof(u32))) {
kvm_patching_worked = false;
return;
}
--
2.11.0


2018-03-28 20:12:00

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2 03/19] powerpc: Mark variables as unused

Add gcc attribute unused for two variables. Fix warnings treated as errors
with W=1:

arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v2: move path within ifdef DEBUG_PROM

arch/powerpc/kernel/prom_init.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index acf4b2e0530c..4163b11abb6c 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -603,7 +603,7 @@ static void __init early_cmdline_parse(void)
const char *opt;

char *p;
- int l = 0;
+ int l __maybe_unused = 0;

prom_cmd_line[0] = 0;
p = prom_cmd_line;
@@ -1385,7 +1385,7 @@ static void __init reserve_mem(u64 base, u64 size)
static void __init prom_init_mem(void)
{
phandle node;
- char *path, type[64];
+ char *path __maybe_unused, type[64];
unsigned int plen;
cell_t *p, *endp;
__be32 val;
@@ -1406,7 +1406,6 @@ static void __init prom_init_mem(void)
prom_debug("root_size_cells: %x\n", rsc);

prom_debug("scanning memory:\n");
- path = prom_scratch;

for (node = 0; prom_next_node(&node); ) {
type[0] = 0;
@@ -1431,6 +1430,7 @@ static void __init prom_init_mem(void)
endp = p + (plen / sizeof(cell_t));

#ifdef DEBUG_PROM
+ path = prom_scratch;
memset(path, 0, PROM_SCRATCH_SIZE);
call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1);
prom_debug(" node %s :\n", path);
--
2.11.0


2018-03-29 15:53:06

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 11/19] powerpc/powermac: Move pmac_pfunc_base_install prototype to header file

Mathieu Malaterre <[email protected]> a écrit :

> On Fri, Mar 23, 2018 at 1:13 PM, christophe leroy
> <[email protected]> wrote:
>>
>>
>> Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
>>>
>>> The pmac_pfunc_base_install prototype was declared in powermac/smp.c since
>>> function was used there, move it to pmac_pfunc.h header to be visible in
>>> pfunc_base.c. Fix a warning treated as error with W=1:
>>>
>>> arch/powerpc/platforms/powermac/pfunc_base.c:330:12: error: no previous
>>> prototype for ‘pmac_pfunc_base_install’ [-Werror=missing-prototypes]
>>>
>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>> ---
>>> arch/powerpc/include/asm/pmac_pfunc.h | 1 +
>>> arch/powerpc/platforms/powermac/smp.c | 1 -
>>> 2 files changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/include/asm/pmac_pfunc.h
>>> b/arch/powerpc/include/asm/pmac_pfunc.h
>>> index 73bd8f28f2a8..99f7a288789a 100644
>>> --- a/arch/powerpc/include/asm/pmac_pfunc.h
>>> +++ b/arch/powerpc/include/asm/pmac_pfunc.h
>>> @@ -245,6 +245,7 @@ extern void pmf_put_function(struct pmf_function
>>> *func);
>>> extern int pmf_call_one(struct pmf_function *func, struct pmf_args
>>> *args);
>>> +extern int pmac_pfunc_base_install(void);
>>
>>
>>
>> extern keyword is not needed
>
> I understand; but for consistency every single protoypes in this
> header file actually use the extern keyword. Is there a guide/best
> practice to refer to in this case ?

Consistancy is not a valid reason to continue bad practice. Every
single modufication is an opportunity to clean things up

You should run script/checkpatch.pl --strict on all your patches
before submitting.
And follow as much as possible the linux codying style

Christophe

>
>> Christophe
>>
>>> /* Suspend/resume code called by via-pmu directly for now */
>>> extern void pmac_pfunc_base_suspend(void);
>>> diff --git a/arch/powerpc/platforms/powermac/smp.c
>>> b/arch/powerpc/platforms/powermac/smp.c
>>> index 95275e0e2efa..447da6db450a 100644
>>> --- a/arch/powerpc/platforms/powermac/smp.c
>>> +++ b/arch/powerpc/platforms/powermac/smp.c
>>> @@ -65,7 +65,6 @@
>>> #endif
>>> extern void __secondary_start_pmac_0(void);
>>> -extern int pmac_pfunc_base_install(void);
>>> static void (*pmac_tb_freeze)(int freeze);
>>> static u64 timebase;
>>>
>>
>> ---
>> L'absence de virus dans ce courrier électronique a été vérifiée par le
>> logiciel antivirus Avast.
>> https://www.avast.com/antivirus
>>



2018-03-29 16:05:42

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH 15/19] powerpc: Add missing prototype

Mathieu Malaterre <[email protected]> a écrit :

> On Fri, Mar 23, 2018 at 1:20 PM, christophe leroy
> <[email protected]> wrote:
>>
>>
>> Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
>>>
>>> Add one missing prototype for function rh_dump_blk. Fix warning treated as
>>> error in W=1:
>>>
>>> arch/powerpc/lib/rheap.c:740:6: error: no previous prototype for
>>> ‘rh_dump_blk’ [-Werror=missing-prototypes]
>>>
>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>> ---
>>> arch/powerpc/include/asm/rheap.h | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/arch/powerpc/include/asm/rheap.h
>>> b/arch/powerpc/include/asm/rheap.h
>>> index 172381769cfc..e75d96de19a0 100644
>>> --- a/arch/powerpc/include/asm/rheap.h
>>> +++ b/arch/powerpc/include/asm/rheap.h
>>> @@ -83,6 +83,9 @@ extern int rh_get_stats(rh_info_t * info, int what, int
>>> max_stats,
>>> /* Simple dump of remote heap info */
>>> extern void rh_dump(rh_info_t * info);
>>> +/* Simple dump of remote info block */
>>> +extern void rh_dump_blk(rh_info_t *info, rh_block_t *blk);
>>> +
>>
>>
>> Only used in one place, should be static
>
> Well here is what I see over here:
>
> $ git grep rh_dump_blk
> ...
> arch/powerpc/lib/rheap.c:EXPORT_SYMBOL_GPL(rh_dump_blk);

If it was really used by anybody in a module, it would already be in a
.h so I think we should simply delete the function

Christophe

>
>
>
>> Christophe
>>
>>> /* Set owner of taken block */
>>> extern int rh_set_owner(rh_info_t * info, unsigned long start, const
>>> char *owner);
>>>
>>
>>
>> ---
>> L'absence de virus dans ce courrier électronique a été vérifiée par le
>> logiciel antivirus Avast.
>> https://www.avast.com/antivirus
>>



2018-03-29 16:10:51

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v2 01/19] powerpc/powermac: Mark variable x as unused

Mathieu Malaterre <[email protected]> a écrit :

> Since the value of x is never intended to be read, declare it with gcc
> attribute as unused. Fix warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/bootx_init.c:471:21: error:
> variable ‘x’ set but not used [-Werror=unused-but-set-variable]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> v2: move x variable within its local scope
>
> arch/powerpc/platforms/powermac/bootx_init.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/powermac/bootx_init.c
> b/arch/powerpc/platforms/powermac/bootx_init.c
> index c3c9bbb3573a..d44e8571c1ec 100644
> --- a/arch/powerpc/platforms/powermac/bootx_init.c
> +++ b/arch/powerpc/platforms/powermac/bootx_init.c
> @@ -468,7 +468,7 @@ void __init bootx_init(unsigned long r3,
> unsigned long r4)
> boot_infos_t *bi = (boot_infos_t *) r4;
> unsigned long hdr;
> unsigned long space;
> - unsigned long ptr, x;
> + unsigned long ptr;
> char *model;
> unsigned long offset = reloc_offset();
>
> @@ -562,6 +562,7 @@ void __init bootx_init(unsigned long r3,
> unsigned long r4)
> * MMU switched OFF, so this should not be useful anymore.
> */
> if (bi->version < 4) {
> + unsigned long x __maybe_unused;
> bootx_printf("Touching pages...\n");

Stylewise, there should be an empty line after your declaration.

But I believe you should remove that ugly loop and replace it by a
call to fault_in_pages_readable()

Christophe
>
> /*
> --
> 2.11.0



2018-03-29 16:11:36

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v2 02/19] powerpc/powermac: Mark variable x as unused

Mathieu Malaterre <[email protected]> a écrit :

> Since the value of x is never intended to be read, remove it. Fix warning
> treated as error with W=1:
>
> arch/powerpc/platforms/powermac/udbg_scc.c:76:9: error: variable
> ‘x’ set but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Reviewed-by: Christophe Leroy <[email protected]>

> ---
> v2: remove x completely
>
> arch/powerpc/platforms/powermac/udbg_scc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c
> b/arch/powerpc/platforms/powermac/udbg_scc.c
> index d83135a9830e..8901973ed683 100644
> --- a/arch/powerpc/platforms/powermac/udbg_scc.c
> +++ b/arch/powerpc/platforms/powermac/udbg_scc.c
> @@ -73,7 +73,7 @@ void udbg_scc_init(int force_scc)
> struct device_node *stdout = NULL, *escc = NULL, *macio = NULL;
> struct device_node *ch, *ch_def = NULL, *ch_a = NULL;
> const char *path;
> - int i, x;
> + int i;
>
> escc = of_find_node_by_name(NULL, "escc");
> if (escc == NULL)
> @@ -120,7 +120,7 @@ void udbg_scc_init(int force_scc)
> mb();
>
> for (i = 20000; i != 0; --i)
> - x = in_8(sccc);
> + in_8(sccc);
> out_8(sccc, 0x09); /* reset A or B side */
> out_8(sccc, 0xc0);
>
> --
> 2.11.0



2018-03-29 16:16:10

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v2 03/19] powerpc: Mark variables as unused

Mathieu Malaterre <[email protected]> a écrit :

> Add gcc attribute unused for two variables. Fix warnings treated as errors
> with W=1:
>
> arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set
> but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> v2: move path within ifdef DEBUG_PROM
>
> arch/powerpc/kernel/prom_init.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom_init.c
> b/arch/powerpc/kernel/prom_init.c
> index acf4b2e0530c..4163b11abb6c 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -603,7 +603,7 @@ static void __init early_cmdline_parse(void)
> const char *opt;
>
> char *p;
> - int l = 0;
> + int l __maybe_unused = 0;
>
> prom_cmd_line[0] = 0;
> p = prom_cmd_line;
> @@ -1385,7 +1385,7 @@ static void __init reserve_mem(u64 base, u64 size)
> static void __init prom_init_mem(void)
> {
> phandle node;
> - char *path, type[64];
> + char *path __maybe_unused, type[64];

You should enclose that in an ifdef DEBUG_PROM instead of hiding the warning

Christophe

> unsigned int plen;
> cell_t *p, *endp;
> __be32 val;
> @@ -1406,7 +1406,6 @@ static void __init prom_init_mem(void)
> prom_debug("root_size_cells: %x\n", rsc);
>
> prom_debug("scanning memory:\n");
> - path = prom_scratch;
>
> for (node = 0; prom_next_node(&node); ) {
> type[0] = 0;
> @@ -1431,6 +1430,7 @@ static void __init prom_init_mem(void)
> endp = p + (plen / sizeof(cell_t));
>
> #ifdef DEBUG_PROM
> + path = prom_scratch;
> memset(path, 0, PROM_SCRATCH_SIZE);
> call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1);
> prom_debug(" node %s :\n", path);
> --
> 2.11.0



2018-03-29 16:18:41

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v2 05/19] powerpc/chrp/setup: Add attribute unused and make some functions static

The subject of the patch should be updated as well

Christophe


Mathieu Malaterre <[email protected]> a écrit :

> Remove variable declaration idu_size and associated code since not used.
>
> These functions can all be static, make it so. Fix warnings treated as
> errors with W=1:
>
> arch/powerpc/platforms/chrp/setup.c:97:6: error: no previous
> prototype for ‘chrp_show_cpuinfo’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/setup.c:302:13: error: no previous
> prototype for ‘chrp_setup_arch’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/setup.c:385:16: error: variable
> ‘idu_size’ set but not used [-Werror=unused-but-set-variable]
> arch/powerpc/platforms/chrp/setup.c:526:13: error: no previous
> prototype for ‘chrp_init_IRQ’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/setup.c:559:1: error: no previous
> prototype for ‘chrp_init2’ [-Werror=missing-prototypes]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> v2: Remove totally variable idu_size
> arch/powerpc/platforms/chrp/setup.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/platforms/chrp/setup.c
> b/arch/powerpc/platforms/chrp/setup.c
> index 481ed133e04b..d6d8ffc0271e 100644
> --- a/arch/powerpc/platforms/chrp/setup.c
> +++ b/arch/powerpc/platforms/chrp/setup.c
> @@ -94,7 +94,7 @@ static const char *chrp_names[] = {
> "Total Impact Briq"
> };
>
> -void chrp_show_cpuinfo(struct seq_file *m)
> +static void chrp_show_cpuinfo(struct seq_file *m)
> {
> int i, sdramen;
> unsigned int t;
> @@ -299,7 +299,7 @@ static __init void chrp_init(void)
> of_node_put(node);
> }
>
> -void __init chrp_setup_arch(void)
> +static void __init chrp_setup_arch(void)
> {
> struct device_node *root = of_find_node_by_path("/");
> const char *machine = NULL;
> @@ -382,7 +382,7 @@ static void __init chrp_find_openpic(void)
> {
> struct device_node *np, *root;
> int len, i, j;
> - int isu_size, idu_size;
> + int isu_size;
> const unsigned int *iranges, *opprop = NULL;
> int oplen = 0;
> unsigned long opaddr;
> @@ -427,11 +427,9 @@ static void __init chrp_find_openpic(void)
> }
>
> isu_size = 0;
> - idu_size = 0;
> if (len > 0 && iranges[1] != 0) {
> printk(KERN_INFO "OpenPIC irqs %d..%d in IDU\n",
> iranges[0], iranges[0] + iranges[1] - 1);
> - idu_size = iranges[1];
> }
> if (len > 1)
> isu_size = iranges[3];
> @@ -523,7 +521,7 @@ static void __init chrp_find_8259(void)
> }
> }
>
> -void __init chrp_init_IRQ(void)
> +static void __init chrp_init_IRQ(void)
> {
> #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) &&
> defined(CONFIG_XMON)
> struct device_node *kbd;
> @@ -555,7 +553,7 @@ void __init chrp_init_IRQ(void)
> #endif
> }
>
> -void __init
> +static void __init
> chrp_init2(void)
> {
> #ifdef CONFIG_NVRAM
> --
> 2.11.0



2018-03-29 16:20:51

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v2 04/19] powerpc/kvm: Prefer fault_in_pages_readable function

Mathieu Malaterre <[email protected]> a écrit :

> Directly use fault_in_pages_readable instead of manual __get_user code. Fix
> warning treated as error with W=1:
>
> arch/powerpc/kernel/kvm.c:675:6: error: variable ‘tmp’ set but not
> used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Reviewed-by: Christophe Leroy <[email protected]>

> ---
> v2: use fault_in_pages_readable instead
> arch/powerpc/kernel/kvm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
> index 9ad37f827a97..124c51030b75 100644
> --- a/arch/powerpc/kernel/kvm.c
> +++ b/arch/powerpc/kernel/kvm.c
> @@ -25,6 +25,7 @@
> #include <linux/kvm_para.h>
> #include <linux/slab.h>
> #include <linux/of.h>
> +#include <linux/pagemap.h>
>
> #include <asm/reg.h>
> #include <asm/sections.h>
> @@ -672,14 +673,13 @@ static void kvm_use_magic_page(void)
> {
> u32 *p;
> u32 *start, *end;
> - u32 tmp;
> u32 features;
>
> /* Tell the host to map the magic page to -4096 on all CPUs */
> on_each_cpu(kvm_map_magic_page, &features, 1);
>
> /* Quick self-test to see if the mapping works */
> - if (__get_user(tmp, (u32*)KVM_MAGIC_PAGE)) {
> + if (!fault_in_pages_readable((const char *)KVM_MAGIC_PAGE, sizeof(u32))) {
> kvm_patching_worked = false;
> return;
> }
> --
> 2.11.0



2018-04-04 20:09:37

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v3 01/19] powerpc/powermac: Mark variable x as unused

Since the value of x is never intended to be read, declare it with gcc
attribute as unused. Fix warning treated as error with W=1:

arch/powerpc/platforms/powermac/bootx_init.c:471:21: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v3: style: add missing empty line after declaration
v2: move x variable within its local scope

arch/powerpc/platforms/powermac/bootx_init.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
index c3c9bbb3573a..ba0964c17620 100644
--- a/arch/powerpc/platforms/powermac/bootx_init.c
+++ b/arch/powerpc/platforms/powermac/bootx_init.c
@@ -468,7 +468,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
boot_infos_t *bi = (boot_infos_t *) r4;
unsigned long hdr;
unsigned long space;
- unsigned long ptr, x;
+ unsigned long ptr;
char *model;
unsigned long offset = reloc_offset();

@@ -562,6 +562,8 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
* MMU switched OFF, so this should not be useful anymore.
*/
if (bi->version < 4) {
+ unsigned long x __maybe_unused;
+
bootx_printf("Touching pages...\n");

/*
--
2.11.0


2018-04-04 20:10:38

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v3 03/19] powerpc: Move `path` variable inside DEBUG_PROM

Add gcc attribute unused for two variables. Fix warnings treated as errors
with W=1:

arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v3: really move path within ifdef DEBUG_PROM
v2: move path within ifdef DEBUG_PROM

arch/powerpc/kernel/prom_init.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index acf4b2e0530c..223b35acbbdd 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -603,7 +603,7 @@ static void __init early_cmdline_parse(void)
const char *opt;

char *p;
- int l = 0;
+ int l __maybe_unused = 0;

prom_cmd_line[0] = 0;
p = prom_cmd_line;
@@ -1385,7 +1385,10 @@ static void __init reserve_mem(u64 base, u64 size)
static void __init prom_init_mem(void)
{
phandle node;
- char *path, type[64];
+#ifdef DEBUG_PROM
+ char *path;
+#endif
+ char type[64];
unsigned int plen;
cell_t *p, *endp;
__be32 val;
@@ -1406,7 +1409,9 @@ static void __init prom_init_mem(void)
prom_debug("root_size_cells: %x\n", rsc);

prom_debug("scanning memory:\n");
+#ifdef DEBUG_PROM
path = prom_scratch;
+#endif

for (node = 0; prom_next_node(&node); ) {
type[0] = 0;
--
2.11.0


2018-04-04 20:11:31

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v3 05/19] powerpc/chrp/setup: Remove idu_size variable and make some functions static

Remove variable declaration idu_size and associated code since not used.

These functions can all be static, make it so. Fix warnings treated as
errors with W=1:

arch/powerpc/platforms/chrp/setup.c:97:6: error: no previous prototype for ‘chrp_show_cpuinfo’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/setup.c:302:13: error: no previous prototype for ‘chrp_setup_arch’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/setup.c:385:16: error: variable ‘idu_size’ set but not used [-Werror=unused-but-set-variable]
arch/powerpc/platforms/chrp/setup.c:526:13: error: no previous prototype for ‘chrp_init_IRQ’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/setup.c:559:1: error: no previous prototype for ‘chrp_init2’ [-Werror=missing-prototypes]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v3: update subject line after v2 change
v2: Remove totally variable idu_size
arch/powerpc/platforms/chrp/setup.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 481ed133e04b..d6d8ffc0271e 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -94,7 +94,7 @@ static const char *chrp_names[] = {
"Total Impact Briq"
};

-void chrp_show_cpuinfo(struct seq_file *m)
+static void chrp_show_cpuinfo(struct seq_file *m)
{
int i, sdramen;
unsigned int t;
@@ -299,7 +299,7 @@ static __init void chrp_init(void)
of_node_put(node);
}

-void __init chrp_setup_arch(void)
+static void __init chrp_setup_arch(void)
{
struct device_node *root = of_find_node_by_path("/");
const char *machine = NULL;
@@ -382,7 +382,7 @@ static void __init chrp_find_openpic(void)
{
struct device_node *np, *root;
int len, i, j;
- int isu_size, idu_size;
+ int isu_size;
const unsigned int *iranges, *opprop = NULL;
int oplen = 0;
unsigned long opaddr;
@@ -427,11 +427,9 @@ static void __init chrp_find_openpic(void)
}

isu_size = 0;
- idu_size = 0;
if (len > 0 && iranges[1] != 0) {
printk(KERN_INFO "OpenPIC irqs %d..%d in IDU\n",
iranges[0], iranges[0] + iranges[1] - 1);
- idu_size = iranges[1];
}
if (len > 1)
isu_size = iranges[3];
@@ -523,7 +521,7 @@ static void __init chrp_find_8259(void)
}
}

-void __init chrp_init_IRQ(void)
+static void __init chrp_init_IRQ(void)
{
#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
struct device_node *kbd;
@@ -555,7 +553,7 @@ void __init chrp_init_IRQ(void)
#endif
}

-void __init
+static void __init
chrp_init2(void)
{
#ifdef CONFIG_NVRAM
--
2.11.0


2018-04-04 20:12:02

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v3 19/19] powerpc/tau: Synchronize function prototypes and body

Some function prototypes and body for Thermal Assist Units were not in
sync. Update the function definition to match the existing function
declaration found in `setup-common.c`, changing an `int` return type to a
`u32` return type. Move the prototypes to a header file. Fix the following
warnings, treated as error with W=1:

arch/powerpc/kernel/tau_6xx.c:257:5: error: no previous prototype for ‘cpu_temp_both’ [-Werror=missing-prototypes]
arch/powerpc/kernel/tau_6xx.c:262:5: error: no previous prototype for ‘cpu_temp’ [-Werror=missing-prototypes]
arch/powerpc/kernel/tau_6xx.c:267:5: error: no previous prototype for ‘tau_interrupts’ [-Werror=missing-prototypes]

Compile tested with CONFIG_TAU_INT.

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v3: remove extern keyword
v2: no change
arch/powerpc/kernel/irq.c | 2 +-
arch/powerpc/kernel/setup-common.c | 6 ------
arch/powerpc/kernel/setup.h | 6 ++++++
arch/powerpc/kernel/tau_6xx.c | 7 +++++--
4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 061aa0f47bb1..bbf7ec582d60 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -89,7 +89,7 @@ atomic_t ppc_n_lost_interrupts;

#ifdef CONFIG_TAU_INT
extern int tau_initialized;
-extern int tau_interrupts(int);
+u32 tau_interrupts(unsigned long cpu);
#endif
#endif /* CONFIG_PPC32 */

diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index d73ec518ef80..bd3675c3984b 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -192,12 +192,6 @@ void machine_halt(void)
machine_hang();
}

-
-#ifdef CONFIG_TAU
-extern u32 cpu_temp(unsigned long cpu);
-extern u32 cpu_temp_both(unsigned long cpu);
-#endif /* CONFIG_TAU */
-
#ifdef CONFIG_SMP
DEFINE_PER_CPU(unsigned int, cpu_pvr);
#endif
diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h
index d768023a04bd..76845c925bf5 100644
--- a/arch/powerpc/kernel/setup.h
+++ b/arch/powerpc/kernel/setup.h
@@ -70,4 +70,10 @@ void kvm_cma_reserve(void);
static inline void kvm_cma_reserve(void) { };
#endif

+#ifdef CONFIG_TAU
+u32 cpu_temp(unsigned long cpu);
+u32 cpu_temp_both(unsigned long cpu);
+u32 tau_interrupts(unsigned long cpu);
+#endif /* CONFIG_TAU */
+
#endif /* __ARCH_POWERPC_KERNEL_SETUP_H */
diff --git a/arch/powerpc/kernel/tau_6xx.c b/arch/powerpc/kernel/tau_6xx.c
index 1fc6a89a978e..e2ab8a111b69 100644
--- a/arch/powerpc/kernel/tau_6xx.c
+++ b/arch/powerpc/kernel/tau_6xx.c
@@ -27,6 +27,9 @@
#include <asm/cache.h>
#include <asm/8xx_immap.h>
#include <asm/machdep.h>
+#include <asm/asm-prototypes.h>
+
+#include "setup.h"

static struct tau_temp
{
@@ -259,12 +262,12 @@ u32 cpu_temp_both(unsigned long cpu)
return ((tau[cpu].high << 16) | tau[cpu].low);
}

-int cpu_temp(unsigned long cpu)
+u32 cpu_temp(unsigned long cpu)
{
return ((tau[cpu].high + tau[cpu].low) / 2);
}

-int tau_interrupts(unsigned long cpu)
+u32 tau_interrupts(unsigned long cpu)
{
return (tau[cpu].interrupts);
}
--
2.11.0


2018-04-04 20:13:20

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v3 15/19] powerpc: Add missing prototype

Add one missing prototype for function rh_dump_blk. Fix warning treated as
error in W=1:

arch/powerpc/lib/rheap.c:740:6: error: no previous prototype for ‘rh_dump_blk’ [-Werror=missing-prototypes]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v3: remove extern keyword
v2: no change
arch/powerpc/include/asm/rheap.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/include/asm/rheap.h b/arch/powerpc/include/asm/rheap.h
index 172381769cfc..8e83703d6736 100644
--- a/arch/powerpc/include/asm/rheap.h
+++ b/arch/powerpc/include/asm/rheap.h
@@ -83,6 +83,9 @@ extern int rh_get_stats(rh_info_t * info, int what, int max_stats,
/* Simple dump of remote heap info */
extern void rh_dump(rh_info_t * info);

+/* Simple dump of remote info block */
+void rh_dump_blk(rh_info_t *info, rh_block_t *blk);
+
/* Set owner of taken block */
extern int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner);

--
2.11.0


2018-04-04 20:14:02

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v3 13/19] powerpc/52xx: Add missing functions prototypes

The function prototypes were declared within a `#ifdef CONFIG_PPC_LITE5200`
block which would prevent them from being visible when compiling
`mpc52xx_pm.c`. Move the prototypes outside of the `#ifdef` block to fix
the following warnings treated as errors with W=1:

arch/powerpc/platforms/52xx/mpc52xx_pm.c:58:5: error: no previous prototype for ‘mpc52xx_pm_prepare’ [-Werror=missing-prototypes]
arch/powerpc/platforms/52xx/mpc52xx_pm.c:113:5: error: no previous prototype for ‘mpc52xx_pm_enter’ [-Werror=missing-prototypes]
arch/powerpc/platforms/52xx/mpc52xx_pm.c:181:6: error: no previous prototype for ‘mpc52xx_pm_finish’ [-Werror=missing-prototypes]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v3: remove extern keyword
v2: no change
arch/powerpc/include/asm/mpc52xx.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
index e94cede14522..ce1e0aabaa64 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -350,14 +350,14 @@ extern struct mpc52xx_suspend mpc52xx_suspend;
extern int __init mpc52xx_pm_init(void);
extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level);

-#ifdef CONFIG_PPC_LITE5200
-extern int __init lite5200_pm_init(void);
-
/* lite5200 calls mpc5200 suspend functions, so here they are */
extern int mpc52xx_pm_prepare(void);
extern int mpc52xx_pm_enter(suspend_state_t);
extern void mpc52xx_pm_finish(void);
extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */
+
+#ifdef CONFIG_PPC_LITE5200
+int __init lite5200_pm_init(void);
#endif
#endif /* CONFIG_PM */

--
2.11.0


2018-04-04 20:14:36

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v3 12/19] powerpc/powermac: Add missing prototype for note_bootable_part()

Add a missing prototype for function `note_bootable_part` to silence a
warning treated as error with W=1:

arch/powerpc/platforms/powermac/setup.c:361:12: error: no previous prototype for ‘note_bootable_part’ [-Werror=missing-prototypes]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v3: remove extern keyword
v2: no change
arch/powerpc/platforms/powermac/setup.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index ab668cb72263..8b2eab1340f4 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -352,6 +352,7 @@ static int pmac_late_init(void)
}
machine_late_initcall(powermac, pmac_late_init);

+void note_bootable_part(dev_t dev, int part, int goodness);
/*
* This is __ref because we check for "initializing" before
* touching any of the __init sensitive things and "initializing"
--
2.11.0


2018-04-04 20:15:41

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v3 11/19] powerpc/powermac: Move pmac_pfunc_base_install prototype to header file

The pmac_pfunc_base_install prototype was declared in powermac/smp.c since
function was used there, move it to pmac_pfunc.h header to be visible in
pfunc_base.c. Fix a warning treated as error with W=1:

arch/powerpc/platforms/powermac/pfunc_base.c:330:12: error: no previous prototype for ‘pmac_pfunc_base_install’ [-Werror=missing-prototypes]

Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v3: remove extern keyword
v2: no change
arch/powerpc/include/asm/pmac_pfunc.h | 1 +
arch/powerpc/platforms/powermac/smp.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/pmac_pfunc.h b/arch/powerpc/include/asm/pmac_pfunc.h
index 73bd8f28f2a8..cee4e9f5b8cf 100644
--- a/arch/powerpc/include/asm/pmac_pfunc.h
+++ b/arch/powerpc/include/asm/pmac_pfunc.h
@@ -245,6 +245,7 @@ extern void pmf_put_function(struct pmf_function *func);

extern int pmf_call_one(struct pmf_function *func, struct pmf_args *args);

+int pmac_pfunc_base_install(void);

/* Suspend/resume code called by via-pmu directly for now */
extern void pmac_pfunc_base_suspend(void);
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 95275e0e2efa..447da6db450a 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -65,7 +65,6 @@
#endif

extern void __secondary_start_pmac_0(void);
-extern int pmac_pfunc_base_install(void);

static void (*pmac_tb_freeze)(int freeze);
static u64 timebase;
--
2.11.0


2018-04-04 20:17:50

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v3 09/19] powerpc/chrp/pci: Make some functions static

These functions can all be static, make it so. Fix warnings treated as
errors with W=1:

arch/powerpc/platforms/chrp/pci.c:34:5: error: no previous prototype for ‘gg2_read_config’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/pci.c:61:5: error: no previous prototype for ‘gg2_write_config’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/pci.c:97:5: error: no previous prototype for ‘rtas_read_config’ [-Werror=missing-prototypes]
arch/powerpc/platforms/chrp/pci.c:112:5: error: no previous prototype for ‘rtas_write_config’ [-Werror=missing-prototypes]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
v3: style: fix alignement issue (checkpatch --strict)
v2: no change
arch/powerpc/platforms/chrp/pci.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 0f512d35f7c5..5ddb57b82921 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -31,7 +31,7 @@ void __iomem *gg2_pci_config_base;
* limit the bus number to 3 bits
*/

-int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
+static int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
int len, u32 *val)
{
volatile void __iomem *cfg_data;
@@ -58,7 +58,7 @@ int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
return PCIBIOS_SUCCESSFUL;
}

-int gg2_write_config(struct pci_bus *bus, unsigned int devfn, int off,
+static int gg2_write_config(struct pci_bus *bus, unsigned int devfn, int off,
int len, u32 val)
{
volatile void __iomem *cfg_data;
@@ -94,8 +94,8 @@ static struct pci_ops gg2_pci_ops =
/*
* Access functions for PCI config space using RTAS calls.
*/
-int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
- int len, u32 *val)
+static int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
+ int len, u32 *val)
{
struct pci_controller *hose = pci_bus_to_host(bus);
unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
@@ -109,8 +109,8 @@ int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
}

-int rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
- int len, u32 val)
+static int rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
+ int len, u32 val)
{
struct pci_controller *hose = pci_bus_to_host(bus);
unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
--
2.11.0


2018-04-04 20:20:26

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH 15/19] powerpc: Add missing prototype

On Thu, Mar 29, 2018 at 6:02 PM, LEROY Christophe
<[email protected]> wrote:
> Mathieu Malaterre <[email protected]> a écrit :
>
>
>> On Fri, Mar 23, 2018 at 1:20 PM, christophe leroy
>> <[email protected]> wrote:
>>>
>>>
>>>
>>> Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit :
>>>>
>>>>
>>>> Add one missing prototype for function rh_dump_blk. Fix warning treated
>>>> as
>>>> error in W=1:
>>>>
>>>> arch/powerpc/lib/rheap.c:740:6: error: no previous prototype for
>>>> ‘rh_dump_blk’ [-Werror=missing-prototypes]
>>>>
>>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>>> ---
>>>> arch/powerpc/include/asm/rheap.h | 3 +++
>>>> 1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/arch/powerpc/include/asm/rheap.h
>>>> b/arch/powerpc/include/asm/rheap.h
>>>> index 172381769cfc..e75d96de19a0 100644
>>>> --- a/arch/powerpc/include/asm/rheap.h
>>>> +++ b/arch/powerpc/include/asm/rheap.h
>>>> @@ -83,6 +83,9 @@ extern int rh_get_stats(rh_info_t * info, int what,
>>>> int
>>>> max_stats,
>>>> /* Simple dump of remote heap info */
>>>> extern void rh_dump(rh_info_t * info);
>>>> +/* Simple dump of remote info block */
>>>> +extern void rh_dump_blk(rh_info_t *info, rh_block_t *blk);
>>>> +
>>>
>>>
>>>
>>> Only used in one place, should be static
>>
>>
>> Well here is what I see over here:
>>
>> $ git grep rh_dump_blk
>> ...
>> arch/powerpc/lib/rheap.c:EXPORT_SYMBOL_GPL(rh_dump_blk);
>
>
> If it was really used by anybody in a module, it would already be in a .h so
> I think we should simply delete the function
>

Sent a v3 without the extern keyword. I did not feel bold enough to
remove completely a function. Could one of the maintainers confirm
removal of the function ?

> Christophe
>
>
>>
>>
>>
>>> Christophe
>>>
>>>> /* Set owner of taken block */
>>>> extern int rh_set_owner(rh_info_t * info, unsigned long start, const
>>>> char *owner);
>>>>
>>>
>>>
>>> ---
>>> L'absence de virus dans ce courrier électronique a été vérifiée par le
>>> logiciel antivirus Avast.
>>> https://www.avast.com/antivirus
>>>
>
>

2018-04-04 20:22:50

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH v2 01/19] powerpc/powermac: Mark variable x as unused

On Thu, Mar 29, 2018 at 6:07 PM, LEROY Christophe
<[email protected]> wrote:
> Mathieu Malaterre <[email protected]> a écrit :
>
>
>> Since the value of x is never intended to be read, declare it with gcc
>> attribute as unused. Fix warning treated as error with W=1:
>>
>> arch/powerpc/platforms/powermac/bootx_init.c:471:21: error: variable ‘x’
>> set but not used [-Werror=unused-but-set-variable]
>>
>> Signed-off-by: Mathieu Malaterre <[email protected]>
>> ---
>> v2: move x variable within its local scope
>>
>> arch/powerpc/platforms/powermac/bootx_init.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/platforms/powermac/bootx_init.c
>> b/arch/powerpc/platforms/powermac/bootx_init.c
>> index c3c9bbb3573a..d44e8571c1ec 100644
>> --- a/arch/powerpc/platforms/powermac/bootx_init.c
>> +++ b/arch/powerpc/platforms/powermac/bootx_init.c
>> @@ -468,7 +468,7 @@ void __init bootx_init(unsigned long r3, unsigned long
>> r4)
>> boot_infos_t *bi = (boot_infos_t *) r4;
>> unsigned long hdr;
>> unsigned long space;
>> - unsigned long ptr, x;
>> + unsigned long ptr;
>> char *model;
>> unsigned long offset = reloc_offset();
>>
>> @@ -562,6 +562,7 @@ void __init bootx_init(unsigned long r3, unsigned long
>> r4)
>> * MMU switched OFF, so this should not be useful anymore.
>> */
>> if (bi->version < 4) {
>> + unsigned long x __maybe_unused;
>> bootx_printf("Touching pages...\n");
>
>
> Stylewise, there should be an empty line after your declaration.

See v3

> But I believe you should remove that ugly loop and replace it by a call to
> fault_in_pages_readable()

I have no idea on how to test the the new code, and it did not look
straightforward.

> Christophe
>>
>>
>> /*
>> --
>> 2.11.0
>
>
>

2018-04-05 06:00:16

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH v2 03/19] powerpc: Mark variables as unused

LEROY Christophe <[email protected]> writes:

> Mathieu Malaterre <[email protected]> a écrit :
>
>> Add gcc attribute unused for two variables. Fix warnings treated as errors
>> with W=1:
>>
>> arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set
>> but not used [-Werror=unused-but-set-variable]
>>
>> Suggested-by: Christophe Leroy <[email protected]>
>> Signed-off-by: Mathieu Malaterre <[email protected]>
>> ---
>> v2: move path within ifdef DEBUG_PROM
>>
>> arch/powerpc/kernel/prom_init.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/prom_init.c
>> b/arch/powerpc/kernel/prom_init.c
>> index acf4b2e0530c..4163b11abb6c 100644
>> --- a/arch/powerpc/kernel/prom_init.c
>> +++ b/arch/powerpc/kernel/prom_init.c
>> @@ -603,7 +603,7 @@ static void __init early_cmdline_parse(void)
>> const char *opt;
>>
>> char *p;
>> - int l = 0;
>> + int l __maybe_unused = 0;
>>
>> prom_cmd_line[0] = 0;
>> p = prom_cmd_line;
>> @@ -1385,7 +1385,7 @@ static void __init reserve_mem(u64 base, u64 size)
>> static void __init prom_init_mem(void)
>> {
>> phandle node;
>> - char *path, type[64];
>> + char *path __maybe_unused, type[64];
>
> You should enclose that in an ifdef DEBUG_PROM instead of hiding the warning

I disagree, the result is horrible:

static void __init prom_init_mem(void)
{
phandle node;
- char *path, type[64];
+#ifdef DEBUG_PROM
+ char *path;
+#endif
+ char type[64];
unsigned int plen;
cell_t *p, *endp;
__be32 val;


The right fix is to move the debug logic into a helper, and put the path
in there, eg. something like (not tested):

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index f9d6befb55a6..b02fa2ccc70b 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1389,6 +1389,18 @@ static void __init reserve_mem(u64 base, u64 size)
mem_reserve_cnt = cnt + 1;
}

+#ifdef DEBUG_PROM
+static void prom_debug_path(phandle node)
+{
+ char *path;
+ path = prom_scratch;
+ memset(path, 0, PROM_SCRATCH_SIZE);
+ call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1);
+ prom_debug(" node %s :\n", path);
+}
+#else
+static void prom_debug_path(phandle node) { }
+#endif /* DEBUG_PROM */
/*
* Initialize memory allocation mechanism, parse "memory" nodes and
* obtain that way the top of memory and RMO to setup out local allocator
@@ -1441,11 +1453,7 @@ static void __init prom_init_mem(void)
p = regbuf;
endp = p + (plen / sizeof(cell_t));

-#ifdef DEBUG_PROM
- memset(path, 0, PROM_SCRATCH_SIZE);
- call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1);
- prom_debug(" node %s :\n", path);
-#endif /* DEBUG_PROM */
+ prom_debug_path(node);

while ((endp - p) >= (rac + rsc)) {
unsigned long base, size;


Although that also begs the question of why the hell do we need path at
all, and not just use prom_scratch directly?

cheers

2018-04-05 07:03:17

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v2 03/19] powerpc: Mark variables as unused

Michael Ellerman <[email protected]> a écrit :

> LEROY Christophe <[email protected]> writes:
>
>> Mathieu Malaterre <[email protected]> a écrit :
>>
>>> Add gcc attribute unused for two variables. Fix warnings treated as errors
>>> with W=1:
>>>
>>> arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set
>>> but not used [-Werror=unused-but-set-variable]
>>>
>>> Suggested-by: Christophe Leroy <[email protected]>
>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>> ---
>>> v2: move path within ifdef DEBUG_PROM
>>>
>>> arch/powerpc/kernel/prom_init.c | 6 +++---
>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kernel/prom_init.c
>>> b/arch/powerpc/kernel/prom_init.c
>>> index acf4b2e0530c..4163b11abb6c 100644
>>> --- a/arch/powerpc/kernel/prom_init.c
>>> +++ b/arch/powerpc/kernel/prom_init.c
>>> @@ -603,7 +603,7 @@ static void __init early_cmdline_parse(void)
>>> const char *opt;
>>>
>>> char *p;
>>> - int l = 0;
>>> + int l __maybe_unused = 0;
>>>
>>> prom_cmd_line[0] = 0;
>>> p = prom_cmd_line;
>>> @@ -1385,7 +1385,7 @@ static void __init reserve_mem(u64 base, u64 size)
>>> static void __init prom_init_mem(void)
>>> {
>>> phandle node;
>>> - char *path, type[64];
>>> + char *path __maybe_unused, type[64];
>>
>> You should enclose that in an ifdef DEBUG_PROM instead of hiding the warning
>
> I disagree, the result is horrible:
>
> static void __init prom_init_mem(void)
> {
> phandle node;
> - char *path, type[64];
> +#ifdef DEBUG_PROM
> + char *path;
> +#endif
> + char type[64];
> unsigned int plen;
> cell_t *p, *endp;
> __be32 val;
>
>
> The right fix is to move the debug logic into a helper, and put the path
> in there, eg. something like (not tested):
>
> diff --git a/arch/powerpc/kernel/prom_init.c
> b/arch/powerpc/kernel/prom_init.c
> index f9d6befb55a6..b02fa2ccc70b 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -1389,6 +1389,18 @@ static void __init reserve_mem(u64 base, u64 size)
> mem_reserve_cnt = cnt + 1;
> }
>
> +#ifdef DEBUG_PROM
> +static void prom_debug_path(phandle node)
> +{
> + char *path;
> + path = prom_scratch;
> + memset(path, 0, PROM_SCRATCH_SIZE);
> + call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1);
> + prom_debug(" node %s :\n", path);
> +}
> +#else
> +static void prom_debug_path(phandle node) { }

Or put the ifdef inside the function to avoid double definition ?

> +#endif /* DEBUG_PROM */
> /*
> * Initialize memory allocation mechanism, parse "memory" nodes and
> * obtain that way the top of memory and RMO to setup out local allocator
> @@ -1441,11 +1453,7 @@ static void __init prom_init_mem(void)
> p = regbuf;
> endp = p + (plen / sizeof(cell_t));
>
> -#ifdef DEBUG_PROM
> - memset(path, 0, PROM_SCRATCH_SIZE);
> - call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1);
> - prom_debug(" node %s :\n", path);
> -#endif /* DEBUG_PROM */
> + prom_debug_path(node);
>
> while ((endp - p) >= (rac + rsc)) {
> unsigned long base, size;
>
>
> Although that also begs the question of why the hell do we need path at
> all, and not just use prom_scratch directly?

Wondering the same, why not use prom_scratch directly

Christophe

>
> cheers



2018-04-05 20:28:17

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v4 03/19] powerpc: Mark variable `l` as unused, remove `path`

Add gcc attribute unused for `l` variable, replace `path` variable directly
with prom_scratch. Fix warnings treated as errors with W=1:

arch/powerpc/kernel/prom_init.c:607:6: error: variable ‘l’ set but not used [-Werror=unused-but-set-variable]
arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable]

Suggested-by: Michael Ellerman <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
v4: redo v3 since path variable can be avoided
v3: really move path within ifdef DEBUG_PROM
v2: move path within ifdef DEBUG_PROM

arch/powerpc/kernel/prom_init.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index f8a9a50ff9b5..4b223a9470be 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -604,7 +604,7 @@ static void __init early_cmdline_parse(void)
const char *opt;

char *p;
- int l = 0;
+ int l __maybe_unused = 0;

prom_cmd_line[0] = 0;
p = prom_cmd_line;
@@ -1386,7 +1386,7 @@ static void __init reserve_mem(u64 base, u64 size)
static void __init prom_init_mem(void)
{
phandle node;
- char *path, type[64];
+ char type[64];
unsigned int plen;
cell_t *p, *endp;
__be32 val;
@@ -1407,7 +1407,6 @@ static void __init prom_init_mem(void)
prom_debug("root_size_cells: %x\n", rsc);

prom_debug("scanning memory:\n");
- path = prom_scratch;

for (node = 0; prom_next_node(&node); ) {
type[0] = 0;
@@ -1432,9 +1431,9 @@ static void __init prom_init_mem(void)
endp = p + (plen / sizeof(cell_t));

#ifdef DEBUG_PROM
- memset(path, 0, PROM_SCRATCH_SIZE);
- call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1);
- prom_debug(" node %s :\n", path);
+ memset(prom_scratch, 0, PROM_SCRATCH_SIZE);
+ call_prom("package-to-path", 3, 1, node, prom_scratch, PROM_SCRATCH_SIZE - 1);
+ prom_debug(" node %s :\n", prom_scratch);
#endif /* DEBUG_PROM */

while ((endp - p) >= (rac + rsc)) {
--
2.11.0


2018-04-06 15:35:18

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v4 03/19] powerpc: Mark variable `l` as unused, remove `path`

Mathieu Malaterre <[email protected]> a écrit :

> Add gcc attribute unused for `l` variable, replace `path` variable directly
> with prom_scratch. Fix warnings treated as errors with W=1:
>
> arch/powerpc/kernel/prom_init.c:607:6: error: variable ‘l’ set but
> not used [-Werror=unused-but-set-variable]
> arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set
> but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Michael Ellerman <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> v4: redo v3 since path variable can be avoided
> v3: really move path within ifdef DEBUG_PROM
> v2: move path within ifdef DEBUG_PROM
>
> arch/powerpc/kernel/prom_init.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom_init.c
> b/arch/powerpc/kernel/prom_init.c
> index f8a9a50ff9b5..4b223a9470be 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -604,7 +604,7 @@ static void __init early_cmdline_parse(void)
> const char *opt;
>
> char *p;
> - int l = 0;
> + int l __maybe_unused = 0;

Instead of hiding the problem with __maybe_unused, I think we could
replace the
#ifdef CONFIG_CMDLINE
by a
if (IS_ENABLED(CONFIG_CMDLINE_BOOL))

This is recommanded by Linux codying style

Christophe

>
> prom_cmd_line[0] = 0;
> p = prom_cmd_line;
> @@ -1386,7 +1386,7 @@ static void __init reserve_mem(u64 base, u64 size)
> static void __init prom_init_mem(void)
> {
> phandle node;
> - char *path, type[64];
> + char type[64];
> unsigned int plen;
> cell_t *p, *endp;
> __be32 val;
> @@ -1407,7 +1407,6 @@ static void __init prom_init_mem(void)
> prom_debug("root_size_cells: %x\n", rsc);
>
> prom_debug("scanning memory:\n");
> - path = prom_scratch;
>
> for (node = 0; prom_next_node(&node); ) {
> type[0] = 0;
> @@ -1432,9 +1431,9 @@ static void __init prom_init_mem(void)
> endp = p + (plen / sizeof(cell_t));
>
> #ifdef DEBUG_PROM
> - memset(path, 0, PROM_SCRATCH_SIZE);
> - call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1);
> - prom_debug(" node %s :\n", path);
> + memset(prom_scratch, 0, PROM_SCRATCH_SIZE);
> + call_prom("package-to-path", 3, 1, node, prom_scratch,
> PROM_SCRATCH_SIZE - 1);
> + prom_debug(" node %s :\n", prom_scratch);
> #endif /* DEBUG_PROM */
>
> while ((endp - p) >= (rac + rsc)) {
> --
> 2.11.0



2018-04-06 18:37:23

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH v4 03/19] powerpc: Mark variable `l` as unused, remove `path`

On Fri, Apr 6, 2018 at 5:33 PM, LEROY Christophe
<[email protected]> wrote:
> Mathieu Malaterre <[email protected]> a écrit :
>
>> Add gcc attribute unused for `l` variable, replace `path` variable
>> directly
>> with prom_scratch. Fix warnings treated as errors with W=1:
>>
>> arch/powerpc/kernel/prom_init.c:607:6: error: variable ‘l’ set but not
>> used [-Werror=unused-but-set-variable]
>> arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but
>> not used [-Werror=unused-but-set-variable]
>>
>> Suggested-by: Michael Ellerman <[email protected]>
>> Signed-off-by: Mathieu Malaterre <[email protected]>
>> ---
>> v4: redo v3 since path variable can be avoided
>> v3: really move path within ifdef DEBUG_PROM
>> v2: move path within ifdef DEBUG_PROM
>>
>> arch/powerpc/kernel/prom_init.c | 11 +++++------
>> 1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/prom_init.c
>> b/arch/powerpc/kernel/prom_init.c
>> index f8a9a50ff9b5..4b223a9470be 100644
>> --- a/arch/powerpc/kernel/prom_init.c
>> +++ b/arch/powerpc/kernel/prom_init.c
>> @@ -604,7 +604,7 @@ static void __init early_cmdline_parse(void)
>> const char *opt;
>>
>> char *p;
>> - int l = 0;
>> + int l __maybe_unused = 0;
>
>
> Instead of hiding the problem with __maybe_unused, I think we could replace
> the
> #ifdef CONFIG_CMDLINE
> by a
> if (IS_ENABLED(CONFIG_CMDLINE_BOOL))
>
> This is recommanded by Linux codying style

Neat. I was not aware of this trick. Does not work in this case though:

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 7925f64fefde..19634739b279 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -604,17 +604,16 @@ static void __init early_cmdline_parse(void)
const char *opt;

char *p;
- int l __maybe_unused = 0;
+ int l = 0;

prom_cmd_line[0] = 0;
p = prom_cmd_line;
if ((long)prom.chosen > 0)
l = prom_getprop(prom.chosen, "bootargs", p,
COMMAND_LINE_SIZE-1);
-#ifdef CONFIG_CMDLINE
- if (l <= 0 || p[0] == '\0') /* dbl check */
- strlcpy(prom_cmd_line,
- CONFIG_CMDLINE, sizeof(prom_cmd_line));
-#endif /* CONFIG_CMDLINE */
+ if (IS_ENABLED(CONFIG_CMDLINE_BOOL))
+ if (l <= 0 || p[0] == '\0') /* dbl check */
+ strlcpy(prom_cmd_line,
+ CONFIG_CMDLINE, sizeof(prom_cmd_line));
prom_printf("command line: %s\n", prom_cmd_line);

#ifdef CONFIG_PPC64


leads to:

CC arch/powerpc/kernel/prom_init.o
../arch/powerpc/kernel/prom_init.c: In function ‘early_cmdline_parse’:
../arch/powerpc/kernel/prom_init.c:616:5: error: ‘CONFIG_CMDLINE’
undeclared (first use in this function)
CONFIG_CMDLINE, sizeof(prom_cmd_line));
^~~~~~~~~~~~~~
../arch/powerpc/kernel/prom_init.c:616:5: note: each undeclared
identifier is reported only once for each function it appears in
../scripts/Makefile.build:312: recipe for target
'arch/powerpc/kernel/prom_init.o' failed
make[6]: *** [arch/powerpc/kernel/prom_init.o] Error 1


> Christophe
>
>
>>
>> prom_cmd_line[0] = 0;
>> p = prom_cmd_line;
>> @@ -1386,7 +1386,7 @@ static void __init reserve_mem(u64 base, u64 size)
>> static void __init prom_init_mem(void)
>> {
>> phandle node;
>> - char *path, type[64];
>> + char type[64];
>> unsigned int plen;
>> cell_t *p, *endp;
>> __be32 val;
>> @@ -1407,7 +1407,6 @@ static void __init prom_init_mem(void)
>> prom_debug("root_size_cells: %x\n", rsc);
>>
>> prom_debug("scanning memory:\n");
>> - path = prom_scratch;
>>
>> for (node = 0; prom_next_node(&node); ) {
>> type[0] = 0;
>> @@ -1432,9 +1431,9 @@ static void __init prom_init_mem(void)
>> endp = p + (plen / sizeof(cell_t));
>>
>> #ifdef DEBUG_PROM
>> - memset(path, 0, PROM_SCRATCH_SIZE);
>> - call_prom("package-to-path", 3, 1, node, path,
>> PROM_SCRATCH_SIZE-1);
>> - prom_debug(" node %s :\n", path);
>> + memset(prom_scratch, 0, PROM_SCRATCH_SIZE);
>> + call_prom("package-to-path", 3, 1, node, prom_scratch,
>> PROM_SCRATCH_SIZE - 1);
>> + prom_debug(" node %s :\n", prom_scratch);
>> #endif /* DEBUG_PROM */
>>
>> while ((endp - p) >= (rac + rsc)) {
>> --
>> 2.11.0
>
>
>

2018-04-24 14:15:46

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v3 01/19] powerpc/powermac: Mark variable x as unused



Le 04/04/2018 à 22:07, Mathieu Malaterre a écrit :
> Since the value of x is never intended to be read, declare it with gcc
> attribute as unused. Fix warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/bootx_init.c:471:21: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> v3: style: add missing empty line after declaration
> v2: move x variable within its local scope
>
> arch/powerpc/platforms/powermac/bootx_init.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
> index c3c9bbb3573a..ba0964c17620 100644
> --- a/arch/powerpc/platforms/powermac/bootx_init.c
> +++ b/arch/powerpc/platforms/powermac/bootx_init.c
> @@ -468,7 +468,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
> boot_infos_t *bi = (boot_infos_t *) r4;
> unsigned long hdr;
> unsigned long space;
> - unsigned long ptr, x;
> + unsigned long ptr;
> char *model;
> unsigned long offset = reloc_offset();
>
> @@ -562,6 +562,8 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
> * MMU switched OFF, so this should not be useful anymore.
> */
> if (bi->version < 4) {
> + unsigned long x __maybe_unused;
> +

That's detail, but shouldn't it be marked __always_unused instead ?

Christophe

> bootx_printf("Touching pages...\n");
>
> /*
>

2018-04-24 19:22:13

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v4 03/19] powerpc: Mark variable `l` as unused, remove `path`



Le 06/04/2018 à 20:32, Mathieu Malaterre a écrit :
> On Fri, Apr 6, 2018 at 5:33 PM, LEROY Christophe
> <[email protected]> wrote:
>> Mathieu Malaterre <[email protected]> a écrit :
>>
>>> Add gcc attribute unused for `l` variable, replace `path` variable
>>> directly
>>> with prom_scratch. Fix warnings treated as errors with W=1:
>>>
>>> arch/powerpc/kernel/prom_init.c:607:6: error: variable ‘l’ set but not
>>> used [-Werror=unused-but-set-variable]
>>> arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but
>>> not used [-Werror=unused-but-set-variable]
>>>
>>> Suggested-by: Michael Ellerman <[email protected]>
>>> Signed-off-by: Mathieu Malaterre <[email protected]>
>>> ---
>>> v4: redo v3 since path variable can be avoided
>>> v3: really move path within ifdef DEBUG_PROM
>>> v2: move path within ifdef DEBUG_PROM
>>>
>>> arch/powerpc/kernel/prom_init.c | 11 +++++------
>>> 1 file changed, 5 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kernel/prom_init.c
>>> b/arch/powerpc/kernel/prom_init.c
>>> index f8a9a50ff9b5..4b223a9470be 100644
>>> --- a/arch/powerpc/kernel/prom_init.c
>>> +++ b/arch/powerpc/kernel/prom_init.c
>>> @@ -604,7 +604,7 @@ static void __init early_cmdline_parse(void)
>>> const char *opt;
>>>
>>> char *p;
>>> - int l = 0;
>>> + int l __maybe_unused = 0;
>>
>>
>> Instead of hiding the problem with __maybe_unused, I think we could replace
>> the
>> #ifdef CONFIG_CMDLINE
>> by a
>> if (IS_ENABLED(CONFIG_CMDLINE_BOOL))
>>
>> This is recommanded by Linux codying style
>
> Neat. I was not aware of this trick. Does not work in this case though:
>
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 7925f64fefde..19634739b279 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -604,17 +604,16 @@ static void __init early_cmdline_parse(void)
> const char *opt;
>
> char *p;
> - int l __maybe_unused = 0;
> + int l = 0;
>
> prom_cmd_line[0] = 0;
> p = prom_cmd_line;
> if ((long)prom.chosen > 0)
> l = prom_getprop(prom.chosen, "bootargs", p,
> COMMAND_LINE_SIZE-1);
> -#ifdef CONFIG_CMDLINE
> - if (l <= 0 || p[0] == '\0') /* dbl check */
> - strlcpy(prom_cmd_line,
> - CONFIG_CMDLINE, sizeof(prom_cmd_line));
> -#endif /* CONFIG_CMDLINE */
> + if (IS_ENABLED(CONFIG_CMDLINE_BOOL))
> + if (l <= 0 || p[0] == '\0') /* dbl check */
> + strlcpy(prom_cmd_line,
> + CONFIG_CMDLINE, sizeof(prom_cmd_line));
> prom_printf("command line: %s\n", prom_cmd_line);
>
> #ifdef CONFIG_PPC64
>
>
> leads to:
>
> CC arch/powerpc/kernel/prom_init.o
> ../arch/powerpc/kernel/prom_init.c: In function ‘early_cmdline_parse’:
> ../arch/powerpc/kernel/prom_init.c:616:5: error: ‘CONFIG_CMDLINE’
> undeclared (first use in this function)
> CONFIG_CMDLINE, sizeof(prom_cmd_line));
> ^~~~~~~~~~~~~~
> ../arch/powerpc/kernel/prom_init.c:616:5: note: each undeclared
> identifier is reported only once for each function it appears in
> ../scripts/Makefile.build:312: recipe for target
> 'arch/powerpc/kernel/prom_init.o' failed
> make[6]: *** [arch/powerpc/kernel/prom_init.o] Error 1

And what about something like :


+ if (l <= 0 || p[0] == '\0') { /* dbl check */
#ifdef CONFIG_CMDLINE
- if (l <= 0 || p[0] == '\0') /* dbl check */
strlcpy(prom_cmd_line,
CONFIG_CMDLINE, sizeof(prom_cmd_line));
#endif /* CONFIG_CMDLINE */
+}
prom_printf("command line: %s\n", prom_cmd_line);

Christophe


>
>
>> Christophe
>>
>>
>>>
>>> prom_cmd_line[0] = 0;
>>> p = prom_cmd_line;
>>> @@ -1386,7 +1386,7 @@ static void __init reserve_mem(u64 base, u64 size)
>>> static void __init prom_init_mem(void)
>>> {
>>> phandle node;
>>> - char *path, type[64];
>>> + char type[64];
>>> unsigned int plen;
>>> cell_t *p, *endp;
>>> __be32 val;
>>> @@ -1407,7 +1407,6 @@ static void __init prom_init_mem(void)
>>> prom_debug("root_size_cells: %x\n", rsc);
>>>
>>> prom_debug("scanning memory:\n");
>>> - path = prom_scratch;
>>>
>>> for (node = 0; prom_next_node(&node); ) {
>>> type[0] = 0;
>>> @@ -1432,9 +1431,9 @@ static void __init prom_init_mem(void)
>>> endp = p + (plen / sizeof(cell_t));
>>>
>>> #ifdef DEBUG_PROM
>>> - memset(path, 0, PROM_SCRATCH_SIZE);
>>> - call_prom("package-to-path", 3, 1, node, path,
>>> PROM_SCRATCH_SIZE-1);
>>> - prom_debug(" node %s :\n", path);
>>> + memset(prom_scratch, 0, PROM_SCRATCH_SIZE);
>>> + call_prom("package-to-path", 3, 1, node, prom_scratch,
>>> PROM_SCRATCH_SIZE - 1);
>>> + prom_debug(" node %s :\n", prom_scratch);
>>> #endif /* DEBUG_PROM */
>>>
>>> while ((endp - p) >= (rac + rsc)) {
>>> --
>>> 2.11.0
>>
>>
>>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


2018-05-22 06:29:37

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH 00/19] powerpc/ppc32: make W=1 compilation errors free

Any chance this could be applied to powerpc/next ?

On Thu, Mar 22, 2018 at 9:19 PM, Mathieu Malaterre <[email protected]> wrote:
> Here is another batch for warnings treated as error on ppc32. Tested with:
>
> $ make ARCH=powerpc ppc32_defconfig
> $ make -j8 ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- W=1
>
> Using:
>
> $ powerpc-linux-gnu-gcc --version
> powerpc-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516
>
> Mathieu Malaterre (19):
> powerpc/powermac: Mark variable x as unused
> powerpc/powermac: Mark variable x as unused
> powerpc: Mark variables as unused
> powerpc/kvm: Mark variable tmp unused
> powerpc/chrp/setup: Add attribute unused and make some functions
> static
> powerpc: Make function btext_initialize static
> powerpc/powermac: Make some functions static
> powerpc/tau: Make some function static
> powerpc/chrp/pci: Make some functions static
> powerpc/chrp/time: Make some functions static, add missing header
> include
> powerpc/powermac: Move pmac_pfunc_base_install prototype to header
> file
> powerpc/powermac: Add missing prototype for note_bootable_part()
> powerpc/52xx: Add missing functions prototypes
> powerpc/altivec: Add missing prototypes for altivec
> powerpc: Add missing prototype
> powerpc/powermac: Add missing include of header pmac.h
> powerpc/32: Add a missing include header
> powerpc: Add a missing include header
> powerpc/tau: Synchronize function prototypes and body
>
> arch/powerpc/include/asm/mpc52xx.h | 6 +++---
> arch/powerpc/include/asm/pmac_pfunc.h | 1 +
> arch/powerpc/include/asm/rheap.h | 3 +++
> arch/powerpc/kernel/btext.c | 2 +-
> arch/powerpc/kernel/irq.c | 2 +-
> arch/powerpc/kernel/kvm.c | 2 +-
> arch/powerpc/kernel/pci_32.c | 1 +
> arch/powerpc/kernel/prom_init.c | 4 ++--
> arch/powerpc/kernel/setup-common.c | 6 ------
> arch/powerpc/kernel/setup.h | 6 ++++++
> arch/powerpc/kernel/tau_6xx.c | 15 +++++++++------
> arch/powerpc/kernel/vecemu.c | 1 +
> arch/powerpc/lib/xor_vmx.h | 14 ++++++++++++++
> arch/powerpc/platforms/chrp/pci.c | 8 ++++----
> arch/powerpc/platforms/chrp/setup.c | 10 +++++-----
> arch/powerpc/platforms/chrp/time.c | 6 ++++--
> arch/powerpc/platforms/powermac/bootx_init.c | 2 +-
> arch/powerpc/platforms/powermac/pci.c | 10 +++++-----
> arch/powerpc/platforms/powermac/setup.c | 1 +
> arch/powerpc/platforms/powermac/smp.c | 1 -
> arch/powerpc/platforms/powermac/time.c | 4 +++-
> arch/powerpc/platforms/powermac/udbg_scc.c | 2 +-
> 22 files changed, 67 insertions(+), 40 deletions(-)
>
> --
> 2.11.0
>

2018-05-25 02:51:14

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v2,04/19] powerpc/kvm: Prefer fault_in_pages_readable function

On Wed, 2018-03-28 at 19:58:11 UTC, Mathieu Malaterre wrote:
> Directly use fault_in_pages_readable instead of manual __get_user code. Fix
> warning treated as error with W=1:
>
> arch/powerpc/kernel/kvm.c:675:6: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> Reviewed-by: Christophe Leroy <[email protected]>

Applied to powerpc topic/ppc-kvm, thanks.

https://git.kernel.org/powerpc/c/9f9eae5ce717f497812dfc1bda5219

cheers

2018-05-25 11:45:54

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v3,19/19] powerpc/tau: Synchronize function prototypes and body

On Wed, 2018-04-04 at 20:10:28 UTC, Mathieu Malaterre wrote:
> Some function prototypes and body for Thermal Assist Units were not in
> sync. Update the function definition to match the existing function
> declaration found in `setup-common.c`, changing an `int` return type to a
> `u32` return type. Move the prototypes to a header file. Fix the following
> warnings, treated as error with W=1:
>
> arch/powerpc/kernel/tau_6xx.c:257:5: error: no previous prototype for ‘cpu_temp_both’ [-Werror=missing-prototypes]
> arch/powerpc/kernel/tau_6xx.c:262:5: error: no previous prototype for ‘cpu_temp’ [-Werror=missing-prototypes]
> arch/powerpc/kernel/tau_6xx.c:267:5: error: no previous prototype for ‘tau_interrupts’ [-Werror=missing-prototypes]
>
> Compile tested with CONFIG_TAU_INT.
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/bd13ac95f954570e01fba5a6caf771

cheers

2018-05-25 11:46:03

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v3, 12/19] powerpc/powermac: Add missing prototype for note_bootable_part()

On Wed, 2018-04-04 at 20:13:05 UTC, Mathieu Malaterre wrote:
> Add a missing prototype for function `note_bootable_part` to silence a
> warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/setup.c:361:12: error: no previous prototype for ‘note_bootable_part’ [-Werror=missing-prototypes]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/f72cf3f1d49f2c35d6cb682af2e8c9

cheers

2018-05-25 11:46:12

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v3] powerpc/altivec: Add missing prototypes for altivec

On Wed, 2018-03-28 at 18:55:25 UTC, Mathieu Malaterre wrote:
> Some functions prototypes were missing for the non-altivec code. Add the
> missing prototypes in a new header file, fix warnings treated as errors
> with W=1:
>
> arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype for ‘xor_altivec_2’ [-Werror=missing-prototypes]
> arch/powerpc/lib/xor_vmx_glue.c:29:6: error: no previous prototype for ‘xor_altivec_3’ [-Werror=missing-prototypes]
> arch/powerpc/lib/xor_vmx_glue.c:40:6: error: no previous prototype for ‘xor_altivec_4’ [-Werror=missing-prototypes]
> arch/powerpc/lib/xor_vmx_glue.c:52:6: error: no previous prototype for ‘xor_altivec_5’ [-Werror=missing-prototypes]
>
> The prototypes were already present in <asm/xor.h> but this header file is
> meant to be included after <include/linux/raid/xor.h>. Trying to re-use
> <asm/xor.h> directly would lead to warnings such as:
>
> arch/powerpc/include/asm/xor.h:39:15: error: variable ‘xor_block_altivec’ has initializer but incomplete type
>
> Trying to re-use <asm/xor.h> after <include/linux/raid/xor.h> in
> xor_vmx_glue.c would in turn trigger the following warnings:
>
> include/asm-generic/xor.h:688:34: error: ‘xor_block_32regs’ defined but not used [-Werror=unused-variable]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/7cf76a68f1bcf69214da2812e8f615

cheers

2018-05-25 11:46:31

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v3,09/19] powerpc/chrp/pci: Make some functions static

On Wed, 2018-04-04 at 20:15:03 UTC, Mathieu Malaterre wrote:
> These functions can all be static, make it so. Fix warnings treated as
> errors with W=1:
>
> arch/powerpc/platforms/chrp/pci.c:34:5: error: no previous prototype for ‘gg2_read_config’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/pci.c:61:5: error: no previous prototype for ‘gg2_write_config’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/pci.c:97:5: error: no previous prototype for ‘rtas_read_config’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/pci.c:112:5: error: no previous prototype for ‘rtas_write_config’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/910be6be6c00e6d33d47985586c392

cheers

2018-05-25 11:46:33

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v3, 11/19] powerpc/powermac: Move pmac_pfunc_base_install prototype to header file

On Wed, 2018-04-04 at 20:13:55 UTC, Mathieu Malaterre wrote:
> The pmac_pfunc_base_install prototype was declared in powermac/smp.c since
> function was used there, move it to pmac_pfunc.h header to be visible in
> pfunc_base.c. Fix a warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/pfunc_base.c:330:12: error: no previous prototype for ‘pmac_pfunc_base_install’ [-Werror=missing-prototypes]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/f91d5998996819eaf194ff48e00d49

cheers

2018-05-25 11:47:03

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v3,13/19] powerpc/52xx: Add missing functions prototypes

On Wed, 2018-04-04 at 20:12:30 UTC, Mathieu Malaterre wrote:
> The function prototypes were declared within a `#ifdef CONFIG_PPC_LITE5200`
> block which would prevent them from being visible when compiling
> `mpc52xx_pm.c`. Move the prototypes outside of the `#ifdef` block to fix
> the following warnings treated as errors with W=1:
>
> arch/powerpc/platforms/52xx/mpc52xx_pm.c:58:5: error: no previous prototype for ‘mpc52xx_pm_prepare’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/52xx/mpc52xx_pm.c:113:5: error: no previous prototype for ‘mpc52xx_pm_enter’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/52xx/mpc52xx_pm.c:181:6: error: no previous prototype for ‘mpc52xx_pm_finish’ [-Werror=missing-prototypes]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/c3f0515ea1277558e7c0c3240d17c7

cheers

2018-05-25 11:47:04

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v3,15/19] powerpc: Add missing prototype

On Wed, 2018-04-04 at 20:11:42 UTC, Mathieu Malaterre wrote:
> Add one missing prototype for function rh_dump_blk. Fix warning treated as
> error in W=1:
>
> arch/powerpc/lib/rheap.c:740:6: error: no previous prototype for ‘rh_dump_blk’ [-Werror=missing-prototypes]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/3fc5ee9b2846db2eaddeadf089ef25

cheers

2018-05-25 11:47:17

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v3,01/19] powerpc/powermac: Mark variable x as unused

On Wed, 2018-04-04 at 20:07:46 UTC, Mathieu Malaterre wrote:
> Since the value of x is never intended to be read, declare it with gcc
> attribute as unused. Fix warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/bootx_init.c:471:21: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/5a4b475cf8511da721f20ba432c244

cheers

2018-05-25 11:47:46

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v3, 05/19] powerpc/chrp/setup: Remove idu_size variable and make some functions static

On Wed, 2018-04-04 at 20:09:11 UTC, Mathieu Malaterre wrote:
> Remove variable declaration idu_size and associated code since not used.
>
> These functions can all be static, make it so. Fix warnings treated as
> errors with W=1:
>
> arch/powerpc/platforms/chrp/setup.c:97:6: error: no previous prototype for ‘chrp_show_cpuinfo’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/setup.c:302:13: error: no previous prototype for ‘chrp_setup_arch’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/setup.c:385:16: error: variable ‘idu_size’ set but not used [-Werror=unused-but-set-variable]
> arch/powerpc/platforms/chrp/setup.c:526:13: error: no previous prototype for ‘chrp_init_IRQ’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/setup.c:559:1: error: no previous prototype for ‘chrp_init2’ [-Werror=missing-prototypes]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/f0e0b86638e9df6731b1d61c71ae18

cheers

2018-05-25 11:48:07

by Michael Ellerman

[permalink] [raw]
Subject: Re: [08/19] powerpc/tau: Make some function static

On Thu, 2018-03-22 at 20:19:54 UTC, Mathieu Malaterre wrote:
> These functions can all be static, make it so. Fix warnings treated as
> errors with W=1:
>
> arch/powerpc/kernel/tau_6xx.c:53:6: error: no previous prototype for ‘set_thresholds’ [-Werror=missing-prototypes]
> arch/powerpc/kernel/tau_6xx.c:73:6: error: no previous prototype for ‘TAUupdate’ [-Werror=missing-prototypes]
> arch/powerpc/kernel/tau_6xx.c:208:13: error: no previous prototype for ‘TAU_init_smp’ [-Werror=missing-prototypes]
> arch/powerpc/kernel/tau_6xx.c:220:12: error: no previous prototype for ‘TAU_init’ [-Werror=missing-prototypes]
> arch/powerpc/kernel/tau_6xx.c:126:6: error: no previous prototype for ‘TAUException’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/9e0d86cd2d749998c3792059221cef

cheers

2018-05-25 11:48:11

by Michael Ellerman

[permalink] [raw]
Subject: Re: [17/19] powerpc/32: Add a missing include header

On Thu, 2018-03-22 at 20:20:03 UTC, Mathieu Malaterre wrote:
> The header file <linux/syscalls.h> was missing from the includes. Fix the
> following warning, treated as error with W=1:
>
> arch/powerpc/kernel/pci_32.c:286:6: error: no previous prototype for ‘sys_pciconfig_iobase’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/c89ca593220931c150cffda24b4d4c

cheers

2018-05-25 11:48:18

by Michael Ellerman

[permalink] [raw]
Subject: Re: [06/19] powerpc: Make function btext_initialize static

On Thu, 2018-03-22 at 20:19:52 UTC, Mathieu Malaterre wrote:
> This function can be static, make it so, this fix a warning treated as
> error with W=1:
>
> arch/powerpc/kernel/btext.c:173:5: error: no previous prototype for ‘btext_initialize’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/86e11b6e9c56e605475462bf9ba7c1

cheers

2018-05-25 11:48:21

by Michael Ellerman

[permalink] [raw]
Subject: Re: [10/19] powerpc/chrp/time: Make some functions static, add missing header include

On Thu, 2018-03-22 at 20:19:56 UTC, Mathieu Malaterre wrote:
> Add a missing include <platforms/chrp/chrp.h>.
>
> These functions can all be static, make it so. Fix warnings treated as
> errors with W=1:
>
> arch/powerpc/platforms/chrp/time.c:41:13: error: no previous prototype for ‘chrp_time_init’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/time.c:66:5: error: no previous prototype for ‘chrp_cmos_clock_read’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/time.c:74:6: error: no previous prototype for ‘chrp_cmos_clock_write’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/time.c:86:5: error: no previous prototype for ‘chrp_set_rtc_time’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/chrp/time.c:130:6: error: no previous prototype for ‘chrp_get_rtc_time’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/b87a358b4a1421abd544c0b554b1b7

cheers

2018-05-25 11:48:52

by Michael Ellerman

[permalink] [raw]
Subject: Re: [18/19] powerpc: Add a missing include header

On Thu, 2018-03-22 at 20:20:04 UTC, Mathieu Malaterre wrote:
> The header file <asm/switch_to.h> was missing from the includes. Fix the
> following warning, treated as error with W=1:
>
> arch/powerpc/kernel/vecemu.c:260:5: error: no previous prototype for ‘emulate_altivec’ [-Werror=missing-prototypes]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/d647b210ac738b401c7f824bbebdcb

cheers

2018-06-22 09:47:32

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH v2 02/19] powerpc/powermac: Mark variable x as unused

On Thu, Mar 29, 2018 at 6:09 PM LEROY Christophe
<[email protected]> wrote:
>
> Mathieu Malaterre <[email protected]> a écrit :
>
> > Since the value of x is never intended to be read, remove it. Fix warning
> > treated as error with W=1:
> >
> > arch/powerpc/platforms/powermac/udbg_scc.c:76:9: error: variable
> > ‘x’ set but not used [-Werror=unused-but-set-variable]
> >
> > Suggested-by: Christophe Leroy <[email protected]>
> > Signed-off-by: Mathieu Malaterre <[email protected]>
>
> Reviewed-by: Christophe Leroy <[email protected]>

Michael, can you take this one ?

> > ---
> > v2: remove x completely
> >
> > arch/powerpc/platforms/powermac/udbg_scc.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c
> > b/arch/powerpc/platforms/powermac/udbg_scc.c
> > index d83135a9830e..8901973ed683 100644
> > --- a/arch/powerpc/platforms/powermac/udbg_scc.c
> > +++ b/arch/powerpc/platforms/powermac/udbg_scc.c
> > @@ -73,7 +73,7 @@ void udbg_scc_init(int force_scc)
> > struct device_node *stdout = NULL, *escc = NULL, *macio = NULL;
> > struct device_node *ch, *ch_def = NULL, *ch_a = NULL;
> > const char *path;
> > - int i, x;
> > + int i;
> >
> > escc = of_find_node_by_name(NULL, "escc");
> > if (escc == NULL)
> > @@ -120,7 +120,7 @@ void udbg_scc_init(int force_scc)
> > mb();
> >
> > for (i = 20000; i != 0; --i)
> > - x = in_8(sccc);
> > + in_8(sccc);
> > out_8(sccc, 0x09); /* reset A or B side */
> > out_8(sccc, 0xc0);
> >
> > --
> > 2.11.0
>
>

2018-06-22 09:51:07

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH v3 03/19] powerpc: Move `path` variable inside DEBUG_PROM

This one should be ok.

On Wed, Apr 4, 2018 at 10:08 PM Mathieu Malaterre <[email protected]> wrote:
>
> Add gcc attribute unused for two variables. Fix warnings treated as errors
> with W=1:
>
> arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> v3: really move path within ifdef DEBUG_PROM
> v2: move path within ifdef DEBUG_PROM
>
> arch/powerpc/kernel/prom_init.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index acf4b2e0530c..223b35acbbdd 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -603,7 +603,7 @@ static void __init early_cmdline_parse(void)
> const char *opt;
>
> char *p;
> - int l = 0;
> + int l __maybe_unused = 0;
>
> prom_cmd_line[0] = 0;
> p = prom_cmd_line;
> @@ -1385,7 +1385,10 @@ static void __init reserve_mem(u64 base, u64 size)
> static void __init prom_init_mem(void)
> {
> phandle node;
> - char *path, type[64];
> +#ifdef DEBUG_PROM
> + char *path;
> +#endif
> + char type[64];
> unsigned int plen;
> cell_t *p, *endp;
> __be32 val;
> @@ -1406,7 +1409,9 @@ static void __init prom_init_mem(void)
> prom_debug("root_size_cells: %x\n", rsc);
>
> prom_debug("scanning memory:\n");
> +#ifdef DEBUG_PROM
> path = prom_scratch;
> +#endif
>
> for (node = 0; prom_next_node(&node); ) {
> type[0] = 0;
> --
> 2.11.0
>

2018-06-22 09:51:16

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH 16/19] powerpc/powermac: Add missing include of header pmac.h

This one is also ok.

On Thu, Mar 22, 2018 at 9:21 PM Mathieu Malaterre <[email protected]> wrote:
>
> The header `pmac.h` was not included, leading to the following warnings,
> treated as error with W=1:
>
> arch/powerpc/platforms/powermac/time.c:69:13: error: no previous prototype for ‘pmac_time_init’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/time.c:207:15: error: no previous prototype for ‘pmac_get_boot_time’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/time.c:222:6: error: no previous prototype for ‘pmac_get_rtc_time’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/time.c:240:5: error: no previous prototype for ‘pmac_set_rtc_time’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/time.c:259:12: error: no previous prototype for ‘via_calibrate_decr’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/time.c:311:13: error: no previous prototype for ‘pmac_calibrate_decr’ [-Werror=missing-prototypes]
>
> The function `via_calibrate_decr` was made static to silence a warning.
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> arch/powerpc/platforms/powermac/time.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
> index 274af6fa388e..5cc6fa40fcc4 100644
> --- a/arch/powerpc/platforms/powermac/time.c
> +++ b/arch/powerpc/platforms/powermac/time.c
> @@ -34,6 +34,8 @@
> #include <asm/nvram.h>
> #include <asm/smu.h>
>
> +#include "pmac.h"
> +
> #undef DEBUG
>
> #ifdef DEBUG
> @@ -256,7 +258,7 @@ int pmac_set_rtc_time(struct rtc_time *tm)
> * Calibrate the decrementer register using VIA timer 1.
> * This is used both on powermacs and CHRP machines.
> */
> -int __init via_calibrate_decr(void)
> +static int __init via_calibrate_decr(void)
> {
> struct device_node *vias;
> volatile unsigned char __iomem *via;
> --
> 2.11.0
>

2018-06-22 11:30:10

by Mathieu Malaterre

[permalink] [raw]
Subject: Re: [PATCH v2 07/19] powerpc/powermac: Make some functions static

This one should also be good to go.

On Wed, Mar 28, 2018 at 9:39 PM Mathieu Malaterre <[email protected]> wrote:
>
> These functions can all be static, make it so. Fix warnings treated as
> errors with W=1:
>
> arch/powerpc/platforms/powermac/pci.c:1022:6: error: no previous prototype for ‘pmac_pci_fixup_ohci’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/pci.c:1057:6: error: no previous prototype for ‘pmac_pci_fixup_cardbus’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/pci.c:1094:6: error: no previous prototype for ‘pmac_pci_fixup_pciata’ [-Werror=missing-prototypes]
>
> Remove has_address declaration and assignment since not used. Also add gcc
> attribute unused to fix a warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/pci.c:784:19: error: variable ‘has_address’ set but not used [-Werror=unused-but-set-variable]
> arch/powerpc/platforms/powermac/pci.c:907:22: error: variable ‘ht’ set but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> v2: remove has_address variable since not used
> arch/powerpc/platforms/powermac/pci.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
> index 0b8174a79993..67c497093e0a 100644
> --- a/arch/powerpc/platforms/powermac/pci.c
> +++ b/arch/powerpc/platforms/powermac/pci.c
> @@ -781,12 +781,12 @@ static int __init pmac_add_bridge(struct device_node *dev)
> struct resource rsrc;
> char *disp_name;
> const int *bus_range;
> - int primary = 1, has_address = 0;
> + int primary = 1;
>
> DBG("Adding PCI host bridge %pOF\n", dev);
>
> /* Fetch host bridge registers address */
> - has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
> + of_address_to_resource(dev, 0, &rsrc);
>
> /* Get bus range if any */
> bus_range = of_get_property(dev, "bus-range", &len);
> @@ -904,7 +904,7 @@ static int pmac_pci_root_bridge_prepare(struct pci_host_bridge *bridge)
> void __init pmac_pci_init(void)
> {
> struct device_node *np, *root;
> - struct device_node *ht = NULL;
> + struct device_node *ht __maybe_unused = NULL;
>
> pci_set_flags(PCI_CAN_SKIP_ISA_ALIGN);
>
> @@ -1019,7 +1019,7 @@ static bool pmac_pci_enable_device_hook(struct pci_dev *dev)
> return true;
> }
>
> -void pmac_pci_fixup_ohci(struct pci_dev *dev)
> +static void pmac_pci_fixup_ohci(struct pci_dev *dev)
> {
> struct device_node *node = pci_device_to_OF_node(dev);
>
> @@ -1054,7 +1054,7 @@ void __init pmac_pcibios_after_init(void)
> }
> }
>
> -void pmac_pci_fixup_cardbus(struct pci_dev* dev)
> +static void pmac_pci_fixup_cardbus(struct pci_dev *dev)
> {
> if (!machine_is(powermac))
> return;
> @@ -1091,7 +1091,7 @@ void pmac_pci_fixup_cardbus(struct pci_dev* dev)
>
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_ANY_ID, pmac_pci_fixup_cardbus);
>
> -void pmac_pci_fixup_pciata(struct pci_dev* dev)
> +static void pmac_pci_fixup_pciata(struct pci_dev *dev)
> {
> u8 progif = 0;
>
> --
> 2.11.0
>

2018-08-13 11:26:14

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v2,02/19] powerpc/powermac: Mark variable x as unused

On Wed, 2018-03-28 at 19:30:28 UTC, Mathieu Malaterre wrote:
> Since the value of x is never intended to be read, remove it. Fix warning
> treated as error with W=1:
>
> arch/powerpc/platforms/powermac/udbg_scc.c:76:9: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> Reviewed-by: Christophe Leroy <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/8921305c1ec9d9ea23e5f8eac30630

cheers

2018-08-13 11:26:16

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v2,07/19] powerpc/powermac: Make some functions static

On Wed, 2018-03-28 at 19:39:35 UTC, Mathieu Malaterre wrote:
> These functions can all be static, make it so. Fix warnings treated as
> errors with W=1:
>
> arch/powerpc/platforms/powermac/pci.c:1022:6: error: no previous prototype for ‘pmac_pci_fixup_ohci’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/pci.c:1057:6: error: no previous prototype for ‘pmac_pci_fixup_cardbus’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/pci.c:1094:6: error: no previous prototype for ‘pmac_pci_fixup_pciata’ [-Werror=missing-prototypes]
>
> Remove has_address declaration and assignment since not used. Also add gcc
> attribute unused to fix a warning treated as error with W=1:
>
> arch/powerpc/platforms/powermac/pci.c:784:19: error: variable ‘has_address’ set but not used [-Werror=unused-but-set-variable]
> arch/powerpc/platforms/powermac/pci.c:907:22: error: variable ‘ht’ set but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/618a89d738fdd97f6fc58b7b666c7a

cheers

2018-08-13 11:26:22

by Michael Ellerman

[permalink] [raw]
Subject: Re: [v3,03/19] powerpc: Move `path` variable inside DEBUG_PROM

On Wed, 2018-04-04 at 20:08:35 UTC, Mathieu Malaterre wrote:
> Add gcc attribute unused for two variables. Fix warnings treated as errors
> with W=1:
>
> arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable]
>
> Suggested-by: Christophe Leroy <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/eab00a208eb63d863b6cc0a03f68b4

cheers

2018-08-13 11:27:45

by Michael Ellerman

[permalink] [raw]
Subject: Re: [16/19] powerpc/powermac: Add missing include of header pmac.h

On Thu, 2018-03-22 at 20:20:02 UTC, Mathieu Malaterre wrote:
> The header `pmac.h` was not included, leading to the following warnings,
> treated as error with W=1:
>
> arch/powerpc/platforms/powermac/time.c:69:13: error: no previous prototype for ‘pmac_time_init’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/time.c:207:15: error: no previous prototype for ‘pmac_get_boot_time’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/time.c:222:6: error: no previous prototype for ‘pmac_get_rtc_time’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/time.c:240:5: error: no previous prototype for ‘pmac_set_rtc_time’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/time.c:259:12: error: no previous prototype for ‘via_calibrate_decr’ [-Werror=missing-prototypes]
> arch/powerpc/platforms/powermac/time.c:311:13: error: no previous prototype for ‘pmac_calibrate_decr’ [-Werror=missing-prototypes]
>
> The function `via_calibrate_decr` was made static to silence a warning.
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/2fff0f07b8441a481eb5fc0bfcd0e4

cheers