summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@orcam.me.uk>2022-04-24 12:47:30 +0100
committerThomas Gleixner <tglx@linutronix.de>2022-05-02 14:29:04 +0200
commitf4b62e1e1137507268c2c63dc4e6da279dc58e9f (patch)
tree874b659d1fec99375db5301aabf595b2f1e01cbc /kernel
parentcc1b923a4e378c943386e7fe6205918d43e5fede (diff)
downloadlinux-f4b62e1e1137507268c2c63dc4e6da279dc58e9f.tar.bz2
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')
-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 */