From 0e93680ba1b530abf58fe5da969c335a3c032eb8 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 17 Mar 2011 15:21:06 -0400 Subject: [PATCH] --- yaml --- r: 242507 b: refs/heads/master c: 2092e6be82ec71ecbf5a8ceeef004bbcbdb78812 h: refs/heads/master i: 242505: 01a1c63580844a78b03858cf5a94c162ef21973a 242503: 102a54db918eb3c46ef8eaae6c03a8d36f6d9733 v: v3 --- [refs] | 2 +- trunk/include/asm-generic/bug.h | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 712cc3311242..4652f19413c4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 71f9e59800e5ad4e6b683348424c9fe54306cd43 +refs/heads/master: 2092e6be82ec71ecbf5a8ceeef004bbcbdb78812 diff --git a/trunk/include/asm-generic/bug.h b/trunk/include/asm-generic/bug.h index c2c9ba032d46..f2d2faf4d9ae 100644 --- a/trunk/include/asm-generic/bug.h +++ b/trunk/include/asm-generic/bug.h @@ -165,10 +165,36 @@ extern void warn_slowpath_null(const char *file, const int line); #define WARN_ON_RATELIMIT(condition, state) \ WARN_ON((condition) && __ratelimit(state)) +/* + * 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. + */ #ifdef CONFIG_SMP # define WARN_ON_SMP(x) WARN_ON(x) #else -# define WARN_ON_SMP(x) do { } while (0) +# define WARN_ON_SMP(x) ({0;}) #endif #endif