linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PATCH - md 3 of 3 - Make ITERATE_MDDEV work on non-SMP
@ 2002-06-20  0:07 Neil Brown
  0 siblings, 0 replies; only message in thread
From: Neil Brown @ 2002-06-20  0:07 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-raid, Reuben Farrelly


For an SMP kernel, spin_lock() et.al. are functions.
For a UP kernel, they are statements that must be terminated
by a ';'.  This is not quite the same thing, and hence spin_lock()
cannot be using inside a parenthesised expession.

This patch changes ITERATE_MDDEV to use gcc's "statement expressions"
instead which has the benefit of making the conditionals
more readable.



 ----------- Diffstat output ------------
 ./drivers/md/md.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

--- ./drivers/md/md.c	2002/06/19 23:29:01	1.3
+++ ./drivers/md/md.c	2002/06/19 23:53:56	1.4
@@ -144,17 +144,17 @@
  */
 #define ITERATE_MDDEV(mddev,tmp)					\
 									\
-	for (spin_lock(&all_mddevs_lock), 				\
-		     (tmp = all_mddevs.next),				\
-		     (mddev = NULL);					\
-	     (void)(tmp != &all_mddevs &&				\
-			mddev_get(list_entry(tmp, mddev_t, all_mddevs))),\
-		     spin_unlock(&all_mddevs_lock),			\
-		     (mddev ? mddev_put(mddev):(void)NULL),		\
-		     (mddev = list_entry(tmp, mddev_t, all_mddevs)),	\
-		     (tmp != &all_mddevs);				\
-	     spin_lock(&all_mddevs_lock),				\
-		     (tmp = tmp->next)					\
+	for (({ spin_lock(&all_mddevs_lock); 				\
+		tmp = all_mddevs.next;					\
+		mddev = NULL;});					\
+	     ({ if (tmp != &all_mddevs)					\
+			mddev_get(list_entry(tmp, mddev_t, all_mddevs));\
+		spin_unlock(&all_mddevs_lock);				\
+		if (mddev) mddev_put(mddev);				\
+		mddev = list_entry(tmp, mddev_t, all_mddevs);		\
+		tmp != &all_mddevs;});					\
+	     ({ spin_lock(&all_mddevs_lock);				\
+		tmp = tmp->next;})					\
 		)
 
 static mddev_t *mddev_map[MAX_MD_DEVS];

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-06-20  0:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-20  0:07 PATCH - md 3 of 3 - Make ITERATE_MDDEV work on non-SMP Neil Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).