mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 7/7] perf kwork: Add some {} for multiline for/if blocks
Date: Sat, 30 Jul 2022 11:03:35 +0800	[thread overview]
Message-ID: <20220730030335.78203-8-yangjihong1@huawei.com> (raw)
In-Reply-To: <20220730030335.78203-1-yangjihong1@huawei.com>

Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 tools/perf/builtin-kwork.c | 47 ++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 20 deletions(-)

diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
index 33bcab2aafcd..f33666ca3ee6 100644
--- a/tools/perf/builtin-kwork.c
+++ b/tools/perf/builtin-kwork.c
@@ -177,9 +177,10 @@ static void setup_sorting(struct perf_kwork *kwork,
 
 	for (tok = strtok_r(str, ", ", &tmp);
 	     tok; tok = strtok_r(NULL, ", ", &tmp)) {
-		if (sort_dimension__add(kwork, tok, &kwork->sort_list) < 0)
+		if (sort_dimension__add(kwork, tok, &kwork->sort_list) < 0) {
 			usage_with_options_msg(usage_msg, options,
 					       "Unknown --sort key: `%s'", tok);
+		}
 	}
 
 	pr_debug("Sort order: %s\n", kwork->sort_order);
@@ -656,8 +657,9 @@ static void timehist_print_event(struct perf_kwork *kwork,
 		work->class->work_name(work, kwork_name,
 				       PRINT_KWORK_NAME_WIDTH);
 		printf(" %-*s ", PRINT_KWORK_NAME_WIDTH, kwork_name);
-	} else
+	} else {
 		printf(" %-*s ", PRINT_KWORK_NAME_WIDTH, "");
+	}
 
 	/*
 	 *runtime
@@ -669,11 +671,12 @@ static void timehist_print_event(struct perf_kwork *kwork,
 	/*
 	 * delaytime
 	 */
-	if (atom->prev != NULL)
+	if (atom->prev != NULL) {
 		printf(" %*.*f ", PRINT_LATENCY_WIDTH, RPINT_DECIMAL_WIDTH,
 		       (double)(atom->time - atom->prev->time) / NSEC_PER_MSEC);
-	else
+	} else {
 		printf(" %*s ", PRINT_LATENCY_WIDTH, " ");
+	}
 
 	/*
 	 * callchain
@@ -761,9 +764,10 @@ static int process_irq_handler_entry_event(struct perf_tool *tool,
 {
 	struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
 
-	if (kwork->tp_handler->entry_event)
+	if (kwork->tp_handler->entry_event) {
 		return kwork->tp_handler->entry_event(kwork, &kwork_irq,
 						      evsel, sample, machine);
+	}
 	return 0;
 }
 
@@ -774,9 +778,10 @@ static int process_irq_handler_exit_event(struct perf_tool *tool,
 {
 	struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
 
-	if (kwork->tp_handler->exit_event)
+	if (kwork->tp_handler->exit_event) {
 		return kwork->tp_handler->exit_event(kwork, &kwork_irq,
 						     evsel, sample, machine);
+	}
 	return 0;
 }
 
@@ -832,10 +837,10 @@ static int process_softirq_raise_event(struct perf_tool *tool,
 {
 	struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
 
-	if (kwork->tp_handler->raise_event)
+	if (kwork->tp_handler->raise_event) {
 		return kwork->tp_handler->raise_event(kwork, &kwork_softirq,
 						      evsel, sample, machine);
-
+	}
 	return 0;
 }
 
@@ -846,10 +851,10 @@ static int process_softirq_entry_event(struct perf_tool *tool,
 {
 	struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
 
-	if (kwork->tp_handler->entry_event)
+	if (kwork->tp_handler->entry_event) {
 		return kwork->tp_handler->entry_event(kwork, &kwork_softirq,
 						      evsel, sample, machine);
-
+	}
 	return 0;
 }
 
@@ -860,10 +865,10 @@ static int process_softirq_exit_event(struct perf_tool *tool,
 {
 	struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
 
-	if (kwork->tp_handler->exit_event)
+	if (kwork->tp_handler->exit_event) {
 		return kwork->tp_handler->exit_event(kwork, &kwork_softirq,
 						     evsel, sample, machine);
-
+	}
 	return 0;
 }
 
@@ -953,10 +958,10 @@ static int process_workqueue_activate_work_event(struct perf_tool *tool,
 {
 	struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
 
-	if (kwork->tp_handler->raise_event)
+	if (kwork->tp_handler->raise_event) {
 		return kwork->tp_handler->raise_event(kwork, &kwork_workqueue,
 						    evsel, sample, machine);
-
+	}
 	return 0;
 }
 
@@ -967,10 +972,10 @@ static int process_workqueue_execute_start_event(struct perf_tool *tool,
 {
 	struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
 
-	if (kwork->tp_handler->entry_event)
+	if (kwork->tp_handler->entry_event) {
 		return kwork->tp_handler->entry_event(kwork, &kwork_workqueue,
 						    evsel, sample, machine);
-
+	}
 	return 0;
 }
 
@@ -981,10 +986,10 @@ static int process_workqueue_execute_end_event(struct perf_tool *tool,
 {
 	struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
 
-	if (kwork->tp_handler->exit_event)
+	if (kwork->tp_handler->exit_event) {
 		return kwork->tp_handler->exit_event(kwork, &kwork_workqueue,
 						   evsel, sample, machine);
-
+	}
 	return 0;
 }
 
@@ -1253,9 +1258,10 @@ static void print_skipped_events(struct perf_kwork *kwork)
 		}
 	}
 
-	if (verbose > 0)
+	if (verbose > 0) {
 		printf("  INFO: use %lld atom pages\n",
 		       nr_list_entry(&kwork->atom_page_list));
+	}
 }
 
 static void print_bad_events(struct perf_kwork *kwork)
@@ -1332,10 +1338,11 @@ static int perf_kwork__check_config(struct perf_kwork *kwork,
 		return -1;
 	}
 
-	list_for_each_entry(class, &kwork->class_list, list)
+	list_for_each_entry(class, &kwork->class_list, list) {
 		if ((class->class_init != NULL) &&
 		    (class->class_init(class, session) != 0))
 			return -1;
+	}
 
 	if (kwork->cpu_list != NULL) {
 		ret = perf_session__cpu_bitmap(session,
-- 
2.30.GIT


  parent reply	other threads:[~2022-07-30  3:07 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 ` [PATCH v2 2/7] perf kwork: Replace hard-coded initialization of nr_tracepoints with ARRAY_SIZE macro Yang Jihong
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 ` Yang Jihong [this message]
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-8-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®