Re: [PATCH v2 01/11] arm: Use sysfs_emit() for cpumask show callbacks

Yury Norov <[email protected]>
Newsgroups org.infradead.lists.linux-amlogic,dev.linux.lists.driver-core,dev.linux.lists.imx,org.infradead.lists.linux-rockchip,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-cxl,org.kernel.vger.linux-fpga,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci,org.kernel.vger.linux-perf-users,org.kernel.vger.linux-pm,org.kernel.vger.linux-rdma,org.ozlabs.lists.linuxppc-dev
Message-ID <akaMUHFG4yYciZSJ@yury>
On Thu, Jul 02, 2026 at 05:58:11PM +0200, Greg Kroah-Hartman wrote:
> On Thu, Jul 02, 2026 at 11:47:14AM -0400, Yury Norov wrote:
> > These callbacks are sysfs show paths.
> > 
> > Use sysfs_emit() and cpumask_pr_args() to emit the masks.
> > 
> > This prepares for removing cpumap_print_to_pagebuf().
> > 
> > Signed-off-by: Yury Norov <[email protected]>
> > ---
> >  arch/arm/mach-imx/mmdc.c     | 2 +-
> >  arch/arm/mm/cache-l2x0-pmu.c | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c
> > index b71467c48b87..f6d993b9b1d4 100644
> > --- a/arch/arm/mach-imx/mmdc.c
> > +++ b/arch/arm/mach-imx/mmdc.c
> > @@ -127,7 +127,7 @@ static ssize_t mmdc_pmu_cpumask_show(struct device *dev,
> >  {
> >  	struct mmdc_pmu *pmu_mmdc = dev_get_drvdata(dev);
> >  
> > -	return cpumap_print_to_pagebuf(true, buf, &pmu_mmdc->cpu);
> > +	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&pmu_mmdc->cpu));
> 
> Really?  Looks like the original is much simpler to understand, why must
> this function go away?

Because it's a duplicate of printk("*pbl"), and nothing is simpler in
practice.

Because the 'true' vs 'false' parameter in cpumap_print_to_pagebuf() is much
harder to remember, comparing to "*pbl" vs "*pb" in the standard printk-like
API. And because the 'print_to_pagebuf' has a record of misuse.

For more details, see:

https://lore.kernel.org/all/akANJ-AT7nHpRMq-@yury/

Thanks,
Yury

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.