Skip to content

Commit 0b48003

Browse files
htejuntorvalds
authored andcommitted
input: 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. * Line termination only requires one extra space at the end of the buffer. Use PAGE_SIZE - 1 instead of PAGE_SIZE - 2 when formatting. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8986003 commit 0b48003

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/input/keyboard/atkbd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,8 +1399,8 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun
13991399

14001400
static ssize_t atkbd_show_force_release(struct atkbd *atkbd, char *buf)
14011401
{
1402-
size_t len = bitmap_scnlistprintf(buf, PAGE_SIZE - 2,
1403-
atkbd->force_release_mask, ATKBD_KEYMAP_SIZE);
1402+
size_t len = scnprintf(buf, PAGE_SIZE - 1, "%*pbl",
1403+
ATKBD_KEYMAP_SIZE, atkbd->force_release_mask);
14041404

14051405
buf[len++] = '\n';
14061406
buf[len] = '\0';

drivers/input/keyboard/gpio_keys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static ssize_t gpio_keys_attr_show_helper(struct gpio_keys_drvdata *ddata,
190190
__set_bit(bdata->button->code, bits);
191191
}
192192

193-
ret = bitmap_scnlistprintf(buf, PAGE_SIZE - 2, bits, n_events);
193+
ret = scnprintf(buf, PAGE_SIZE - 1, "%*pbl", n_events, bits);
194194
buf[ret++] = '\n';
195195
buf[ret] = '\0';
196196

0 commit comments

Comments
 (0)