From: Rujra Bhatt <braker.noob.kernel@gmail.com>
To: Greg KH <greg@kroah.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: Tue, 22 Jul 2025 09:22:57 +0530 [thread overview]
Message-ID: <CAG+54DZS36Lp3Wc2nh+uSR14GPOWK+LJePp-jW1oB13uGtiSHw@mail.gmail.com> (raw)
In-Reply-To: <2025071801-driveway-curly-698c@gregkh>
On Fri, Jul 18, 2025 at 5:18 PM Greg KH <greg@kroah.com> wrote:
>
> 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.
>
Hi Greg,
I appreciate your feedback.
I wanted to bring the formatting in line with the
latest guidance, especially since sysfs_emit() has become the recommended
method for sysfs output. I see now, though, that I should restrict myself to
using that helper only in the context of genuine bug fixes or in the course
of adding features.
I'll make sure to only use sysfs_emit() for new sysfs entries or when
modifying existing files for actual bugs or feature changes,
as per your guidance.
Thank you so much for pointing this out.
regards,
Rujra Bhatt
prev parent reply other threads:[~2025-07-22 3:53 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
2025-07-22 3:52 ` Rujra Bhatt [this message]
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=CAG+54DZS36Lp3Wc2nh+uSR14GPOWK+LJePp-jW1oB13uGtiSHw@mail.gmail.com \
--to=braker.noob.kernel@gmail.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=greg@kroah.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).