summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2012-01-12 17:12:15 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2012-01-12 17:12:15 +0000
commit3f9c0579ac1bd233b5dac2a0f64e934b495068da (patch)
tree2d778f86607c9564dbf4443de07eed5a4bba61aa
parent9b12dfdc5f986846e673e4e0466b2199af75ec89 (diff)
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@xorcom.com> Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10434 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/xpp/xbus-sysfs.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/dahdi/xpp/xbus-sysfs.c b/drivers/dahdi/xpp/xbus-sysfs.c
index 51c633c..3181da7 100644
--- a/drivers/dahdi/xpp/xbus-sysfs.c
+++ b/drivers/dahdi/xpp/xbus-sysfs.c
@@ -245,18 +245,14 @@ static DEVICE_ATTR_READER(driftinfo_show, dev, buf)
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 @@ static DEVICE_ATTR_READER(driftinfo_show, dev, buf)
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);