[PATCH] arc:kernel:perf_event.c : replaced sprintf with sysfs_emit()
Greg KH
greg at kroah.com
Fri Jul 18 04:47:56 PDT 2025
On Fri, Jul 18, 2025 at 03:57:20PM +0530, Rujra Bhatt wrote:
> Hi,
>
> On Sat, Jul 5, 2025 at 1:00 PM Rujra Bhatt <braker.noob.kernel at gmail.com> wrote:
> >
> > Replaced sprintf() with sysfs_emit() in sysfs*_show() function in
> > perf_event.c file to follow the kernel's guidelines from
> > documentation/filesystems/sysfs.rst
> > This will improve consistency, safety, and makes it easier to maintain
> > and update in future.
> >
> > Signed-off-by: Rujra Bhatt <braker.noob.kernel at gmail.com>
> > ---
> > arch/arc/kernel/perf_event.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
> > index ed6d4f0cd621..424ec072c441 100644
> > --- a/arch/arc/kernel/perf_event.c
> > +++ b/arch/arc/kernel/perf_event.c
> > @@ -648,7 +648,7 @@ static ssize_t arc_pmu_events_sysfs_show(struct device *dev,
> > struct perf_pmu_events_attr *pmu_attr;
> >
> > pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr);
> > - return sprintf(page, "event=0x%04llx\n", pmu_attr->id);
> > + return sysfs_emit(page, "event=0x%04llx\n", pmu_attr->id);
> > }
> >
> > /*
> > --
> > 2.43.0
> >
>
> Gentle reminder for the replacement of sprintf() with the sysfs_emit(), kindly
> review it.
Why is this required? There is no bug in the current code, so no need
to change it at all. Please just use sysfs_emit() for new sysfs files,
no need to churn the tree and change all existing entries, otherwise we
would have done this a long time ago when we introduced these functions.
thanks,
greg k-h
More information about the linux-snps-arc
mailing list