timekeeping: Consistently use unsigned int for seqcount snapshot
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Mon, 18 Mar 2019 19:55:56 +0000 (20:55 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 23 Mar 2019 10:43:56 +0000 (11:43 +0100)
The timekeeping code uses a random mix of "unsigned long" and "unsigned
int" for the seqcount snapshots (ratio 14:12). Since the seqlock.h API is
entirely based on unsigned int, use that throughout.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Link: https://lkml.kernel.org/r/20190318195557.20773-1-linux@rasmusvillemoes.dk
kernel/time/jiffies.c
kernel/time/sched_clock.c
kernel/time/tick-common.c
kernel/time/tick-sched.c
kernel/time/timekeeping.c

index dc1b6f1..95f8f33 100644 (file)
@@ -63,7 +63,7 @@ __cacheline_aligned_in_smp DEFINE_SEQLOCK(jiffies_lock);
 #if (BITS_PER_LONG < 64)
 u64 get_jiffies_64(void)
 {
-       unsigned long seq;
+       unsigned int seq;
        u64 ret;
 
        do {
index 094b82c..16b80c2 100644 (file)
@@ -94,7 +94,7 @@ static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift)
 unsigned long long notrace sched_clock(void)
 {
        u64 cyc, res;
-       unsigned long seq;
+       unsigned int seq;
        struct clock_read_data *rd;
 
        do {
@@ -267,7 +267,7 @@ void __init generic_sched_clock_init(void)
  */
 static u64 notrace suspended_sched_clock_read(void)
 {
-       unsigned long seq = raw_read_seqcount(&cd.seq);
+       unsigned int seq = raw_read_seqcount(&cd.seq);
 
        return cd.read_data[seq & 1].epoch_cyc;
 }
index 529143b..561641b 100644 (file)
@@ -149,7 +149,7 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
            !tick_broadcast_oneshot_active()) {
                clockevents_switch_state(dev, CLOCK_EVT_STATE_PERIODIC);
        } else {
-               unsigned long seq;
+               unsigned int seq;
                ktime_t next;
 
                do {
index 6fa52cd..b50f6f2 100644 (file)
@@ -645,7 +645,8 @@ static inline bool local_timer_softirq_pending(void)
 static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu)
 {
        u64 basemono, next_tick, next_tmr, next_rcu, delta, expires;
-       unsigned long seq, basejiff;
+       unsigned long basejiff;
+       unsigned int seq;
 
        /* Read jiffies and the time when jiffies were updated last */
        do {
index f986e19..540145d 100644 (file)
@@ -720,7 +720,7 @@ static void timekeeping_forward_now(struct timekeeper *tk)
 void ktime_get_real_ts64(struct timespec64 *ts)
 {
        struct timekeeper *tk = &tk_core.timekeeper;
-       unsigned long seq;
+       unsigned int seq;
        u64 nsecs;
 
        WARN_ON(timekeeping_suspended);
@@ -829,7 +829,7 @@ EXPORT_SYMBOL_GPL(ktime_get_coarse_with_offset);
 ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs)
 {
        ktime_t *offset = offsets[offs];
-       unsigned long seq;
+       unsigned int seq;
        ktime_t tconv;
 
        do {
@@ -960,7 +960,7 @@ time64_t __ktime_get_real_seconds(void)
 void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot)
 {
        struct timekeeper *tk = &tk_core.timekeeper;
-       unsigned long seq;
+       unsigned int seq;
        ktime_t base_raw;
        ktime_t base_real;
        u64 nsec_raw;
@@ -1122,7 +1122,7 @@ int get_device_system_crosststamp(int (*get_time_fn)
        ktime_t base_real, base_raw;
        u64 nsec_real, nsec_raw;
        u8 cs_was_changed_seq;
-       unsigned long seq;
+       unsigned int seq;
        bool do_interp;
        int ret;
 
@@ -1409,7 +1409,7 @@ int timekeeping_notify(struct clocksource *clock)
 void ktime_get_raw_ts64(struct timespec64 *ts)
 {
        struct timekeeper *tk = &tk_core.timekeeper;
-       unsigned long seq;
+       unsigned int seq;
        u64 nsecs;
 
        do {
@@ -1431,7 +1431,7 @@ EXPORT_SYMBOL(ktime_get_raw_ts64);
 int timekeeping_valid_for_hres(void)
 {
        struct timekeeper *tk = &tk_core.timekeeper;
-       unsigned long seq;
+       unsigned int seq;
        int ret;
 
        do {
@@ -1450,7 +1450,7 @@ int timekeeping_valid_for_hres(void)
 u64 timekeeping_max_deferment(void)
 {
        struct timekeeper *tk = &tk_core.timekeeper;
-       unsigned long seq;
+       unsigned int seq;
        u64 ret;
 
        do {
@@ -2150,7 +2150,7 @@ EXPORT_SYMBOL_GPL(getboottime64);
 void ktime_get_coarse_real_ts64(struct timespec64 *ts)
 {
        struct timekeeper *tk = &tk_core.timekeeper;
-       unsigned long seq;
+       unsigned int seq;
 
        do {
                seq = read_seqcount_begin(&tk_core.seq);
@@ -2164,7 +2164,7 @@ void ktime_get_coarse_ts64(struct timespec64 *ts)
 {
        struct timekeeper *tk = &tk_core.timekeeper;
        struct timespec64 now, mono;
-       unsigned long seq;
+       unsigned int seq;
 
        do {
                seq = read_seqcount_begin(&tk_core.seq);