lkml.org 
[lkml]   [2022]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[tip: timers/core] time/sched_clock: Fix formatting of frequency reporting code
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@orcam.me.uk>
AuthorDate: Sun, 24 Apr 2022 12:47:30 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
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@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 | 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 */
\
 
 \ /
  Last update: 2022-05-02 14:32    [W:0.074 / U:1.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site