All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] sandbox: change local_irq_save() to macro
@ 2014-06-12  3:26 Masahiro Yamada
  2014-06-12  4:27 ` Simon Glass
  2014-06-12 21:20 ` Jeroen Hofstee
  0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2014-06-12  3:26 UTC (permalink / raw)
  To: u-boot

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>
---

Changes in v2:
  - I forgot to "git add arch/sandbox/include/asm/bitops.h" in v1
    Resending.

 arch/sandbox/include/asm/bitops.h | 5 +++--
 arch/sandbox/include/asm/system.h | 5 +----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/sandbox/include/asm/bitops.h b/arch/sandbox/include/asm/bitops.h
index 74219c5..e807c4e 100644
--- a/arch/sandbox/include/asm/bitops.h
+++ b/arch/sandbox/include/asm/bitops.h
@@ -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);
diff --git a/arch/sandbox/include/asm/system.h b/arch/sandbox/include/asm/system.h
index 066acc5..02beed3 100644
--- a/arch/sandbox/include/asm/system.h
+++ b/arch/sandbox/include/asm/system.h
@@ -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)
-- 
1.9.1

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

* [U-Boot] [PATCH v2] sandbox: change local_irq_save() to macro
  2014-06-12  3:26 [U-Boot] [PATCH v2] sandbox: change local_irq_save() to macro Masahiro Yamada
@ 2014-06-12  4:27 ` Simon Glass
  2014-06-12 21:20 ` Jeroen Hofstee
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2014-06-12  4:27 UTC (permalink / raw)
  To: u-boot

On 11 June 2014 23:26, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> 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>

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

* [U-Boot] [PATCH v2] sandbox: change local_irq_save() to macro
  2014-06-12  3:26 [U-Boot] [PATCH v2] sandbox: change local_irq_save() to macro Masahiro Yamada
  2014-06-12  4:27 ` Simon Glass
@ 2014-06-12 21:20 ` Jeroen Hofstee
  1 sibling, 0 replies; 3+ messages in thread
From: Jeroen Hofstee @ 2014-06-12 21:20 UTC (permalink / raw)
  To: u-boot

On do, 2014-06-12 at 12:26 +0900, Masahiro Yamada wrote:
> 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: Jeroen Hofstee <jeroen@myspectrum.nl>

Regards,
Jeroen

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

end of thread, other threads:[~2014-06-12 21:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12  3:26 [U-Boot] [PATCH v2] sandbox: change local_irq_save() to macro Masahiro Yamada
2014-06-12  4:27 ` Simon Glass
2014-06-12 21:20 ` Jeroen Hofstee

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