Skip to contentSkip to conversation

Staging: lustre: include: Remove do-while(0) from single statement macro

PATCH In review Bhumika Goyal 1 participant 2 messages Feb 15, 2016 – Feb 16, 2016 1 message not in the archive Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: lustre: include: Remove do-while(0) from single statement macro

do-while(0) around single statement macro is unnedded so remove it.

---
 drivers/staging/lustre/lustre/include/lustre_dlm.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/include/lustre_dlm.h +4 -6
index 9b319f1..455f9ce 100644
@@ -1206,13 +1206,11 @@ void ldlm_resource_dump(int level, struct ldlm_resource *);
 int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *,
 			      const struct ldlm_res_id *);
 
-#define LDLM_RESOURCE_ADDREF(res) do {				  \
-	lu_ref_add_atomic(&(res)->lr_reference, __func__, current);  \
-} while (0)
+#define LDLM_RESOURCE_ADDREF(res)			  \
+	lu_ref_add_atomic(&(res)->lr_reference, __func__, current)  \
 
-#define LDLM_RESOURCE_DELREF(res) do {				  \
-	lu_ref_del(&(res)->lr_reference, __func__, current);	  \
-} while (0)
+#define LDLM_RESOURCE_DELREF(res)				  \
+	lu_ref_del(&(res)->lr_reference, __func__, current)	  \
 
 /* ldlm_request.c */
 /** \defgroup ldlm_local_ast Default AST handlers for local locks
Signature · 1 line
1.9.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 9 lines · Greg KH
Quoted 1 line · Bhumika Goyal

do-while(0) around single statement macro is unnedded so remove it.

It doesn't hurt, right? I'd just leave it, as it prevents any bad side-affects from happening.

thanks,

greg k-h

But here the statement will execute once with or without the do-while. So what is the need to keep do-while? This is my understanding so please let me know if I am wrong.
Thanks,
Bhumika