]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sandbox: change local_irq_save() to macro
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Thu, 12 Jun 2014 03:26:15 +0000 (12:26 +0900)
committerSimon Glass <sjg@chromium.org>
Mon, 23 Jun 2014 21:37:24 +0000 (15:37 -0600)
local_irq_save() should be a macro, not a function
because local_irq_save() saves flag to the given argument.

GCC is silent about this issue, but Clang warns:

In file included from lib/asm-offsets.c:15:
In file included from include/common.h:20:
In file included from include/linux/bitops.h:110:
arch/sandbox/include/asm/bitops.h:59:17:
 warning: variable 'flags' is uninitialized when used here
      [-Wuninitialized]
        local_irq_save(flags);
                       ^~~~~

That change causes another warning:

In file included from include/linux/bitops.h:110:0,
                 from include/common.h:20,
                 from lib/asm-offsets.c:15:
arch/sandbox/include/asm/bitops.h: In function ‘test_and_set_bit’:
arch/sandbox/include/asm/bitops.h:56:16: warning: unused variable ‘flags’ [-Wunused-variable]

So, flags should be set to __always_unused.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Jeroen Hofstee <jeroen@myspectrum.nl>
arch/sandbox/include/asm/bitops.h
arch/sandbox/include/asm/system.h

index 74219c56a7f6d42685ad48db33a920280b2abef0..e807c4ef34bda06b5f1d555bb248ea02fccf4390 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef __ASM_SANDBOX_BITOPS_H
 #define __ASM_SANDBOX_BITOPS_H
 
+#include <linux/compiler.h>
 #include <asm/system.h>
 
 #ifdef __KERNEL__
@@ -53,7 +54,7 @@ static inline int __test_and_set_bit(int nr, void *addr)
 
 static inline int test_and_set_bit(int nr, void *addr)
 {
-       unsigned long flags;
+       unsigned long __always_unused flags;
        int out;
 
        local_irq_save(flags);
@@ -75,7 +76,7 @@ static inline int __test_and_clear_bit(int nr, void *addr)
 
 static inline int test_and_clear_bit(int nr, void *addr)
 {
-       unsigned long flags;
+       unsigned long __always_unused flags;
        int out;
 
        local_irq_save(flags);
index 066acc53fdb9e1685cdbb61cc1dab384aaf7f348..02beed35a775b1596257296bb6607d1848fb1691 100644 (file)
@@ -8,10 +8,7 @@
 #define __ASM_SANDBOX_SYSTEM_H
 
 /* Define this as nops for sandbox architecture */
-static inline void local_irq_save(unsigned flags __attribute__((unused)))
-{
-}
-
+#define local_irq_save(x)
 #define local_irq_enable()
 #define local_irq_disable()
 #define local_save_flags(x)