lkml.org 
[lkml]   [2022]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2/5] perf kwork: Replace hard-coded initialization of nr_tracepoints with ARRAY_SIZE macro
    Date
    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
    \
     
     \ /
      Last update: 2022-07-28 14:03    [W:3.525 / U:0.084 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site