Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1632453

[PATCH 2/7] staging: rtl8723bs: Wrap multi-line macros in do-while loop

From Justin Vreeland <justin@jvreeland.com>
Newsgroups linux.kernel
Subject [PATCH 2/7] staging: rtl8723bs: Wrap multi-line macros in do-while loop
Date 2017-04-28 02:30 +0200
Message-ID <tB1NE-8at-5@gated-at.bofh.it> (permalink)
References <tB1ND-8at-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Signed-off-by: Justin Vreeland <justin@jvreeland.com>
---
 drivers/staging/rtl8723bs/hal/odm_debug.h | 80 +++++++++++++++++--------------
 1 file changed, 44 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.h b/drivers/staging/rtl8723bs/hal/odm_debug.h
index a89690ea6ba9..f720eafe46fe 100644
--- a/drivers/staging/rtl8723bs/hal/odm_debug.h
+++ b/drivers/staging/rtl8723bs/hal/odm_debug.h
@@ -105,51 +105,59 @@
 
 #if DBG
 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)\
-	if (\
-		(comp & pDM_Odm->DebugComponents) &&\
-		(level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)\
-	) {\
-		RT_PRINTK fmt;\
-	}
+	do {\
+		if (\
+			(comp & pDM_Odm->DebugComponents) &&\
+			(level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)\
+		) {\
+			RT_PRINTK fmt;\
+		} \
+	} while (0)
 
 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)\
-	if (\
-		(comp & pDM_Odm->DebugComponents) &&\
-		(level <= pDM_Odm->DebugLevel)\
-	) {\
-		RT_PRINTK fmt;\
-	}
+	do {\
+		if (\
+			(comp & pDM_Odm->DebugComponents) &&\
+			(level <= pDM_Odm->DebugLevel)\
+		) {\
+			RT_PRINTK fmt;\
+		} \
+	} while (0)
 
 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)\
-	if (!expr) {\
-		DbgPrint("Assertion failed! %s at ......\n", #expr);\
-		DbgPrint(\
-			"      ......%s,%s, line =%d\n",\
-			__FILE__,\
-			__func__,\
-			__LINE__\
-		);\
-		RT_PRINTK fmt;\
-		ASSERT(false);\
-	}
+	do {\
+		if (!expr) {\
+			DbgPrint("Assertion failed! %s at ......\n", #expr);\
+			DbgPrint(\
+				"      ......%s,%s, line =%d\n",\
+				__FILE__,\
+				__func__,\
+				__LINE__\
+			);\
+			RT_PRINTK fmt;\
+			ASSERT(false);\
+		} \
+	} while (0)
 #define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); }
 #define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); }
 #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); }
 
 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)\
-	if (\
-		(comp & pDM_Odm->DebugComponents) &&\
-		(level <= pDM_Odm->DebugLevel)\
-	) {\
-		int __i;\
-		u8 *__ptr = (u8 *)ptr;\
-		DbgPrint("[ODM] ");\
-		DbgPrint(title_str);\
-		DbgPrint(" ");\
-		for (__i = 0; __i < 6; __i++)\
-			DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-");\
-		DbgPrint("\n");\
-	}
+	do {\
+		if (\
+			(comp & pDM_Odm->DebugComponents) &&\
+			(level <= pDM_Odm->DebugLevel)\
+		) {\
+			int __i;\
+			u8 *__ptr = (u8 *)ptr;\
+			DbgPrint("[ODM] ");\
+			DbgPrint(title_str);\
+			DbgPrint(" ");\
+			for (__i = 0; __i < 6; __i++)\
+				DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-");\
+			DbgPrint("\n");\
+		} \
+	} while (0)
 #else
 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)
 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)
-- 
2.12.2

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] staging: rtl8732: Various checkpatch fixes Justin Vreeland <justin@jvreeland.com> - 2017-04-28 02:20 +0200
  [PATCH 2/7] staging: rtl8723bs: Wrap multi-line macros in do-while loop Justin Vreeland <justin@jvreeland.com> - 2017-04-28 02:30 +0200
  [PATCH 7/7] staging: rtl8723bs: Do not use assignment in if condition Justin Vreeland <justin@jvreeland.com> - 2017-04-28 02:30 +0200
  [PATCH 4/7] staging: rtl8723bs: Move braces to same line as conditional Justin Vreeland <justin@jvreeland.com> - 2017-04-28 02:30 +0200
    Re: [PATCH 4/7] staging: rtl8723bs: Move braces to same line as  conditional Larry Finger <Larry.Finger@lwfinger.net> - 2017-04-28 02:30 +0200
      Re: [PATCH 4/7] staging: rtl8723bs: Move braces to same line as  conditional Joe Perches <joe@perches.com> - 2017-04-28 02:30 +0200
  [PATCH 6/7] staging: rtl8723bs: Fix spacing around '<' Justin Vreeland <justin@jvreeland.com> - 2017-04-28 02:30 +0200
  [PATCH 1/7] staging: rtl8723bs: Fix initialization of static variables Justin Vreeland <justin@jvreeland.com> - 2017-04-28 02:30 +0200
  Re: [PATCH 0/7] staging: rtl8732: Various checkpatch fixes Bastien Nocera <hadess@hadess.net> - 2017-04-28 12:00 +0200

csiph-web