summaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@orcam.me.uk>2022-04-24 13:47:30 +0200
committerThomas Gleixner <tglx@linutronix.de>2022-05-02 14:29:04 +0200
commitf4b62e1e1137507268c2c63dc4e6da279dc58e9f (patch)
tree874b659d1fec99375db5301aabf595b2f1e01cbc /kernel/time
parenttime/sched_clock: Use Hz as the unit for clock rate reporting below 4kHz (diff)
downloadlinux-f4b62e1e1137507268c2c63dc4e6da279dc58e9f.tar.xz
linux-f4b62e1e1137507268c2c63dc4e6da279dc58e9f.zip
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
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/sched_clock.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index 4a95c0be9daf..8464c5acc913 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 */