time/sched_clock: Fix formatting of frequency reporting code
authorMaciej W. Rozycki <macro@orcam.me.uk>
Sun, 24 Apr 2022 11:47:30 +0000 (12:47 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 2 May 2022 12:29:04 +0000 (14:29 +0200)
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

index 4a95c0be9daf534939977d082015fcff27fe6dc2..8464c5acc91338baee78b465933d59daf5740d5d 100644 (file)
@@ -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 */