Skip to contentSkip to conversation

bitmap: cleanup bitmaps printing

PATCH RESEND Superseded Yury Norov 3 participants 15 messages Mar 3 – Apr 28

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yury Norov

author
#0 lore raw

cover bitmap: cleanup bitmaps printing

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(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/5 powerpc/xive: simplify xive_spapr_debug_show()

The function creates temporary buffer to convert xibm->bitmap to a human-readable list before passing it to seq_printf. Drop it and print the list by seq_printf() directly with the "%*pbl" specifier.

---
 arch/powerpc/sysdev/xive/spapr.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
arch/powerpc/sysdev/xive/spapr.c +2 -10
index 61f8a8acf81f..fdf52c78ac02 100644
@@ -667,17 +667,9 @@ static void xive_spapr_sync_source(u32 hw_irq)
 static int xive_spapr_debug_show(struct seq_file *m, void *private)
 {
 	struct xive_irq_bitmap *xibm;
-	char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
 
-	if (!buf)
-		return -ENOMEM;
-
-	list_for_each_entry(xibm, &xive_irq_bitmaps, list) {
-		memset(buf, 0, PAGE_SIZE);
-		bitmap_print_to_pagebuf(true, buf, xibm->bitmap, xibm->count);
-		seq_printf(m, "bitmap #%d: %s", xibm->count, buf);
-	}
-	kfree(buf);
+	list_for_each_entry(xibm, &xive_irq_bitmaps, list)
+		seq_printf(m, "bitmap #%d: %*pbl\n", xibm->count, xibm->count, xibm->bitmap);
 
 	return 0;
 }
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH 2/5 thermal: intel: switch cpumask_get() to using cpumask_print_to_pagebuf()

In reply to Yury Norov

The function opencodes cpumask_print_to_pagebuf() with more generic bitmap_print_to_pagebuf(). Switch to using the proper API.

---
 drivers/thermal/intel/intel_powerclamp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +1 -2
index 9a4cec000910..ccf380da12f2 100644
@@ -200,8 +200,7 @@ static int cpumask_get(char *buf, const struct kernel_param *kp)
 	if (!cpumask_available(idle_injection_cpu_mask))
 		return -ENODEV;
 
-	return bitmap_print_to_pagebuf(false, buf, cpumask_bits(idle_injection_cpu_mask),
-				       nr_cpumask_bits);
+	return cpumap_print_to_pagebuf(false, buf, idle_injection_cpu_mask);
 }
 
 static const struct kernel_param_ops cpumask_ops = {
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH 3/5 coresight: don't use bitmap_print_to_pagebuf()

In reply to Yury Norov

Switch the driver to using the proper sysfs_emit("%*pbl") where appropriate.

---
 .../hwtracing/coresight/coresight-cti-sysfs.c | 32 ++++++++-----------
 1 file changed, 14 insertions(+), 18 deletions(-)
drivers/hwtracing/coresight/coresight-cti-sysfs.c +14 -18
index 572b80ee96fb..26ec0d8ed181 100644
@@ -606,14 +606,11 @@ static ssize_t chan_gate_enable_show(struct device *dev,
 	struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
 	struct cti_config *cfg = &drvdata->config;
 	unsigned long ctigate_bitmask = cfg->ctigate;
-	int size = 0;
 
 	if (cfg->ctigate == 0)
-		size = sprintf(buf, "\n");
-	else
-		size = bitmap_print_to_pagebuf(true, buf, &ctigate_bitmask,
-					       cfg->nr_ctm_channels);
-	return size;
+		return sprintf(buf, "\n");
+
+	return sysfs_emit(buf, "%*pbl\n", cfg->nr_ctm_channels, &ctigate_bitmask);
 }
 static DEVICE_ATTR_RW(chan_gate_enable);
 
@@ -710,12 +707,13 @@ static ssize_t trigout_filtered_show(struct device *dev,
 {
 	struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
 	struct cti_config *cfg = &drvdata->config;
-	int size = 0, nr_trig_max = cfg->nr_trig_max;
+	int nr_trig_max = cfg->nr_trig_max;
 	unsigned long mask = cfg->trig_out_filter;
 
-	if (mask)
-		size = bitmap_print_to_pagebuf(true, buf, &mask, nr_trig_max);
-	return size;
+	if (mask == 0)
+		return 0;
+
+	return sysfs_emit(buf, "%*pbl\n", nr_trig_max, &mask);
 }
 static DEVICE_ATTR_RO(trigout_filtered);
 
@@ -834,7 +832,7 @@ static ssize_t print_chan_list(struct device *dev,
 {
 	struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
 	struct cti_config *config = &drvdata->config;
-	int size, i;
+	int i;
 	unsigned long inuse_bits = 0, chan_mask;
 
 	/* scan regs to get bitmap of channels in use. */
@@ -852,11 +850,9 @@ static ssize_t print_chan_list(struct device *dev,
 	/* list of channels, or 'none' */
 	chan_mask = GENMASK(config->nr_ctm_channels - 1, 0);
 	if (inuse_bits & chan_mask)
-		size = bitmap_print_to_pagebuf(true, buf, &inuse_bits,
-					       config->nr_ctm_channels);
-	else
-		size = sprintf(buf, "\n");
-	return size;
+		return sysfs_emit(buf, "%*pbl\n", config->nr_ctm_channels, &inuse_bits);
+
+	return sprintf(buf, "\n");
 }
 
 static ssize_t chan_inuse_show(struct device *dev,
@@ -928,7 +924,7 @@ static ssize_t trigin_sig_show(struct device *dev,
 	struct cti_config *cfg = &drvdata->config;
 	unsigned long mask = con->con_in->used_mask;
 
-	return bitmap_print_to_pagebuf(true, buf, &mask, cfg->nr_trig_max);
+	return sysfs_emit(buf, "%*pbl\n", cfg->nr_trig_max, &mask);
 }
 
 static ssize_t trigout_sig_show(struct device *dev,
@@ -942,7 +938,7 @@ static ssize_t trigout_sig_show(struct device *dev,
 	struct cti_config *cfg = &drvdata->config;
 	unsigned long mask = con->con_out->used_mask;
 
-	return bitmap_print_to_pagebuf(true, buf, &mask, cfg->nr_trig_max);
+	return sysfs_emit(buf, "%*pbl\n", cfg->nr_trig_max, &mask);
 }
 
 /* convert a sig type id to a name */
Signature · 1 line
2.43.0
author
#4 lore raw

PATCH 4/5 lib/prime_numbers: drop temporary buffer in dump_primes()

In reply to Yury Norov

The function uses temporary buffer to convert primes bitmap into human readable format. Switch to using kunit_info("%*pbl")", and drop the buffer.

---
 lib/math/tests/prime_numbers_kunit.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
lib/math/tests/prime_numbers_kunit.c +2 -4
index 2f1643208c66..55ac160c6dfa 100644
@@ -8,12 +8,10 @@
 
 static void dump_primes(void *ctx, const struct primes *p)
 {
-	static char buf[PAGE_SIZE];
 	struct kunit_suite *suite = ctx;
 
-	bitmap_print_to_pagebuf(true, buf, p->primes, p->sz);
-	kunit_info(suite, "primes.{last=%lu, .sz=%lu, .primes[]=...x%lx} = %s",
-		   p->last, p->sz, p->primes[BITS_TO_LONGS(p->sz) - 1], buf);
+	kunit_info(suite, "primes.{last=%lu, .sz=%lu, .primes[]=...x%lx} = %*pbl",
+		   p->last, p->sz, p->primes[BITS_TO_LONGS(p->sz) - 1], (int)p->sz, p->primes);
 }
 
 static void prime_numbers_test(struct kunit *test)
Signature · 1 line
2.43.0
author
#5 lore raw

PATCH 5/5 fpga: m10bmc-sec: switch show_canceled_csk() to using sysfs_emit()

In reply to Yury Norov

Switch show_canceled_csk() to use the proper sysfs_emit("%*pbl").

---
 drivers/fpga/intel-m10-bmc-sec-update.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/fpga/intel-m10-bmc-sec-update.c +2 -1
index 10f678b9ed36..ae364c6636eb 100644
@@ -10,6 +10,7 @@
 #include <linux/firmware.h>
 #include <linux/mfd/intel-m10-bmc.h>
 #include <linux/mod_devicetable.h>
+#include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
@@ -183,7 +184,7 @@ show_canceled_csk(struct device *dev, u32 addr, char *buf)
 
 	bitmap_from_arr32(csk_map, csk32, CSK_BIT_LEN);
 	bitmap_complement(csk_map, csk_map, CSK_BIT_LEN);
-	return bitmap_print_to_pagebuf(1, buf, csk_map, CSK_BIT_LEN);
+	return sysfs_emit(buf, "%*pbl\n", CSK_BIT_LEN, csk_map);
 }
 
 #define DEVICE_ATTR_SEC_CSK_RO(_name)						\
Signature · 1 line
2.43.0
#6 lore raw

Re: [PATCH 5/5] fpga: m10bmc-sec: switch show_canceled_csk() to using sysfs_emit()

Quoted 14 lines · Yury Norov

Switch show_canceled_csk() to use the proper sysfs_emit("%*pbl").

---
 drivers/fpga/intel-m10-bmc-sec-update.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/fpga/intel-m10-bmc-sec-update.c +0 -0
index 10f678b9ed36..ae364c6636eb 100644

drivers/fpga/intel-m10-bmc-sec-update.c line 13

Quoted 4 lines
drivers/fpga/intel-m10-bmc-sec-update.c +1 -0
@@ -10,6 +10,7 @@
 #include <linux/firmware.h>
 #include <linux/mfd/intel-m10-bmc.h>
 #include <linux/mod_devicetable.h>
+#include <linux/mm.h>

Why add this header file?

Thanks,
Yilun

Quoted 16 lines
drivers/fpga/intel-m10-bmc-sec-update.c +1 -1
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
@@ -183,7 +184,7 @@ show_canceled_csk(struct device *dev, u32 addr, char *buf)
 
 	bitmap_from_arr32(csk_map, csk32, CSK_BIT_LEN);
 	bitmap_complement(csk_map, csk_map, CSK_BIT_LEN);
-	return bitmap_print_to_pagebuf(1, buf, csk_map, CSK_BIT_LEN);
+	return sysfs_emit(buf, "%*pbl\n", CSK_BIT_LEN, csk_map);
 }
 
 #define DEVICE_ATTR_SEC_CSK_RO(_name)						\
Signature · 1 line
2.43.0
author
#7 lore raw

Re: [PATCH 5/5] fpga: m10bmc-sec: switch show_canceled_csk() to using sysfs_emit()

Quoted 10 lines · Xu Yilun
Quoted 9 lines · Yury Norov

Switch show_canceled_csk() to use the proper sysfs_emit("%*pbl").

---
 drivers/fpga/intel-m10-bmc-sec-update.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 11 lines

drivers/fpga/intel-m10-bmc-sec-update.c line 13

Quoted 9 lines
drivers/fpga/intel-m10-bmc-sec-update.c +1 -0
index 10f678b9ed36..ae364c6636eb 100644
@@ -10,6 +10,7 @@
 #include <linux/firmware.h>
 #include <linux/mfd/intel-m10-bmc.h>
 #include <linux/mod_devicetable.h>
+#include <linux/mm.h>

Why add this header file?

When I was preparing the series, I had build issues without this. But now I checked it against -rc5, and it's clean. Would you like me to resend?

Quoted 16 lines
Quoted 16 lines
drivers/fpga/intel-m10-bmc-sec-update.c +1 -1
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
@@ -183,7 +184,7 @@ show_canceled_csk(struct device *dev, u32 addr, char *buf)
 
 	bitmap_from_arr32(csk_map, csk32, CSK_BIT_LEN);
 	bitmap_complement(csk_map, csk_map, CSK_BIT_LEN);
-	return bitmap_print_to_pagebuf(1, buf, csk_map, CSK_BIT_LEN);
+	return sysfs_emit(buf, "%*pbl\n", CSK_BIT_LEN, csk_map);
 }
 
 #define DEVICE_ATTR_SEC_CSK_RO(_name)						\
Signature · 1 line
2.43.0
Reviewed-by
#8 lore raw

Re: [PATCH 5/5] fpga: m10bmc-sec: switch show_canceled_csk() to using sysfs_emit()

Quoted 23 lines · Yury Norov
Quoted 10 lines · Xu Yilun
Quoted 9 lines · Yury Norov

Switch show_canceled_csk() to use the proper sysfs_emit("%*pbl").

---
 drivers/fpga/intel-m10-bmc-sec-update.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 11 lines

drivers/fpga/intel-m10-bmc-sec-update.c line 13

Quoted 9 lines
drivers/fpga/intel-m10-bmc-sec-update.c +1 -0
index 10f678b9ed36..ae364c6636eb 100644
@@ -10,6 +10,7 @@
 #include <linux/firmware.h>
 #include <linux/mfd/intel-m10-bmc.h>
 #include <linux/mod_devicetable.h>
+#include <linux/mm.h>

Why add this header file?

Quoted 3 lines

When I was preparing the series, I had build issues without this. But now I checked it against -rc5, and it's clean. Would you like me to resend?

No need. Given that I'll pick this patch alone to fpga for-next with the fix.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
drivers/fpga/intel-m10-bmc-sec-update.c +1 -1
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
@@ -183,7 +184,7 @@ show_canceled_csk(struct device *dev, u32 addr, char *buf)
 
 	bitmap_from_arr32(csk_map, csk32, CSK_BIT_LEN);
 	bitmap_complement(csk_map, csk_map, CSK_BIT_LEN);
-	return bitmap_print_to_pagebuf(1, buf, csk_map, CSK_BIT_LEN);
+	return sysfs_emit(buf, "%*pbl\n", CSK_BIT_LEN, csk_map);
 }
 
 #define DEVICE_ATTR_SEC_CSK_RO(_name)						\
Signature · 1 line
2.43.0
author
#9 lore raw

Re: [PATCH 5/5] fpga: m10bmc-sec: switch show_canceled_csk() to using sysfs_emit()

Quoted 24 lines · Xu Yilun
Quoted 23 lines · Yury Norov
Quoted 21 lines · Xu Yilun
Quoted 14 lines · Yury Norov

Switch show_canceled_csk() to use the proper sysfs_emit("%*pbl").

---
 drivers/fpga/intel-m10-bmc-sec-update.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/fpga/intel-m10-bmc-sec-update.c +0 -0
index 10f678b9ed36..ae364c6636eb 100644

drivers/fpga/intel-m10-bmc-sec-update.c line 13

Quoted 4 lines
drivers/fpga/intel-m10-bmc-sec-update.c +1 -0
@@ -10,6 +10,7 @@
 #include <linux/firmware.h>
 #include <linux/mfd/intel-m10-bmc.h>
 #include <linux/mod_devicetable.h>
+#include <linux/mm.h>

Why add this header file?

Quoted 8 lines
Quoted 3 lines

When I was preparing the series, I had build issues without this. But now I checked it against -rc5, and it's clean. Would you like me to resend?

No need. Given that I'll pick this patch alone to fpga for-next with the fix.

Hi Xu,

This patch is still not applied. This is the last non-lib user of the bitmap_print_to_pagebuf(), and it blocks me from removing the function.

Are you still going to pick it yourself? I can move the patch with bitmap-for-next if you prefer.

Thanks,
Yury

#10 lore raw

Re: [PATCH 5/5] fpga: m10bmc-sec: switch show_canceled_csk() to using sysfs_emit()

Quoted 29 lines · Yury Norov
Quoted 28 lines · Xu Yilun
Quoted 26 lines · Yury Norov
Quoted 10 lines · Xu Yilun
Quoted 9 lines · Yury Norov

Switch show_canceled_csk() to use the proper sysfs_emit("%*pbl").

---
 drivers/fpga/intel-m10-bmc-sec-update.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 11 lines

drivers/fpga/intel-m10-bmc-sec-update.c line 13

Quoted 9 lines
drivers/fpga/intel-m10-bmc-sec-update.c +1 -0
index 10f678b9ed36..ae364c6636eb 100644
@@ -10,6 +10,7 @@
 #include <linux/firmware.h>
 #include <linux/mfd/intel-m10-bmc.h>
 #include <linux/mod_devicetable.h>
+#include <linux/mm.h>

Why add this header file?

When I was preparing the series, I had build issues without this. But now I checked it against -rc5, and it's clean. Would you like me to resend?

Quoted 8 lines
Quoted 4 lines

No need. Given that I'll pick this patch alone to fpga for-next with the fix.

Hi Xu,

This patch is still not applied. This is the last non-lib user of

I see it is already in v7.1-rc1, what's your expectation?

Quoted 8 lines

the bitmap_print_to_pagebuf(), and it blocks me from removing the function.

Are you still going to pick it yourself? I can move the patch with bitmap-for-next if you prefer.

Thanks,
Yury

author
#11 lore raw

Re: [PATCH 5/5] fpga: m10bmc-sec: switch show_canceled_csk() to using sysfs_emit()

Quoted 33 lines · Xu Yilun
Quoted 32 lines · Yury Norov
Quoted 31 lines · Xu Yilun
Quoted 23 lines · Yury Norov
Quoted 10 lines · Xu Yilun
Quoted 9 lines · Yury Norov

Switch show_canceled_csk() to use the proper sysfs_emit("%*pbl").

---
 drivers/fpga/intel-m10-bmc-sec-update.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 11 lines

drivers/fpga/intel-m10-bmc-sec-update.c line 13

Quoted 9 lines
drivers/fpga/intel-m10-bmc-sec-update.c +1 -0
index 10f678b9ed36..ae364c6636eb 100644
@@ -10,6 +10,7 @@
 #include <linux/firmware.h>
 #include <linux/mfd/intel-m10-bmc.h>
 #include <linux/mod_devicetable.h>
+#include <linux/mm.h>

Why add this header file?

Quoted 3 lines

When I was preparing the series, I had build issues without this. But now I checked it against -rc5, and it's clean. Would you like me to resend?

No need. Given that I'll pick this patch alone to fpga for-next with the fix.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Hi Xu,

This patch is still not applied. This is the last non-lib user of

I see it is already in v7.1-rc1, what's your expectation?

Oops, sorry. It's me not moving on the tip of the tree. Sorry for the noise.

author
#12 lore raw
In reply to Yury Norov

Ping?

Quoted 38 lines · Yury Norov

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(-)
Signature · 1 line
2.43.0
author
#13 lore raw
Quoted 1 line · Yury Norov

Ping?

OK, taking 1-4 in bitmap-for-next.

Thanks,
Yury

Quoted 39 lines · Yury Norov
Quoted 38 lines

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(-)
Signature · 1 line
2.43.0
maintainer Acked-by
#14 lore raw
Quoted 3 lines · Yury Norov
Quoted 1 line · Yury Norov

Ping?

OK, taking 1-4 in bitmap-for-next.

Quoted 43 lines

Thanks,
Yury

Quoted 39 lines · Yury Norov
Quoted 38 lines

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(-)
Signature · 1 line
2.43.0