Bitmap API has a bitmap_print_to_pagebuf() function that is intended to
print bitmap into a human readable format, making sure that the output
string will not get big enough to cross the current page limit.

Some drivers use this function immediately before passing the result to
scnprintf() with no modification. This is useless because scnprintf(),
and helpers based on it like seq_pritf() and sysfs_emit(), take care of
not overflowing the buffer by itself, and perfectly print bitmaps with
"%*pb[l]".

This is a resend of non-networking part of [1]. Patches #3,5 switch from
plain scnprintf() to sysfs_emit(), as pointed out by Thomas Weißschuh.

[1] https://lore.kernel.org/all/[email protected]/

The networking part, for reference:

https://lore.kernel.org/all/[email protected]/

Each patch can be applied individually per corresponding subsystem.

Yury Norov (5):
  powerpc/xive: simplify xive_spapr_debug_show()
  thermal: intel: switch cpumask_get() to using
    cpumask_print_to_pagebuf()
  coresight: don't use bitmap_print_to_pagebuf()
  lib/prime_numbers: drop temporary buffer in dump_primes()
  fpga: m10bmc-sec: switch show_canceled_csk() to using sysfs_emit()

 arch/powerpc/sysdev/xive/spapr.c              | 12 ++-----
 drivers/fpga/intel-m10-bmc-sec-update.c       |  3 +-
 .../hwtracing/coresight/coresight-cti-sysfs.c | 32 ++++++++-----------
 drivers/thermal/intel/intel_powerclamp.c      |  3 +-
 lib/math/tests/prime_numbers_kunit.c          |  6 ++--
 5 files changed, 21 insertions(+), 35 deletions(-)

-- 
2.43.0


Reply via email to