diff options
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r-- | kernel/time/timekeeping.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ad779c2ec53a..7033ac1fee65 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -105,7 +105,7 @@ static inline void tk_normalize_xtime(struct timekeeper *tk) | |||
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | static inline struct timespec64 tk_xtime(struct timekeeper *tk) | 108 | static inline struct timespec64 tk_xtime(const struct timekeeper *tk) |
109 | { | 109 | { |
110 | struct timespec64 ts; | 110 | struct timespec64 ts; |
111 | 111 | ||
@@ -162,7 +162,7 @@ static inline void tk_update_sleep_time(struct timekeeper *tk, ktime_t delta) | |||
162 | * a read of the fast-timekeeper tkrs (which is protected by its own locking | 162 | * a read of the fast-timekeeper tkrs (which is protected by its own locking |
163 | * and update logic). | 163 | * and update logic). |
164 | */ | 164 | */ |
165 | static inline u64 tk_clock_read(struct tk_read_base *tkr) | 165 | static inline u64 tk_clock_read(const struct tk_read_base *tkr) |
166 | { | 166 | { |
167 | struct clocksource *clock = READ_ONCE(tkr->clock); | 167 | struct clocksource *clock = READ_ONCE(tkr->clock); |
168 | 168 | ||
@@ -211,7 +211,7 @@ static void timekeeping_check_update(struct timekeeper *tk, u64 offset) | |||
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | static inline u64 timekeeping_get_delta(struct tk_read_base *tkr) | 214 | static inline u64 timekeeping_get_delta(const struct tk_read_base *tkr) |
215 | { | 215 | { |
216 | struct timekeeper *tk = &tk_core.timekeeper; | 216 | struct timekeeper *tk = &tk_core.timekeeper; |
217 | u64 now, last, mask, max, delta; | 217 | u64 now, last, mask, max, delta; |
@@ -255,7 +255,7 @@ static inline u64 timekeeping_get_delta(struct tk_read_base *tkr) | |||
255 | static inline void timekeeping_check_update(struct timekeeper *tk, u64 offset) | 255 | static inline void timekeeping_check_update(struct timekeeper *tk, u64 offset) |
256 | { | 256 | { |
257 | } | 257 | } |
258 | static inline u64 timekeeping_get_delta(struct tk_read_base *tkr) | 258 | static inline u64 timekeeping_get_delta(const struct tk_read_base *tkr) |
259 | { | 259 | { |
260 | u64 cycle_now, delta; | 260 | u64 cycle_now, delta; |
261 | 261 | ||
@@ -352,7 +352,7 @@ u32 (*arch_gettimeoffset)(void) = default_arch_gettimeoffset; | |||
352 | static inline u32 arch_gettimeoffset(void) { return 0; } | 352 | static inline u32 arch_gettimeoffset(void) { return 0; } |
353 | #endif | 353 | #endif |
354 | 354 | ||
355 | static inline u64 timekeeping_delta_to_ns(struct tk_read_base *tkr, u64 delta) | 355 | static inline u64 timekeeping_delta_to_ns(const struct tk_read_base *tkr, u64 delta) |
356 | { | 356 | { |
357 | u64 nsec; | 357 | u64 nsec; |
358 | 358 | ||
@@ -363,7 +363,7 @@ static inline u64 timekeeping_delta_to_ns(struct tk_read_base *tkr, u64 delta) | |||
363 | return nsec + arch_gettimeoffset(); | 363 | return nsec + arch_gettimeoffset(); |
364 | } | 364 | } |
365 | 365 | ||
366 | static inline u64 timekeeping_get_ns(struct tk_read_base *tkr) | 366 | static inline u64 timekeeping_get_ns(const struct tk_read_base *tkr) |
367 | { | 367 | { |
368 | u64 delta; | 368 | u64 delta; |
369 | 369 | ||
@@ -371,7 +371,7 @@ static inline u64 timekeeping_get_ns(struct tk_read_base *tkr) | |||
371 | return timekeeping_delta_to_ns(tkr, delta); | 371 | return timekeeping_delta_to_ns(tkr, delta); |
372 | } | 372 | } |
373 | 373 | ||
374 | static inline u64 timekeeping_cycles_to_ns(struct tk_read_base *tkr, u64 cycles) | 374 | static inline u64 timekeeping_cycles_to_ns(const struct tk_read_base *tkr, u64 cycles) |
375 | { | 375 | { |
376 | u64 delta; | 376 | u64 delta; |
377 | 377 | ||
@@ -394,7 +394,8 @@ static inline u64 timekeeping_cycles_to_ns(struct tk_read_base *tkr, u64 cycles) | |||
394 | * slightly wrong timestamp (a few nanoseconds). See | 394 | * slightly wrong timestamp (a few nanoseconds). See |
395 | * @ktime_get_mono_fast_ns. | 395 | * @ktime_get_mono_fast_ns. |
396 | */ | 396 | */ |
397 | static void update_fast_timekeeper(struct tk_read_base *tkr, struct tk_fast *tkf) | 397 | static void update_fast_timekeeper(const struct tk_read_base *tkr, |
398 | struct tk_fast *tkf) | ||
398 | { | 399 | { |
399 | struct tk_read_base *base = tkf->base; | 400 | struct tk_read_base *base = tkf->base; |
400 | 401 | ||
@@ -549,10 +550,10 @@ EXPORT_SYMBOL_GPL(ktime_get_real_fast_ns); | |||
549 | * number of cycles every time until timekeeping is resumed at which time the | 550 | * number of cycles every time until timekeeping is resumed at which time the |
550 | * proper readout base for the fast timekeeper will be restored automatically. | 551 | * proper readout base for the fast timekeeper will be restored automatically. |
551 | */ | 552 | */ |
552 | static void halt_fast_timekeeper(struct timekeeper *tk) | 553 | static void halt_fast_timekeeper(const struct timekeeper *tk) |
553 | { | 554 | { |
554 | static struct tk_read_base tkr_dummy; | 555 | static struct tk_read_base tkr_dummy; |
555 | struct tk_read_base *tkr = &tk->tkr_mono; | 556 | const struct tk_read_base *tkr = &tk->tkr_mono; |
556 | 557 | ||
557 | memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy)); | 558 | memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy)); |
558 | cycles_at_suspend = tk_clock_read(tkr); | 559 | cycles_at_suspend = tk_clock_read(tkr); |
@@ -1277,7 +1278,7 @@ EXPORT_SYMBOL(do_settimeofday64); | |||
1277 | * | 1278 | * |
1278 | * Adds or subtracts an offset value from the current time. | 1279 | * Adds or subtracts an offset value from the current time. |
1279 | */ | 1280 | */ |
1280 | static int timekeeping_inject_offset(struct timespec64 *ts) | 1281 | static int timekeeping_inject_offset(const struct timespec64 *ts) |
1281 | { | 1282 | { |
1282 | struct timekeeper *tk = &tk_core.timekeeper; | 1283 | struct timekeeper *tk = &tk_core.timekeeper; |
1283 | unsigned long flags; | 1284 | unsigned long flags; |
@@ -1585,7 +1586,7 @@ static struct timespec64 timekeeping_suspend_time; | |||
1585 | * adds the sleep offset to the timekeeping variables. | 1586 | * adds the sleep offset to the timekeeping variables. |
1586 | */ | 1587 | */ |
1587 | static void __timekeeping_inject_sleeptime(struct timekeeper *tk, | 1588 | static void __timekeeping_inject_sleeptime(struct timekeeper *tk, |
1588 | struct timespec64 *delta) | 1589 | const struct timespec64 *delta) |
1589 | { | 1590 | { |
1590 | if (!timespec64_valid_strict(delta)) { | 1591 | if (!timespec64_valid_strict(delta)) { |
1591 | printk_deferred(KERN_WARNING | 1592 | printk_deferred(KERN_WARNING |
@@ -1646,7 +1647,7 @@ bool timekeeping_rtc_skipsuspend(void) | |||
1646 | * This function should only be called by rtc_resume(), and allows | 1647 | * This function should only be called by rtc_resume(), and allows |
1647 | * a suspend offset to be injected into the timekeeping values. | 1648 | * a suspend offset to be injected into the timekeeping values. |
1648 | */ | 1649 | */ |
1649 | void timekeeping_inject_sleeptime64(struct timespec64 *delta) | 1650 | void timekeeping_inject_sleeptime64(const struct timespec64 *delta) |
1650 | { | 1651 | { |
1651 | struct timekeeper *tk = &tk_core.timekeeper; | 1652 | struct timekeeper *tk = &tk_core.timekeeper; |
1652 | unsigned long flags; | 1653 | unsigned long flags; |
@@ -2240,7 +2241,7 @@ ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, ktime_t *offs_real, | |||
2240 | /** | 2241 | /** |
2241 | * timekeeping_validate_timex - Ensures the timex is ok for use in do_adjtimex | 2242 | * timekeeping_validate_timex - Ensures the timex is ok for use in do_adjtimex |
2242 | */ | 2243 | */ |
2243 | static int timekeeping_validate_timex(struct timex *txc) | 2244 | static int timekeeping_validate_timex(const struct timex *txc) |
2244 | { | 2245 | { |
2245 | if (txc->modes & ADJ_ADJTIME) { | 2246 | if (txc->modes & ADJ_ADJTIME) { |
2246 | /* singleshot must not be used with any other mode bits */ | 2247 | /* singleshot must not be used with any other mode bits */ |