From: Greg KH <greg@kroah.com>
To: Rujra Bhatt <braker.noob.kernel@gmail.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
namhyung@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com,
kan.liang@linux.intel.com, vgupta@kernel.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-snps-arc@lists.infradead.org, skhan@linuxfoundation.org,
linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH] arc:kernel:perf_event.c : replaced sprintf with sysfs_emit()
Date: Fri, 18 Jul 2025 13:47:56 +0200 [thread overview]
Message-ID: <2025071801-driveway-curly-698c@gregkh> (raw)
In-Reply-To: <CAG+54DZQC+-6E-P3D4BUtVujNegL1qKpcB5SGh28+rX5hrHFiw@mail.gmail.com>
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@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@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
next prev parent reply other threads:[~2025-07-18 11:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-05 7:30 [PATCH] arc:kernel:perf_event.c : replaced sprintf with sysfs_emit() Rujra Bhatt
2025-07-18 10:27 ` Rujra Bhatt
2025-07-18 11:47 ` Greg KH [this message]
2025-07-22 3:52 ` Rujra Bhatt
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=2025071801-driveway-curly-698c@gregkh \
--to=greg@kroah.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=braker.noob.kernel@gmail.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=vgupta@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).