public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <ynorov@nvidia.com>
To: linux-kernel@vger.kernel.org,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Daniel Lezcano" <daniel.lezcano@kernel.org>,
	"Ingo Molnar" <mingo@kernel.org>,
	"James Clark" <james.clark@linaro.org>,
	"Kees Cook" <kees@kernel.org>,
	"Lukasz Luba" <lukasz.luba@arm.com>,
	"Madhavan Srinivasan" <maddy@linux.ibm.com>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Mike Leach" <mike.leach@linaro.org>,
	"Moritz Fischer" <mdf@kernel.org>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Russ Weight" <russ.weight@linux.dev>,
	"Shrikanth Hegde" <sshegde@linux.ibm.com>,
	"Suki K Poulose" <suzuki.poulose@arm.com>,
	"Tom Rix" <trix@redhat.com>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Xu Yilun" <yilun.xu@intel.com>,
	"Yury Norov" <yury.norov@gmail.com>,
	"Zhang Rui" <rui.zhang@intel.com>,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-fpga@vger.kernel.org, linux-pm@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
Cc: Yury Norov <ynorov@nvidia.com>, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH 3/5] coresight: don't use bitmap_print_to_pagebuf()
Date: Tue,  3 Mar 2026 15:08:39 -0500	[thread overview]
Message-ID: <20260303200842.124996-4-ynorov@nvidia.com> (raw)
In-Reply-To: <20260303200842.124996-1-ynorov@nvidia.com>

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

Suggested-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 .../hwtracing/coresight/coresight-cti-sysfs.c | 32 ++++++++-----------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
index 572b80ee96fb..26ec0d8ed181 100644
--- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
@@ -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 */
-- 
2.43.0


  parent reply	other threads:[~2026-03-03 20:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 20:08 [PATCH RESEND 0/5] bitmap: cleanup bitmaps printing Yury Norov
2026-03-03 20:08 ` [PATCH 1/5] powerpc/xive: simplify xive_spapr_debug_show() Yury Norov
2026-03-03 20:08 ` [PATCH 2/5] thermal: intel: switch cpumask_get() to using cpumask_print_to_pagebuf() Yury Norov
2026-03-03 20:08 ` Yury Norov [this message]
2026-03-03 20:08 ` [PATCH 4/5] lib/prime_numbers: drop temporary buffer in dump_primes() Yury Norov
2026-03-03 20:08 ` [PATCH 5/5] fpga: m10bmc-sec: switch show_canceled_csk() to using sysfs_emit() Yury Norov
2026-03-24  9:15   ` Xu Yilun
2026-03-24 18:38     ` Yury Norov
2026-03-25  7:25       ` Xu Yilun
2026-03-19 20:18 ` [PATCH RESEND 0/5] bitmap: cleanup bitmaps printing Yury Norov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260303200842.124996-4-ynorov@nvidia.com \
    --to=ynorov@nvidia.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=chleroy@kernel.org \
    --cc=coresight@lists.linaro.org \
    --cc=daniel.lezcano@kernel.org \
    --cc=james.clark@linaro.org \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lukasz.luba@arm.com \
    --cc=maddy@linux.ibm.com \
    --cc=mdf@kernel.org \
    --cc=mike.leach@linaro.org \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=russ.weight@linux.dev \
    --cc=sshegde@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox