diff options
author | Tejun Heo <tj@kernel.org> | 2015-02-13 17:38:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:38 -0500 |
commit | 4497da6f950951b8819cd827bbebb8f214e8ecbe (patch) | |
tree | f5a7949c391b28d80d0aff33eb16ef74872ee2d2 /kernel | |
parent | 9e763e0f4f94d5f9ac8928867a4399ec3b3c7e33 (diff) |
padata: 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.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/padata.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/kernel/padata.c b/kernel/padata.c index 161402f0b517..b38bea9c466a 100644 --- a/kernel/padata.c +++ b/kernel/padata.c | |||
@@ -917,15 +917,10 @@ static ssize_t show_cpumask(struct padata_instance *pinst, | |||
917 | else | 917 | else |
918 | cpumask = pinst->cpumask.pcpu; | 918 | cpumask = pinst->cpumask.pcpu; |
919 | 919 | ||
920 | len = bitmap_scnprintf(buf, PAGE_SIZE, cpumask_bits(cpumask), | 920 | len = snprintf(buf, PAGE_SIZE, "%*pb\n", |
921 | nr_cpu_ids); | 921 | nr_cpu_ids, cpumask_bits(cpumask)); |
922 | if (PAGE_SIZE - len < 2) | ||
923 | len = -EINVAL; | ||
924 | else | ||
925 | len += sprintf(buf + len, "\n"); | ||
926 | |||
927 | mutex_unlock(&pinst->lock); | 922 | mutex_unlock(&pinst->lock); |
928 | return len; | 923 | return len < PAGE_SIZE ? len : -EINVAL; |
929 | } | 924 | } |
930 | 925 | ||
931 | static ssize_t store_cpumask(struct padata_instance *pinst, | 926 | static ssize_t store_cpumask(struct padata_instance *pinst, |