linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Maciej W. Rozycki" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	John Stultz <jstultz@google.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/core] time/sched_clock: Fix formatting of frequency reporting code
Date: Mon, 02 May 2022 12:31:32 -0000	[thread overview]
Message-ID: <165149469263.4207.2139248782239839767.tip-bot2@tip-bot2> (raw)
In-Reply-To: <alpine.DEB.2.21.2204240148220.9383@angie.orcam.me.uk>

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     f4b62e1e1137507268c2c63dc4e6da279dc58e9f
Gitweb:        https://git.kernel.org/tip/f4b62e1e1137507268c2c63dc4e6da279dc58e9f
Author:        Maciej W. Rozycki <macro@orcam.me.uk>
AuthorDate:    Sun, 24 Apr 2022 12:47:30 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 02 May 2022 14:29:04 +02:00

time/sched_clock: Fix formatting of frequency reporting code

Use flat rather than nested indentation for chained else/if clauses as 
per coding-style.rst:

	if (x == y) {
		..
	} else if (x > y) {
		...
	} else {
		....
	}

This also improves readability.

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204240148220.9383@angie.orcam.me.uk

---
 kernel/time/sched_clock.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index 4a95c0b..8464c5a 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -202,13 +202,11 @@ sched_clock_register(u64 (*read)(void), int bits, unsigned long rate)
 	if (r >= 4000000) {
 		r = DIV_ROUND_CLOSEST(r, 1000000);
 		r_unit = 'M';
+	} else if (r >= 4000) {
+		r = DIV_ROUND_CLOSEST(r, 1000);
+		r_unit = 'k';
 	} else {
-		if (r >= 4000) {
-			r = DIV_ROUND_CLOSEST(r, 1000);
-			r_unit = 'k';
-		} else {
-			r_unit = ' ';
-		}
+		r_unit = ' ';
 	}
 
 	/* Calculate the ns resolution of this counter */

      parent reply	other threads:[~2022-05-02 12:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24 11:47 [PATCH 0/3] sched_clock: Fixes for frequency reporting Maciej W. Rozycki
2022-04-24 11:47 ` [PATCH 1/3] sched_clock: Round the frequency reported to nearest rather than down Maciej W. Rozycki
2022-04-26 20:38   ` John Stultz
2022-05-02 12:31   ` [tip: timers/core] time/sched_clock: " tip-bot2 for Maciej W. Rozycki
2022-04-24 11:47 ` [PATCH 2/3] sched_clock: Use Hz as the unit for clock rate reporting below 4kHz Maciej W. Rozycki
2022-05-02 12:31   ` [tip: timers/core] time/sched_clock: " tip-bot2 for Maciej W. Rozycki
2022-04-24 11:47 ` [PATCH 3/3] sched_clock: Fix formatting of frequency reporting code Maciej W. Rozycki
2022-04-26 20:41   ` John Stultz
2022-05-02 12:31   ` tip-bot2 for Maciej W. Rozycki [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=165149469263.4207.2139248782239839767.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=tglx@linutronix.de \
    --cc=x86@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).