lkml.org 
[lkml]   [2006]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    SubjectRe: 2.6.18-rc1-mm2
    From
    On Fri, Jul 14, 2006 at 05:35:17PM -0700, Andrew Morton wrote:
    >
    > Actually, it was added three-odd weeks back.

    Oops, I had done a git-read-tree v2.6.17 when tracking down a bug
    and forgot to revert to HEAD.

    BTW, how about making WARN_ON/WARN_ON_ONCE always return the
    condition? That would mean you could do

    if (WARN_ON(blah)) {
    handle_impossible_case
    }

    Rather than

    if (unlikely(blah)) {
    WARN_ON(1)
    handle_impossible_case
    }

    I checked all the newly added WARN_ON_ONCE users and none of them
    test the return status so we can still change it.

    Signed-off-by: Herbert Xu herbert@gondor.apana.org.au>

    Cheers,
    --
    Visit Openswan at http://www.openswan.org/
    Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
    Home Page: http://gondor.apana.org.au/~herbert/
    PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
    --
    diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
    index 8ceab7b..7abe5e0 100644
    --- a/include/asm-generic/bug.h
    +++ b/include/asm-generic/bug.h
    @@ -16,12 +16,14 @@ #define BUG_ON(condition) do { if (unlik
    #endif

    #ifndef HAVE_ARCH_WARN_ON
    -#define WARN_ON(condition) do { \
    - if (unlikely((condition)!=0)) { \
    +#define WARN_ON(condition) ({ \
    + int __ret = condition; \
    + if (unlikely(__ret)) { \
    printk("BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \
    dump_stack(); \
    } \
    -} while (0)
    + unlikely(__ret); \
    +})
    #endif

    #else /* !CONFIG_BUG */
    @@ -41,14 +43,12 @@ #endif
    #define WARN_ON_ONCE(condition) \
    ({ \
    static int __warn_once = 1; \
    - int __ret = 0; \
    + int __ret = condition; \
    \
    - if (unlikely((condition) && __warn_once)) { \
    + if (WARN_ON(__warn_once && __ret)) { \
    __warn_once = 0; \
    - WARN_ON(1); \
    - __ret = 1; \
    } \
    - __ret; \
    + unlikely(__ret); \
    })

    #ifdef CONFIG_SMP
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2006-07-15 03:11    [W:2.303 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site