Skip to content

Commit

Permalink
padata: use %*pb[l] to print bitmaps including cpumasks and nodemasks
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Steffen Klassert <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
htejun authored and torvalds committed Feb 14, 2015
1 parent 9e763e0 commit 4497da6
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions kernel/padata.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,15 +917,10 @@ static ssize_t show_cpumask(struct padata_instance *pinst,
else
cpumask = pinst->cpumask.pcpu;

len = bitmap_scnprintf(buf, PAGE_SIZE, cpumask_bits(cpumask),
nr_cpu_ids);
if (PAGE_SIZE - len < 2)
len = -EINVAL;
else
len += sprintf(buf + len, "\n");

len = snprintf(buf, PAGE_SIZE, "%*pb\n",
nr_cpu_ids, cpumask_bits(cpumask));
mutex_unlock(&pinst->lock);
return len;
return len < PAGE_SIZE ? len : -EINVAL;
}

static ssize_t store_cpumask(struct padata_instance *pinst,
Expand Down

0 comments on commit 4497da6

Please sign in to comment.