From 4db2196d0c0de110779b1767d956995efefdb915 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 30 Sep 2015 22:06:46 +0800 Subject: nios2: Fix unused variable warning Fix the following compiler splat by adding __maybe_unused annotation to the variable. Using this particular annotation has the least ugly impact on the code compared to using ifdeffery. arch/nios2/kernel/setup.c: In function 'nios2_boot_init': arch/nios2/kernel/setup.c:107:7: warning: unused variable 'cmdline_passed' [-Wunused-variable] char cmdline_passed[COMMAND_LINE_SIZE] = { 0, }; ^ Signed-off-by: Marek Vasut Acked-by: Ley Foon Tan --- arch/nios2/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/nios2') diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c index b101a43d3c5a..a4ff86d58d5c 100644 --- a/arch/nios2/kernel/setup.c +++ b/arch/nios2/kernel/setup.c @@ -104,7 +104,7 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6, unsigned r7) { unsigned dtb_passed = 0; - char cmdline_passed[COMMAND_LINE_SIZE] = { 0, }; + char cmdline_passed[COMMAND_LINE_SIZE] __maybe_unused = { 0, }; #if defined(CONFIG_NIOS2_PASS_CMDLINE) if (r4 == 0x534f494e) { /* r4 is magic NIOS */ -- cgit v1.2.3 From 713e9b802e21e762f31336da72bcfc32e1ab65ac Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 30 Sep 2015 22:08:00 +0800 Subject: nios2: Switch to generic __xchg() The generic __xchg() implementation present in asm-generic/cmpxchg.h is correct on nios2 and even generates the same code. Switch to this generic implementation to trim down the amount of ad-hoc copies of the code. Signed-off-by: Marek Vasut Acked-by: Ley Foon Tan --- arch/nios2/include/asm/cmpxchg.h | 47 ---------------------------------------- 1 file changed, 47 deletions(-) (limited to 'arch/nios2') diff --git a/arch/nios2/include/asm/cmpxchg.h b/arch/nios2/include/asm/cmpxchg.h index 85938711542d..a7978f14d157 100644 --- a/arch/nios2/include/asm/cmpxchg.h +++ b/arch/nios2/include/asm/cmpxchg.h @@ -9,53 +9,6 @@ #ifndef _ASM_NIOS2_CMPXCHG_H #define _ASM_NIOS2_CMPXCHG_H -#include - -#define xchg(ptr, x) \ - ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) - -struct __xchg_dummy { unsigned long a[100]; }; -#define __xg(x) ((volatile struct __xchg_dummy *)(x)) - -static inline unsigned long __xchg(unsigned long x, volatile void *ptr, - int size) -{ - unsigned long tmp, flags; - - local_irq_save(flags); - - switch (size) { - case 1: - __asm__ __volatile__( - "ldb %0, %2\n" - "stb %1, %2\n" - : "=&r" (tmp) - : "r" (x), "m" (*__xg(ptr)) - : "memory"); - break; - case 2: - __asm__ __volatile__( - "ldh %0, %2\n" - "sth %1, %2\n" - : "=&r" (tmp) - : "r" (x), "m" (*__xg(ptr)) - : "memory"); - break; - case 4: - __asm__ __volatile__( - "ldw %0, %2\n" - "stw %1, %2\n" - : "=&r" (tmp) - : "r" (x), "m" (*__xg(ptr)) - : "memory"); - break; - } - - local_irq_restore(flags); - return tmp; -} - #include -#include #endif /* _ASM_NIOS2_CMPXCHG_H */ -- cgit v1.2.3 From bb3fc5ddef93836a36a39308cf7eca82ef0a1c4c Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 6 Nov 2015 14:19:11 +0800 Subject: nios2: Remove unnecessary #ifdef guards __HAVE_ARCH_MEMMOVE and __HAVE_ARCH_MEMSET are unconditionally defined for nios2, so there is no need to protect the function definitions of memmove() and memset(). Signed-off-by: Tobias Klauser Acked-by: Ley Foon Tan --- arch/nios2/lib/memmove.c | 2 -- arch/nios2/lib/memset.c | 2 -- 2 files changed, 4 deletions(-) (limited to 'arch/nios2') diff --git a/arch/nios2/lib/memmove.c b/arch/nios2/lib/memmove.c index c65ef517eb80..866c021f278c 100644 --- a/arch/nios2/lib/memmove.c +++ b/arch/nios2/lib/memmove.c @@ -10,7 +10,6 @@ #include #include -#ifdef __HAVE_ARCH_MEMMOVE void *memmove(void *d, const void *s, size_t count) { unsigned long dst, src; @@ -79,4 +78,3 @@ restdown: return d; } -#endif /* __HAVE_ARCH_MEMMOVE */ diff --git a/arch/nios2/lib/memset.c b/arch/nios2/lib/memset.c index 65e97802f5cc..c2cfcb121e34 100644 --- a/arch/nios2/lib/memset.c +++ b/arch/nios2/lib/memset.c @@ -10,7 +10,6 @@ #include #include -#ifdef __HAVE_ARCH_MEMSET void *memset(void *s, int c, size_t count) { int destptr, charcnt, dwordcnt, fill8reg, wrkrega; @@ -78,4 +77,3 @@ void *memset(void *s, int c, size_t count) return s; } -#endif /* __HAVE_ARCH_MEMSET */ -- cgit v1.2.3