lkml.org 
[lkml]   [2011]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [tip:core/urgent] WARN_ON_SMP(): Add comment to explain ({0;})
    From
    Date
    On Mon, 2011-03-28 at 21:18 +0300, Alexey Dobriyan wrote:
    > On Mon, Mar 28, 2011 at 11:09:00AM -0400, Steven Rostedt wrote:
    > > Geeze, I never expected such a fuss over a simple change ;)
    >
    > And it's still broken ;-)
    >
    > [spoiler space]

    I didn't understand this "space" and never went down to look more.
    Should have said "see below".

    > WARN_ON_SMP(x) should expand to x, not 0.

    No it should expand to zero, please READ THE COMMENT!

    OK, it was not part of this patch, but it was in the patch that this
    patch was added for.

    +/*
    + * WARN_ON_SMP() is for cases that the warning is either
    + * meaningless for !SMP or may even cause failures.
    + * This is usually used for cases that we have
    + * WARN_ON(!spin_is_locked(&lock)) checks, as spin_is_locked()
    + * returns 0 for uniprocessor settings.
    + * It can also be used with values that are only defined
    + * on SMP:
    + *
    + * struct foo {
    + * [...]
    + * #ifdef CONFIG_SMP
    + * int bar;
    + * #endif
    + * };
    + *
    + * void func(struct foo *zoot)
    + * {
    + * WARN_ON_SMP(!zoot->bar);
    + *
    + * For CONFIG_SMP, WARN_ON_SMP() should act the same as WARN_ON(),
    + * and should be a nop and return false for uniprocessor.
    + *
    + * if (WARN_ON_SMP(x)) returns true only when CONFIG_SMP is set
    + * and x is true.
    + */

    -- Steve




    \
     
     \ /
      Last update: 2011-03-29 13:39    [W:2.285 / U:0.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site