From: Yang Jihong <yangjihong1@huawei.com>
To: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
<mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
<jolsa@kernel.org>, <namhyung@kernel.org>,
<colin.i.king@gmail.com>, <linux-kernel@vger.kernel.org>,
<linux-perf-users@vger.kernel.org>
Cc: <pc@us.ibm.com>, <yhs@fb.com>, <andrii.nakryiko@gmail.com>,
<songliubraving@fb.com>, <yangjihong1@huawei.com>
Subject: [PATCH v2 2/7] perf kwork: Replace hard-coded initialization of nr_tracepoints with ARRAY_SIZE macro
Date: Sat, 30 Jul 2022 11:03:30 +0800 [thread overview]
Message-ID: <20220730030335.78203-3-yangjihong1@huawei.com> (raw)
In-Reply-To: <20220730030335.78203-1-yangjihong1@huawei.com>
Use ARRAY_SIZE macro to replace hard-coded initialization of nr_tracepoints
for future changes.
Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
tools/perf/builtin-kwork.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
index ff17711a554a..2143280c2e95 100644
--- a/tools/perf/builtin-kwork.c
+++ b/tools/perf/builtin-kwork.c
@@ -817,7 +817,7 @@ static void irq_work_name(struct kwork_work *work, char *buf, int len)
static struct kwork_class kwork_irq = {
.name = "irq",
.type = KWORK_CLASS_IRQ,
- .nr_tracepoints = 2,
+ .nr_tracepoints = ARRAY_SIZE(irq_tp_handlers),
.tp_handlers = irq_tp_handlers,
.class_init = irq_class_init,
.work_init = irq_work_init,
@@ -938,7 +938,7 @@ static void softirq_work_name(struct kwork_work *work, char *buf, int len)
static struct kwork_class kwork_softirq = {
.name = "softirq",
.type = KWORK_CLASS_SOFTIRQ,
- .nr_tracepoints = 3,
+ .nr_tracepoints = ARRAY_SIZE(softirq_tp_handlers),
.tp_handlers = softirq_tp_handlers,
.class_init = softirq_class_init,
.work_init = softirq_work_init,
@@ -1035,7 +1035,7 @@ static void workqueue_work_name(struct kwork_work *work, char *buf, int len)
static struct kwork_class kwork_workqueue = {
.name = "workqueue",
.type = KWORK_CLASS_WORKQUEUE,
- .nr_tracepoints = 3,
+ .nr_tracepoints = ARRAY_SIZE(workqueue_tp_handlers),
.tp_handlers = workqueue_tp_handlers,
.class_init = workqueue_class_init,
.work_init = workqueue_work_init,
--
2.30.GIT
next prev parent reply other threads:[~2022-07-30 3:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-30 3:03 [PATCH v2 0/7] perf kwork: A couple of fixes according to review comments Yang Jihong
2022-07-30 3:03 ` [PATCH v2 1/7] perf kwork: Add '--synth task' option for record Yang Jihong
2022-07-30 3:03 ` Yang Jihong [this message]
2022-07-30 3:03 ` [PATCH v2 3/7] perf kwork: Fix spelling mistake: "Captuer" -> "Capture" Yang Jihong
2022-07-30 3:03 ` [PATCH v2 4/7] perf kwork: Fix spelling mistake: "PRINT_TIME_UNIT_MESC_WIDTH" -> "PRINT_TIME_UNIT_MSEC_WIDTH" Yang Jihong
2022-07-30 3:03 ` [PATCH v2 5/7] perf kwork: Strdup function name in workqueue_work_init Yang Jihong
2022-07-30 3:03 ` [PATCH v2 6/7] perf kwork: Expand capacity of bpf entries Yang Jihong
2022-07-30 3:03 ` [PATCH v2 7/7] perf kwork: Add some {} for multiline for/if blocks Yang Jihong
2022-08-06 9:37 ` [PATCH v2 0/7] perf kwork: A couple of fixes according to review comments Yang Jihong
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=20220730030335.78203-3-yangjihong1@huawei.com \
--to=yangjihong1@huawei.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrii.nakryiko@gmail.com \
--cc=colin.i.king@gmail.com \
--cc=jolsa@kernel.org \
--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=pc@us.ibm.com \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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
all inboxes | Powered by JetHome®