[PATCH] WARN_ONCE(): use bool for boolean flag

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Cesar Eduardo Barros
Date: Tuesday, September 29, 2009 - 5:37 pm

Commit 70867453092297be9afb2249e712a1f960ec0a09 changed printk_once()
to use bool instead of int for its guard variable. Do the same change
to WARN_ONCE() and WARN_ON_ONCE(), for the same reasons.

This resulted in a reduction of 1462 bytes on a x86-64 defconfig:

   text    data     bss     dec     hex filename
8101271 1207116  992764 10301151         9d2edf vmlinux.before
8100553 1207148  991988 10299689         9d2929 vmlinux.after

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
---

Andrew Morton escreveu:

Is the above good enough?

 include/asm-generic/bug.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 4b67559..18c435d 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -113,22 +113,22 @@ extern void warn_slowpath_null(const char *file, const int line);
 #endif
 
 #define WARN_ON_ONCE(condition)	({				\
-	static int __warned;					\
+	static bool __warned;					\
 	int __ret_warn_once = !!(condition);			\
 								\
 	if (unlikely(__ret_warn_once))				\
 		if (WARN_ON(!__warned)) 			\
-			__warned = 1;				\
+			__warned = true;			\
 	unlikely(__ret_warn_once);				\
 })
 
 #define WARN_ONCE(condition, format...)	({			\
-	static int __warned;					\
+	static bool __warned;					\
 	int __ret_warn_once = !!(condition);			\
 								\
 	if (unlikely(__ret_warn_once))				\
 		if (WARN(!__warned, format)) 			\
-			__warned = 1;				\
+			__warned = true;			\
 	unlikely(__ret_warn_once);				\
 })
 
-- 
1.6.4.4

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] WARN_ONCE(): use bool for boolean flag, Cesar Eduardo Barros, (Sun Sep 27, 6:53 am)
Re: [PATCH] WARN_ONCE(): use bool for boolean flag, Daniel Walker, (Sun Sep 27, 7:03 am)
Re: [PATCH] WARN_ONCE(): use bool for boolean flag, Cesar Eduardo Barros, (Sun Sep 27, 8:56 am)
Re: [PATCH] WARN_ONCE(): use bool for boolean flag, Daniel Walker, (Sun Sep 27, 9:52 am)
Re: [PATCH] WARN_ONCE(): use bool for boolean flag, Cesar Eduardo Barros, (Sun Sep 27, 10:24 am)
Re: [PATCH] WARN_ONCE(): use bool for boolean flag, Daniel Walker, (Sun Sep 27, 10:32 am)
Re: [PATCH] WARN_ONCE(): use bool for boolean flag, Cesar Eduardo Barros, (Sun Sep 27, 10:48 am)
Re: [PATCH] WARN_ONCE(): use bool for boolean flag, Cesar Eduardo Barros, (Sun Sep 27, 11:12 am)
[PATCH] WARN_ONCE(): use bool for condition, Cesar Eduardo Barros, (Sun Sep 27, 11:25 am)
Re: [PATCH] WARN_ONCE(): use bool for condition, Daniel Walker, (Sun Sep 27, 11:28 am)
Re: [PATCH] WARN_ONCE(): use bool for condition, Cesar Eduardo Barros, (Sun Sep 27, 11:55 am)
Re: [PATCH] WARN_ONCE(): use bool for condition, Daniel Walker, (Sun Sep 27, 12:03 pm)
Re: [PATCH] WARN_ONCE(): use bool for condition, Andrew Morton, (Tue Sep 29, 1:59 pm)
Re: [PATCH] WARN_ONCE(): use bool for condition, Cesar Eduardo Barros, (Tue Sep 29, 4:11 pm)
[PATCH] WARN_ONCE(): use bool for boolean flag, Cesar Eduardo Barros, (Tue Sep 29, 4:12 pm)
Re: [PATCH] WARN_ONCE(): use bool for condition, Cesar Eduardo Barros, (Tue Sep 29, 4:18 pm)
Re: [PATCH] WARN_ONCE(): use bool for boolean flag, Andrew Morton, (Tue Sep 29, 5:17 pm)
[PATCH] WARN_ONCE(): use bool for boolean flag, Cesar Eduardo Barros, (Tue Sep 29, 5:37 pm)