Re: [PATCH 1/2] bug.h: Introduce HAVE_ARCH_WARN

Andrew Morton
2007-10-18T22:18:18Z

On Thu, 11 Oct 2007 12:12:11 -0500
Olof Johansson <olof@lixom.net> wrote:

> HAVE_ARCH_WARN is used to determine if an arch already has a __WARN()
> macro, or if a generic one is needed.
>
> With this, some of the arch-specific WARN_ON() implementations can be
> made common instead (see follow-up patch for powerpc).
>

Those HAVE_ARCH_foo things are unpleasant.

>
> diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
> index d56fedb..c6b8386 100644
> --- a/include/asm-generic/bug.h
> +++ b/include/asm-generic/bug.h
> @@ -31,14 +31,19 @@ struct bug_entry {
> #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0)
> #endif
>
> +#ifndef HAVE_ARCH_WARN
> +#define __WARN() do { \
> + printk("WARNING: at %s:%d %s()\n", __FILE__, \
> + __LINE__, __FUNCTION__); \
> + dump_stack(); \
> +} while (0)
> +#endif

Can't we just do #ifndef __WARN?