mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jiri Kosina <trivial@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 01/29] include/asm-generic/bug.h: Update WARN macros
Date: Mon,  6 Dec 2010 14:04:51 -0800	[thread overview]
Message-ID: <e49fe9e9adf608f370ea036d6eb0d2f8bad3252a.1291670105.git.joe@perches.com> (raw)
In-Reply-To: <cover.1291670104.git.joe@perches.com>

Add KERN_EMERG to BUG printk
Add KERN_WARNING to WARN printk
Change macros to use (fmt, arg...) style
Whitespace/checkpatch neatening

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/asm-generic/bug.h |  101 +++++++++++++++++++++++++++------------------
 1 files changed, 61 insertions(+), 40 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index c2c9ba0..f006309 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -43,9 +43,11 @@ struct bug_entry {
  * users don't need to reboot ASAP and can mostly shut down cleanly.
  */
 #ifndef HAVE_ARCH_BUG
-#define BUG() do { \
-	printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
-	panic("BUG!"); \
+#define BUG()							\
+do {								\
+	printk(KERN_EMERG "BUG: failure at %s:%d/%s()!\n",	\
+	       __FILE__, __LINE__, __func__);			\
+	panic("BUG!");						\
 } while (0)
 #endif
 
@@ -69,40 +71,53 @@ extern void warn_slowpath_fmt_taint(const char *file, const int line,
 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)
+#define __WARN()						\
+	warn_slowpath_null(__FILE__, __LINE__)
+#define __WARN_printf(fmt, args...)				\
+	warn_slowpath_fmt(__FILE__, __LINE__, fmt, ##args)
+#define __WARN_printf_taint(taint, fmt, args...)		\
+	warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, fmt, ##args)
 #else
-#define __WARN()		__WARN_TAINT(TAINT_WARN)
-#define __WARN_printf(arg...)	do { printk(arg); __WARN(); } while (0)
-#define __WARN_printf_taint(taint, arg...)				\
-	do { printk(arg); __WARN_TAINT(taint); } while (0)
+#define __WARN()						\
+	__WARN_TAINT(TAINT_WARN)
+#define __WARN_printf(fmt, args...)				\
+do {								\
+	printk(KERN_WARNING fmt, ##args);			\
+	__WARN();						\
+} while (0)
+#define __WARN_printf_taint(taint, fmt, args...)		\
+do {								\
+	printk(KERN_WARNING fmt, ##args);			\
+	__WARN_TAINT(taint);					\
+} while (0)
 #endif
 
 #ifndef WARN_ON
-#define WARN_ON(condition) ({						\
-	int __ret_warn_on = !!(condition);				\
-	if (unlikely(__ret_warn_on))					\
-		__WARN();						\
-	unlikely(__ret_warn_on);					\
+#define WARN_ON(condition)					\
+({								\
+	int __ret_warn_on = !!(condition);			\
+	if (unlikely(__ret_warn_on))				\
+		__WARN();					\
+	unlikely(__ret_warn_on);				\
 })
 #endif
 
 #ifndef WARN
-#define WARN(condition, format...) ({						\
-	int __ret_warn_on = !!(condition);				\
-	if (unlikely(__ret_warn_on))					\
-		__WARN_printf(format);					\
-	unlikely(__ret_warn_on);					\
+#define WARN(condition, fmt, args...)				\
+({								\
+	int __ret_warn_on = !!(condition);			\
+	if (unlikely(__ret_warn_on))				\
+		__WARN_printf(fmt, ##args);			\
+	unlikely(__ret_warn_on);				\
 })
 #endif
 
-#define WARN_TAINT(condition, taint, format...) ({			\
-	int __ret_warn_on = !!(condition);				\
-	if (unlikely(__ret_warn_on))					\
-		__WARN_printf_taint(taint, format);			\
-	unlikely(__ret_warn_on);					\
+#define WARN_TAINT(condition, taint, fmt, args...)		\
+({								\
+	int __ret_warn_on = !!(condition);			\
+	if (unlikely(__ret_warn_on))				\
+		__WARN_printf_taint(taint, fmt, ##args);	\
+	unlikely(__ret_warn_on);				\
 })
 
 #else /* !CONFIG_BUG */
@@ -115,55 +130,61 @@ extern void warn_slowpath_null(const char *file, const int line);
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON
-#define WARN_ON(condition) ({						\
-	int __ret_warn_on = !!(condition);				\
-	unlikely(__ret_warn_on);					\
+#define WARN_ON(condition)					\
+({								\
+	int __ret_warn_on = !!(condition);			\
+	unlikely(__ret_warn_on);				\
 })
 #endif
 
 #ifndef WARN
-#define WARN(condition, format...) ({					\
-	int __ret_warn_on = !!(condition);				\
-	unlikely(__ret_warn_on);					\
+#define WARN(condition, fmt, args...)				\
+({								\
+	int __ret_warn_on = !!(condition);			\
+	unlikely(__ret_warn_on);				\
 })
 #endif
 
-#define WARN_TAINT(condition, taint, format...) WARN_ON(condition)
+#define WARN_TAINT(condition, taint, fmt, args...) 		\
+	WARN_ON(condition)
 
 #endif
 
-#define WARN_ON_ONCE(condition)	({				\
+#define WARN_ON_ONCE(condition)					\
+({								\
 	static bool __warned;					\
 	int __ret_warn_once = !!(condition);			\
 								\
 	if (unlikely(__ret_warn_once))				\
-		if (WARN_ON(!__warned)) 			\
+		if (WARN_ON(!__warned))				\
 			__warned = true;			\
 	unlikely(__ret_warn_once);				\
 })
 
-#define WARN_ONCE(condition, format...)	({			\
+#define WARN_ONCE(condition, fmt, args...)			\
+({								\
 	static bool __warned;					\
 	int __ret_warn_once = !!(condition);			\
 								\
 	if (unlikely(__ret_warn_once))				\
-		if (WARN(!__warned, format)) 			\
+		if (WARN(!__warned, fmt, ##args))		\
 			__warned = true;			\
 	unlikely(__ret_warn_once);				\
 })
 
-#define WARN_TAINT_ONCE(condition, taint, format...)	({	\
+#define WARN_TAINT_ONCE(condition, taint, fmt, args...)		\
+({								\
 	static bool __warned;					\
 	int __ret_warn_once = !!(condition);			\
 								\
 	if (unlikely(__ret_warn_once))				\
-		if (WARN_TAINT(!__warned, taint, format))	\
+		if (WARN_TAINT(!__warned, taint, fmt, ##args))	\
 			__warned = true;			\
 	unlikely(__ret_warn_once);				\
 })
 
 #define WARN_ON_RATELIMIT(condition, state)			\
-		WARN_ON((condition) && __ratelimit(state))
+	WARN_ON((condition) && __ratelimit(state))
 
 #ifdef CONFIG_SMP
 # define WARN_ON_SMP(x)			WARN_ON(x)
-- 
1.7.3.2.245.g03276.dirty


  reply	other threads:[~2010-12-06 22:05 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06 22:04 [PATCH 00/29] trivial: WARN cleanups Joe Perches
2010-12-06 22:04 ` Joe Perches [this message]
2010-12-06 22:04 ` [PATCH 02/29] arch/alpha: Update WARN uses Joe Perches
2010-12-06 22:04 ` [PATCH 03/29] arch/arm: " Joe Perches
2010-12-06 22:04 ` [PATCH 04/29] arch/powerpc: " Joe Perches
2010-12-06 22:04 ` [PATCH 05/29] arch/x86: " Joe Perches
2010-12-06 22:04 ` [PATCH 06/29] drivers/acpi: " Joe Perches
2010-12-06 22:04 ` [PATCH 07/29] drivers/base: " Joe Perches
2010-12-06 22:04 ` [PATCH 08/29] drivers/block: " Joe Perches
2010-12-06 22:04 ` [PATCH 09/29] drivers/cpuidle: " Joe Perches
2010-12-06 22:05 ` [PATCH 10/29] drivers/firmware: " Joe Perches
2010-12-06 22:05 ` [PATCH 11/29] drivers/gpio: " Joe Perches
2010-12-06 22:05 ` [PATCH 12/29] drivers/net/wireless/iwlwifi: " Joe Perches
2010-12-06 22:05 ` [PATCH 13/29] drivers/scsi/fcoe: " Joe Perches
2010-12-06 22:05 ` [PATCH 14/29] drivers/usb/musb: " Joe Perches
2010-12-06 22:05 ` [PATCH 15/29] drivers/video/omap2/dss: " Joe Perches
2010-12-06 22:05 ` [PATCH 16/29] fs/nfsd: " Joe Perches
2010-12-06 22:05 ` [PATCH 17/29] fs/notify/inotify: " Joe Perches
2010-12-06 22:05 ` [PATCH 18/29] fs/sysfs: " Joe Perches
2010-12-06 22:05 ` [PATCH 19/29] fs/proc: " Joe Perches
2010-12-06 22:05 ` [PATCH 20/29] fs: " Joe Perches
2010-12-06 22:05 ` [PATCH 21/29] include/linux/device.h: " Joe Perches
2010-12-06 22:05 ` [PATCH 22/29] kernel/irq: " Joe Perches
2010-12-06 22:05 ` [PATCH 23/29] kernel/panic.c: Update warn_slowpath to use %pV Joe Perches
2010-12-06 22:05 ` [PATCH 24/29] kernel: Update WARN uses Joe Perches
2010-12-06 22:05 ` [PATCH 25/29] lib: " Joe Perches
2010-12-06 22:05 ` [PATCH 26/29] mm: " Joe Perches
2010-12-06 22:05 ` [PATCH 27/29] net/mac80211: " Joe Perches
2010-12-06 22:05 ` [PATCH 28/29] net/rfkill/input.c: " Joe Perches
2010-12-06 22:05 ` [PATCH 29/29] drivers/regulator: " Joe Perches
2010-12-07 11:43   ` Mark Brown
2010-12-07 14:50     ` Jiri Kosina
2010-12-07 15:16       ` Mark Brown
2010-12-07 15:31         ` Jiri Kosina
2010-12-07 15:44           ` Liam Girdwood
2010-12-09  9:10   ` Liam Girdwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e49fe9e9adf608f370ea036d6eb0d2f8bad3252a.1291670105.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®