[dahdi-commits] tzafrir: linux/trunk r10434 - /linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Thu Jan 12 11:12:19 CST 2012


Author: tzafrir
Date: Thu Jan 12 11:12:15 2012
New Revision: 10434

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10434
Log:
xpp: style - one macro cleanup

* Wrap in do {} while(0)
* Move closer to its use (it's #undef'ed anyway after this section)
* Also re-organize line-breaking in the same code section

Signed-off-by: Oron Peled <oron.peled at xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Modified:
    linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c

Modified: linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c?view=diff&rev=10434&r1=10433&r2=10434
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c Thu Jan 12 11:12:15 2012
@@ -245,18 +245,14 @@
 	seconds = seconds % 60;
 	hours = minutes / 60;
 	minutes = minutes % 60;
-#define	SHOW(ptr,item) \
-	len += snprintf(buf + len, PAGE_SIZE - len, \
-	"%-15s: %8d\n", #item, (ptr)->item)
-	len +=
-	    snprintf(buf + len, PAGE_SIZE - len,
-		     "%-15s: %8d (was %d:%02d:%02d ago)\n", "lost_ticks",
-		     di->lost_ticks, hours, minutes, seconds);
+	len += snprintf(buf + len, PAGE_SIZE - len,
+		"%-15s: %8d (was %d:%02d:%02d ago)\n", "lost_ticks",
+		di->lost_ticks, hours, minutes, seconds);
 	speed_range = abs(di->max_speed - di->min_speed);
 	uframes_inaccuracy = di->sync_inaccuracy / 125;
-	len +=
-	    snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d ", "instability",
-		     speed_range + uframes_inaccuracy);
+	len += snprintf(buf + len, PAGE_SIZE - len,
+		"%-15s: %8d ", "instability",
+		speed_range + uframes_inaccuracy);
 	if (xbus->sync_mode == SYNC_MODE_AB) {
 		buf[len++] = '-';
 	} else {
@@ -266,20 +262,21 @@
 			buf[len++] = '#';
 	}
 	buf[len++] = '\n';
-	len +=
-	    snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d (uframes)\n",
-		     "inaccuracy", uframes_inaccuracy);
-	len +=
-	    snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n", "speed_range",
-		     speed_range);
+	len += snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d (uframes)\n",
+		"inaccuracy", uframes_inaccuracy);
+	len += snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n",
+		"speed_range", speed_range);
+#define	SHOW(ptr, item) \
+	do { \
+		len += snprintf(buf + len, PAGE_SIZE - len, \
+		"%-15s: %8d\n", #item, (ptr)->item); \
+	} while (0)
 	SHOW(xbus, sync_adjustment);
-	len +=
-	    snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n",
-		     "offset (usec)", di->offset_prev);
+	len += snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n",
+		"offset (usec)", di->offset_prev);
 	SHOW(di, offset_range);
-	len +=
-	    snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n", "best_speed",
-		     (di->max_speed + di->min_speed) / 2);
+	len += snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n",
+		"best_speed", (di->max_speed + di->min_speed) / 2);
 	SHOW(di, min_speed);
 	SHOW(di, max_speed);
 	SHOW(ticker, cycle);




More information about the dahdi-commits mailing list