public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] asm-generic: fix compile breakage "'TAINT_WARN' undeclared"
@ 2012-06-27 13:52 Guennadi Liakhovetski
  2012-06-27 14:22 ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Guennadi Liakhovetski @ 2012-06-27 13:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-sh

TAINT_WARN is defined in kernel.h and used in asm-generic/bug.h. Not 
including kernel.h there breaks build on sh:

In file included from linux/include/linux/thread_info.h:54,
                 from linux/include/linux/preempt.h:9,
                 from linux/include/linux/spinlock.h:50,
                 from linux/include/linux/mmzone.h:7,
                 from linux/include/linux/gfp.h:4,
                 from linux/include/linux/mm.h:8,
                 from linux/arch/sh/kernel/asm-offsets.c:13:
linux/arch/sh/include/asm/thread_info.h: In function 'set_restore_sigmask':
linux/arch/sh/include/asm/thread_info.h:172: error: 'TAINT_WARN' undeclared (first use in this function)
linux/arch/sh/include/asm/thread_info.h:172: error: (Each undeclared identifier is reported only once
linux/arch/sh/include/asm/thread_info.h:172: error: for each function it appears in.)

Also, since nothing in bug.h is usable from assembly, it is safe to extend 
the "#ifndef __ASSEMBLY__" block over all WARN() macros.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---

Compile-tested a couple of configurations on sh, ARM, x86

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 2520a6e..f4965c0 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -59,8 +59,8 @@ struct bug_entry {
  * appear at runtime.  Use the versions with printk format strings
  * to provide better diagnostics.
  */
-#ifndef __WARN_TAINT
 #ifndef __ASSEMBLY__
+#ifndef __WARN_TAINT
 extern __printf(3, 4)
 void warn_slowpath_fmt(const char *file, const int line,
 		       const char *fmt, ...);
@@ -69,12 +69,12 @@ void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint,
 			     const char *fmt, ...);
 extern void warn_slowpath_null(const char *file, const int line);
 #define WANT_WARN_ON_SLOWPATH
-#endif
 #define __WARN()		warn_slowpath_null(__FILE__, __LINE__)
 #define __WARN_printf(arg...)	warn_slowpath_fmt(__FILE__, __LINE__, arg)
 #define __WARN_printf_taint(taint, arg...)				\
 	warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)
 #else
+#include <linux/kernel.h>
 #define __WARN()		__WARN_TAINT(TAINT_WARN)
 #define __WARN_printf(arg...)	do { printk(arg); __WARN(); } while (0)
 #define __WARN_printf_taint(taint, arg...)				\
@@ -105,6 +105,7 @@ extern void warn_slowpath_null(const char *file, const int line);
 		__WARN_printf_taint(taint, format);			\
 	unlikely(__ret_warn_on);					\
 })
+#endif /* __ASSEMBLY__ */
 
 #else /* !CONFIG_BUG */
 #ifndef HAVE_ARCH_BUG
-- 
1.7.2.5


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

* Re: [PATCH] asm-generic: fix compile breakage "'TAINT_WARN' undeclared"
  2012-06-27 13:52 [PATCH] asm-generic: fix compile breakage "'TAINT_WARN' undeclared" Guennadi Liakhovetski
@ 2012-06-27 14:22 ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2012-06-27 14:22 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-kernel, linux-sh

On Wed, Jun 27, 2012 at 03:52:27PM +0200, Guennadi Liakhovetski wrote:
> TAINT_WARN is defined in kernel.h and used in asm-generic/bug.h. Not 
> including kernel.h there breaks build on sh:
> 
> In file included from linux/include/linux/thread_info.h:54,
>                  from linux/include/linux/preempt.h:9,
>                  from linux/include/linux/spinlock.h:50,
>                  from linux/include/linux/mmzone.h:7,
>                  from linux/include/linux/gfp.h:4,
>                  from linux/include/linux/mm.h:8,
>                  from linux/arch/sh/kernel/asm-offsets.c:13:
> linux/arch/sh/include/asm/thread_info.h: In function 'set_restore_sigmask':
> linux/arch/sh/include/asm/thread_info.h:172: error: 'TAINT_WARN' undeclared (first use in this function)
> linux/arch/sh/include/asm/thread_info.h:172: error: (Each undeclared identifier is reported only once
> linux/arch/sh/include/asm/thread_info.h:172: error: for each function it appears in.)
> 
> Also, since nothing in bug.h is usable from assembly, it is safe to extend 
> the "#ifndef __ASSEMBLY__" block over all WARN() macros.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Already fixed in mainline.

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

end of thread, other threads:[~2012-06-27 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-27 13:52 [PATCH] asm-generic: fix compile breakage "'TAINT_WARN' undeclared" Guennadi Liakhovetski
2012-06-27 14:22 ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox