[tip: timers/core] time/sched_clock: Fix formatting of frequency reporting code

From: tip-bot2 for Maciej W. Rozycki
Date: Mon May 02 2022 - 08:31:42 EST


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@xxxxxxxxxxx>
AuthorDate: Sun, 24 Apr 2022 12:47:30 +01:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
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@xxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Acked-by: John Stultz <jstultz@xxxxxxxxxx>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204240148220.9383@xxxxxxxxxxxxxxxxx

---
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 */