diff options
author | Tejun Heo <tj@kernel.org> | 2015-02-13 17:37:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:36 -0500 |
commit | 0c118b7bd09a1d11731ba80421a34ea1105c5b21 (patch) | |
tree | be234b03db60a78d856fb4c947d3424dcaf44e73 /arch/powerpc | |
parent | 729d8e093c3ec5c662965c97accd882a75b0f93a (diff) |
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')
-rw-r--r-- | arch/powerpc/kernel/cacheinfo.c | 15 | ||||
-rw-r--r-- | arch/powerpc/sysdev/xics/ics-opal.c | 6 | ||||
-rw-r--r-- | arch/powerpc/sysdev/xics/ics-rtas.c | 7 |
3 files changed, 10 insertions, 18 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 | |||
607 | { | 607 | { |
608 | struct cache_index_dir *index; | 608 | struct cache_index_dir *index; |
609 | struct cache *cache; | 609 | struct cache *cache; |
610 | int len; | 610 | int ret; |
611 | int n = 0; | ||
612 | 611 | ||
613 | index = kobj_to_cache_index_dir(k); | 612 | index = kobj_to_cache_index_dir(k); |
614 | cache = index->cache; | 613 | cache = index->cache; |
615 | len = PAGE_SIZE - 2; | ||
616 | 614 | ||
617 | if (len > 1) { | 615 | ret = scnprintf(buf, PAGE_SIZE - 1, "%*pb\n", |
618 | n = cpumask_scnprintf(buf, len, &cache->shared_cpu_map); | 616 | cpumask_pr_args(&cache->shared_cpu_map)); |
619 | buf[n++] = '\n'; | 617 | buf[ret++] = '\n'; |
620 | buf[n] = '\0'; | 618 | buf[ret] = '\0'; |
621 | } | 619 | return ret; |
622 | return n; | ||
623 | } | 620 | } |
624 | 621 | ||
625 | static struct kobj_attribute cache_shared_cpu_map_attr = | 622 | static struct kobj_attribute cache_shared_cpu_map_attr = |
diff --git a/arch/powerpc/sysdev/xics/ics-opal.c b/arch/powerpc/sysdev/xics/ics-opal.c index 4ba554ec8eaf..68c7e5cc98e0 100644 --- a/arch/powerpc/sysdev/xics/ics-opal.c +++ b/arch/powerpc/sysdev/xics/ics-opal.c | |||
@@ -131,10 +131,8 @@ static int ics_opal_set_affinity(struct irq_data *d, | |||
131 | 131 | ||
132 | wanted_server = xics_get_irq_server(d->irq, cpumask, 1); | 132 | wanted_server = xics_get_irq_server(d->irq, cpumask, 1); |
133 | if (wanted_server < 0) { | 133 | if (wanted_server < 0) { |
134 | char cpulist[128]; | 134 | pr_warning("%s: No online cpus in the mask %*pb for irq %d\n", |
135 | cpumask_scnprintf(cpulist, sizeof(cpulist), cpumask); | 135 | __func__, cpumask_pr_args(cpumask), d->irq); |
136 | pr_warning("%s: No online cpus in the mask %s for irq %d\n", | ||
137 | __func__, cpulist, d->irq); | ||
138 | return -1; | 136 | return -1; |
139 | } | 137 | } |
140 | server = ics_opal_mangle_server(wanted_server); | 138 | server = ics_opal_mangle_server(wanted_server); |
diff --git a/arch/powerpc/sysdev/xics/ics-rtas.c b/arch/powerpc/sysdev/xics/ics-rtas.c index bc81335b2cbc..0af97deb83f3 100644 --- a/arch/powerpc/sysdev/xics/ics-rtas.c +++ b/arch/powerpc/sysdev/xics/ics-rtas.c | |||
@@ -140,11 +140,8 @@ static int ics_rtas_set_affinity(struct irq_data *d, | |||
140 | 140 | ||
141 | irq_server = xics_get_irq_server(d->irq, cpumask, 1); | 141 | irq_server = xics_get_irq_server(d->irq, cpumask, 1); |
142 | if (irq_server == -1) { | 142 | if (irq_server == -1) { |
143 | char cpulist[128]; | 143 | pr_warning("%s: No online cpus in the mask %*pb for irq %d\n", |
144 | cpumask_scnprintf(cpulist, sizeof(cpulist), cpumask); | 144 | __func__, cpumask_pr_args(cpumask), d->irq); |
145 | printk(KERN_WARNING | ||
146 | "%s: No online cpus in the mask %s for irq %d\n", | ||
147 | __func__, cpulist, d->irq); | ||
148 | return -1; | 145 | return -1; |
149 | } | 146 | } |
150 | 147 | ||