aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2015-09-30 14:30:27 -0400
committerMark Brown <broonie@kernel.org>2015-09-30 15:31:16 -0400
commitca07e9f3cb929548feee8b16715983a4ed009eb6 (patch)
tree76dca3939da41e145798516e9765566a86ef9d4b /drivers/base
parent20991cdb26ffc51030223320a6dd266f4fc28fbd (diff)
regmap: debugfs: simplify regmap_reg_ranges_read_file() slightly
By printing the newline character to entry, we can avoid accounting for it manually in several places. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap-debugfs.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 69894bb9b6dd..3f0a7e262d69 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -365,17 +365,15 @@ static ssize_t regmap_reg_ranges_read_file(struct file *file,
365 p = 0; 365 p = 0;
366 mutex_lock(&map->cache_lock); 366 mutex_lock(&map->cache_lock);
367 list_for_each_entry(c, &map->debugfs_off_cache, list) { 367 list_for_each_entry(c, &map->debugfs_off_cache, list) {
368 entry_len = snprintf(entry, PAGE_SIZE, "%x-%x", 368 entry_len = snprintf(entry, PAGE_SIZE, "%x-%x\n",
369 c->base_reg, c->max_reg); 369 c->base_reg, c->max_reg);
370 if (p >= *ppos) { 370 if (p >= *ppos) {
371 if (buf_pos + 1 + entry_len > count) 371 if (buf_pos + entry_len > count)
372 break; 372 break;
373 memcpy(buf + buf_pos, entry, entry_len); 373 memcpy(buf + buf_pos, entry, entry_len);
374 buf_pos += entry_len; 374 buf_pos += entry_len;
375 buf[buf_pos] = '\n';
376 buf_pos++;
377 } 375 }
378 p += entry_len + 1; 376 p += entry_len;
379 } 377 }
380 mutex_unlock(&map->cache_lock); 378 mutex_unlock(&map->cache_lock);
381 379