Commit e1e41b6c authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Thomas Gleixner

timekeeping: Consistently use unsigned int for seqcount snapshot

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: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarThomas 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
parent d7dcf26f
...@@ -63,7 +63,7 @@ __cacheline_aligned_in_smp DEFINE_SEQLOCK(jiffies_lock); ...@@ -63,7 +63,7 @@ __cacheline_aligned_in_smp DEFINE_SEQLOCK(jiffies_lock);
#if (BITS_PER_LONG < 64) #if (BITS_PER_LONG < 64)
u64 get_jiffies_64(void) u64 get_jiffies_64(void)
{ {
unsigned long seq; unsigned int seq;
u64 ret; u64 ret;
do { do {
......
...@@ -94,7 +94,7 @@ static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift) ...@@ -94,7 +94,7 @@ static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift)
unsigned long long notrace sched_clock(void) unsigned long long notrace sched_clock(void)
{ {
u64 cyc, res; u64 cyc, res;
unsigned long seq; unsigned int seq;
struct clock_read_data *rd; struct clock_read_data *rd;
do { do {
...@@ -267,7 +267,7 @@ void __init generic_sched_clock_init(void) ...@@ -267,7 +267,7 @@ void __init generic_sched_clock_init(void)
*/ */
static u64 notrace suspended_sched_clock_read(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; return cd.read_data[seq & 1].epoch_cyc;
} }
......
...@@ -149,7 +149,7 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast) ...@@ -149,7 +149,7 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
!tick_broadcast_oneshot_active()) { !tick_broadcast_oneshot_active()) {
clockevents_switch_state(dev, CLOCK_EVT_STATE_PERIODIC); clockevents_switch_state(dev, CLOCK_EVT_STATE_PERIODIC);
} else { } else {
unsigned long seq; unsigned int seq;
ktime_t next; ktime_t next;
do { do {
......
...@@ -645,7 +645,8 @@ static inline bool local_timer_softirq_pending(void) ...@@ -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) static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu)
{ {
u64 basemono, next_tick, next_tmr, next_rcu, delta, expires; 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 */ /* Read jiffies and the time when jiffies were updated last */
do { do {
......
...@@ -720,7 +720,7 @@ static void timekeeping_forward_now(struct timekeeper *tk) ...@@ -720,7 +720,7 @@ static void timekeeping_forward_now(struct timekeeper *tk)
void ktime_get_real_ts64(struct timespec64 *ts) void ktime_get_real_ts64(struct timespec64 *ts)
{ {
struct timekeeper *tk = &tk_core.timekeeper; struct timekeeper *tk = &tk_core.timekeeper;
unsigned long seq; unsigned int seq;
u64 nsecs; u64 nsecs;
WARN_ON(timekeeping_suspended); WARN_ON(timekeeping_suspended);
...@@ -829,7 +829,7 @@ EXPORT_SYMBOL_GPL(ktime_get_coarse_with_offset); ...@@ -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 ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs)
{ {
ktime_t *offset = offsets[offs]; ktime_t *offset = offsets[offs];
unsigned long seq; unsigned int seq;
ktime_t tconv; ktime_t tconv;
do { do {
...@@ -960,7 +960,7 @@ time64_t __ktime_get_real_seconds(void) ...@@ -960,7 +960,7 @@ time64_t __ktime_get_real_seconds(void)
void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot) void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot)
{ {
struct timekeeper *tk = &tk_core.timekeeper; struct timekeeper *tk = &tk_core.timekeeper;
unsigned long seq; unsigned int seq;
ktime_t base_raw; ktime_t base_raw;
ktime_t base_real; ktime_t base_real;
u64 nsec_raw; u64 nsec_raw;
...@@ -1122,7 +1122,7 @@ int get_device_system_crosststamp(int (*get_time_fn) ...@@ -1122,7 +1122,7 @@ int get_device_system_crosststamp(int (*get_time_fn)
ktime_t base_real, base_raw; ktime_t base_real, base_raw;
u64 nsec_real, nsec_raw; u64 nsec_real, nsec_raw;
u8 cs_was_changed_seq; u8 cs_was_changed_seq;
unsigned long seq; unsigned int seq;
bool do_interp; bool do_interp;
int ret; int ret;
...@@ -1409,7 +1409,7 @@ int timekeeping_notify(struct clocksource *clock) ...@@ -1409,7 +1409,7 @@ int timekeeping_notify(struct clocksource *clock)
void ktime_get_raw_ts64(struct timespec64 *ts) void ktime_get_raw_ts64(struct timespec64 *ts)
{ {
struct timekeeper *tk = &tk_core.timekeeper; struct timekeeper *tk = &tk_core.timekeeper;
unsigned long seq; unsigned int seq;
u64 nsecs; u64 nsecs;
do { do {
...@@ -1431,7 +1431,7 @@ EXPORT_SYMBOL(ktime_get_raw_ts64); ...@@ -1431,7 +1431,7 @@ EXPORT_SYMBOL(ktime_get_raw_ts64);
int timekeeping_valid_for_hres(void) int timekeeping_valid_for_hres(void)
{ {
struct timekeeper *tk = &tk_core.timekeeper; struct timekeeper *tk = &tk_core.timekeeper;
unsigned long seq; unsigned int seq;
int ret; int ret;
do { do {
...@@ -1450,7 +1450,7 @@ int timekeeping_valid_for_hres(void) ...@@ -1450,7 +1450,7 @@ int timekeeping_valid_for_hres(void)
u64 timekeeping_max_deferment(void) u64 timekeeping_max_deferment(void)
{ {
struct timekeeper *tk = &tk_core.timekeeper; struct timekeeper *tk = &tk_core.timekeeper;
unsigned long seq; unsigned int seq;
u64 ret; u64 ret;
do { do {
...@@ -2150,7 +2150,7 @@ EXPORT_SYMBOL_GPL(getboottime64); ...@@ -2150,7 +2150,7 @@ EXPORT_SYMBOL_GPL(getboottime64);
void ktime_get_coarse_real_ts64(struct timespec64 *ts) void ktime_get_coarse_real_ts64(struct timespec64 *ts)
{ {
struct timekeeper *tk = &tk_core.timekeeper; struct timekeeper *tk = &tk_core.timekeeper;
unsigned long seq; unsigned int seq;
do { do {
seq = read_seqcount_begin(&tk_core.seq); seq = read_seqcount_begin(&tk_core.seq);
...@@ -2164,7 +2164,7 @@ void ktime_get_coarse_ts64(struct timespec64 *ts) ...@@ -2164,7 +2164,7 @@ void ktime_get_coarse_ts64(struct timespec64 *ts)
{ {
struct timekeeper *tk = &tk_core.timekeeper; struct timekeeper *tk = &tk_core.timekeeper;
struct timespec64 now, mono; struct timespec64 now, mono;
unsigned long seq; unsigned int seq;
do { do {
seq = read_seqcount_begin(&tk_core.seq); seq = read_seqcount_begin(&tk_core.seq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment