public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: <yang.yang29@zte.com.cn>
To: <mingo@redhat.com>
Cc: <acme@kernel.org>, <mark.rutland@arm.com>,
	<alexander.shishkin@linux.intel.com>, <jolsa@kernel.org>,
	<namhyung@kernel.org>, <irogers@google.com>,
	<james.clark@arm.com>, <kan.liang@linux.intel.com>,
	<zhengjun.xing@linux.intel.com>, <cjense@google.com>,
	<linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <xu.panda@zte.com.cn>,
	<yang.yang29@zte.com.cn>
Subject: [PATCH linux-next] perf stat: use sysfs_streq() instead of strncmp()
Date: Tue, 22 Nov 2022 20:11:00 +0800 (CST)	[thread overview]
Message-ID: <202211222011006572179@zte.com.cn> (raw)

From: Xu Panda <xu.panda@zte.com.cn>

Replace the open-code with sysfs_streq().

Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
---
 tools/perf/util/stat-display.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index f5501760ff2e..1fd9f7e9d2a1 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -463,7 +463,7 @@ static bool valid_only_metric(const char *unit)
 static const char *fixunit(char *buf, struct evsel *evsel,
 			   const char *unit)
 {
-	if (!strncmp(unit, "of all", 6)) {
+	if (sysfs_streq(unit, "of all")) {
 		snprintf(buf, 1024, "%s %s", evsel__name(evsel),
 			 unit);
 		return buf;
@@ -767,8 +767,7 @@ static void uniquify_event_name(struct evsel *counter)
 	int ret = 0;

 	if (counter->uniquified_name || counter->use_config_name ||
-	    !counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
-					   strlen(counter->pmu_name)))
+	    !counter->pmu_name || sysfs_streq(counter->name, counter->pmu_name))
 		return;

 	config = strchr(counter->name, '/');
-- 
2.15.2

             reply	other threads:[~2022-11-22 12:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 12:11 yang.yang29 [this message]
2022-11-22 18:31 ` [PATCH linux-next] perf stat: use sysfs_streq() instead of strncmp() Namhyung Kim

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=202211222011006572179@zte.com.cn \
    --to=yang.yang29@zte.com.cn \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=cjense@google.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=xu.panda@zte.com.cn \
    --cc=zhengjun.xing@linux.intel.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