summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/cacheinfo.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-02-13 14:37:06 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-13 21:21:36 -0800
commit0c118b7bd09a1d11731ba80421a34ea1105c5b21 (patch)
treebe234b03db60a78d856fb4c947d3424dcaf44e73 /arch/powerpc/kernel/cacheinfo.c
parent729d8e093c3ec5c662965c97accd882a75b0f93a (diff)
downloadlinux-0c118b7bd09a1d11731ba80421a34ea1105c5b21.tar.bz2
powerpc: use %*pb[l] to print bitmaps including cpumasks and nodemasks
printk and friends can now format bitmaps using '%*pb[l]'. cpumask and nodemask also provide cpumask_pr_args() and nodemask_pr_args() respectively which can be used to generate the two printf arguments necessary to format the specified cpu/nodemask. * Spurious if (len > 1) test dropped from shared_cpu_map_show(). Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc/kernel/cacheinfo.c')
-rw-r--r--arch/powerpc/kernel/cacheinfo.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index 40198d50b4c2..ae77b7e59889 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -607,19 +607,16 @@ static ssize_t shared_cpu_map_show(struct kobject *k, struct kobj_attribute *att
{
struct cache_index_dir *index;
struct cache *cache;
- int len;
- int n = 0;
+ int ret;
index = kobj_to_cache_index_dir(k);
cache = index->cache;
- len = PAGE_SIZE - 2;
- if (len > 1) {
- n = cpumask_scnprintf(buf, len, &cache->shared_cpu_map);
- buf[n++] = '\n';
- buf[n] = '\0';
- }
- return n;
+ ret = scnprintf(buf, PAGE_SIZE - 1, "%*pb\n",
+ cpumask_pr_args(&cache->shared_cpu_map));
+ buf[ret++] = '\n';
+ buf[ret] = '\0';
+ return ret;
}
static struct kobj_attribute cache_shared_cpu_map_attr =