All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabian Huegel <fabian_huegel@web.de>
To: Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	James Simmons <jsimmons@infradead.org>,
	Lai Siyao <lai.siyao@intel.com>,
	"John L . Hammond" <john.hammond@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org
Cc: lustre-devel@lists.lustre.org, linux-kernel@vger.kernel.org,
	linux-kernel@i4.cs.fau.de,
	Christoph Volkert <linux@christoph-volkert.de>,
	Fabian Huegel <fabian_huegel@web.de>
Subject: [PATCH 2/8] staging: lustre: Enclose complex macros in do-while loops
Date: Thu, 21 Dec 2017 16:25:26 +0100	[thread overview]
Message-ID: <1513869932-27407-4-git-send-email-fabian_huegel@web.de> (raw)
In-Reply-To: <1513869932-27407-1-git-send-email-fabian_huegel@web.de>

Some complex multi-line macros were not enclosed by a do-while(0),
so we fixed that.

Signed-off-by: Fabian Huegel <fabian_huegel@web.de>
Signed-off-by: Christoph Volkert <linux@christoph-volkert.de>
---
 drivers/staging/lustre/lustre/include/obd_class.h | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
index 5c8cf30..dbe8225 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -332,22 +332,26 @@ static inline int obd_check_dev_active(struct obd_device *obd)
 	 / sizeof(((struct obd_ops *)(0))->iocontrol))
 
 #define OBD_COUNTER_INCREMENT(obdx, op)			   \
+do {							  \
 	if ((obdx)->obd_stats) {				  \
 		unsigned int coffset;			     \
 		coffset = (unsigned int)((obdx)->obd_cntr_base) + \
 			OBD_COUNTER_OFFSET(op);		   \
 		LASSERT(coffset < (obdx)->obd_stats->ls_num);     \
 		lprocfs_counter_incr((obdx)->obd_stats, coffset); \
-	}
+	}							  \
+} while (0)
 
 #define EXP_COUNTER_INCREMENT(export, op)				    \
+do {								\
 	if ((export)->exp_obd->obd_stats) {			  \
 		unsigned int coffset;					\
 		coffset = (unsigned int)((export)->exp_obd->obd_cntr_base) + \
 			OBD_COUNTER_OFFSET(op);			      \
 		LASSERT(coffset < (export)->exp_obd->obd_stats->ls_num);     \
 		lprocfs_counter_incr((export)->exp_obd->obd_stats, coffset); \
-	}
+	}								\
+} while (0)
 
 #define MD_COUNTER_OFFSET(op)				   \
 	((offsetof(struct md_ops, op) -		   \
@@ -355,15 +359,18 @@ static inline int obd_check_dev_active(struct obd_device *obd)
 	 / sizeof(((struct md_ops *)(0))->getstatus))
 
 #define MD_COUNTER_INCREMENT(obdx, op)			   \
+do {						   \
 	if ((obd)->md_stats) {			   \
 		unsigned int coffset;			    \
 		coffset = (unsigned int)((obdx)->md_cntr_base) + \
 			MD_COUNTER_OFFSET(op);		   \
 		LASSERT(coffset < (obdx)->md_stats->ls_num);     \
 		lprocfs_counter_incr((obdx)->md_stats, coffset); \
-	}
+	}							 \
+} while (0)
 
 #define EXP_MD_COUNTER_INCREMENT(export, op)				 \
+do {								\
 	if ((export)->exp_obd->obd_stats) {				  \
 		unsigned int coffset;					\
 		coffset = (unsigned int)((export)->exp_obd->md_cntr_base) +  \
@@ -373,7 +380,8 @@ static inline int obd_check_dev_active(struct obd_device *obd)
 		if ((export)->exp_md_stats)				  \
 			lprocfs_counter_incr(				\
 				(export)->exp_md_stats, coffset);	    \
-	}
+	}								\
+} while (0)
 
 #define EXP_CHECK_MD_OP(exp, op)				\
 do {							    \
-- 
2.7.4

  parent reply	other threads:[~2017-12-21 15:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 15:25 staging: lustre: Cleanup of obd_class.h Fabian Huegel
2017-12-21 15:25 ` [PATCH 1/8] staging: lustre: Enclose complex macros in parantheses Fabian Huegel
2017-12-21 15:43   ` Christoph Volkert
2018-01-08 14:52     ` Greg Kroah-Hartman
2018-01-08 14:52       ` [lustre-devel] " Greg Kroah-Hartman
2017-12-21 15:25 ` [PATCH 1/8] staging: lustre: Enclose complex macros in parentheses Fabian Huegel
2017-12-21 15:25 ` Fabian Huegel [this message]
2017-12-21 15:25 ` [PATCH 3/8] staging: lustre: Remove DECLARE_LU_VARS macro Fabian Huegel
2017-12-21 15:25 ` [PATCH 4/8] staging: lustre: Fix comment style Fabian Huegel
2017-12-21 15:25 ` [PATCH 5/8] staging: lustre: Add identifier names to function declarations Fabian Huegel
2017-12-21 15:25 ` [PATCH 6/8] staging: lustre: Fix overlong lines Fabian Huegel
2017-12-21 15:25 ` [PATCH 7/8] staging: lustre: Align struct member identifiers Fabian Huegel
2017-12-21 15:25 ` [PATCH 8/8] staging: lustre: Align backslashes in multi-line macros Fabian Huegel
2018-01-11 17:16 Fabian Huegel
2018-01-11 17:16 ` [PATCH 2/8] staging: lustre: Enclose complex macros in do-while loops Fabian Huegel

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=1513869932-27407-4-git-send-email-fabian_huegel@web.de \
    --to=fabian_huegel@web.de \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.hammond@intel.com \
    --cc=jsimmons@infradead.org \
    --cc=lai.siyao@intel.com \
    --cc=linux-kernel@i4.cs.fau.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@christoph-volkert.de \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.