[PATCH 3/3] sched_clock: Fix formatting of frequency reporting code

From: Maciej W. Rozycki
Date: Sun Apr 24 2022 - 07:47:51 EST


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>
Fixes: 32fea568aec5b ("timers, sched/clock: Clean up the code a bit")
---
Hi,

I guess this got broken with 32fea568aec5b by mistake.

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

linux-sched-clock-rate-cond.diff
Index: linux-macro/kernel/time/sched_clock.c
===================================================================
--- linux-macro.orig/kernel/time/sched_clock.c
+++ linux-macro/kernel/time/sched_clock.c
@@ -202,13 +202,11 @@ sched_clock_register(u64 (*read)(void),
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 */