Commit dd3535b9 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Corey Minyard

ipmi: Change to ktime_get_ts64()

getnstimeofday64() is deprecated because of the inconsistent naming,
it is only a wrapper around ktime_get_real_ts64() now, which could be
used as a direct replacement.

However, it is generally better to use CLOCK_MONOTONIC timestamps
where possible, to avoid glitches with a concurrent settimeofday()
or leap second.

The uses in ipmi are either for debugging prints or for comparing against
a prior timestamp, so using a monotonic ktime_get_ts64() is probably
best here.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent 97a103e6
...@@ -269,7 +269,7 @@ void debug_timestamp(char *msg) ...@@ -269,7 +269,7 @@ void debug_timestamp(char *msg)
{ {
struct timespec64 t; struct timespec64 t;
getnstimeofday64(&t); ktime_get_ts64(&t);
pr_debug("**%s: %lld.%9.9ld\n", msg, (long long) t.tv_sec, t.tv_nsec); pr_debug("**%s: %lld.%9.9ld\n", msg, (long long) t.tv_sec, t.tv_nsec);
} }
#else #else
...@@ -961,12 +961,12 @@ static inline int ipmi_thread_busy_wait(enum si_sm_result smi_result, ...@@ -961,12 +961,12 @@ static inline int ipmi_thread_busy_wait(enum si_sm_result smi_result,
if (max_busy_us == 0 || smi_result != SI_SM_CALL_WITH_DELAY) if (max_busy_us == 0 || smi_result != SI_SM_CALL_WITH_DELAY)
ipmi_si_set_not_busy(busy_until); ipmi_si_set_not_busy(busy_until);
else if (!ipmi_si_is_busy(busy_until)) { else if (!ipmi_si_is_busy(busy_until)) {
getnstimeofday64(busy_until); ktime_get_ts64(busy_until);
timespec64_add_ns(busy_until, max_busy_us*NSEC_PER_USEC); timespec64_add_ns(busy_until, max_busy_us*NSEC_PER_USEC);
} else { } else {
struct timespec64 now; struct timespec64 now;
getnstimeofday64(&now); ktime_get_ts64(&now);
if (unlikely(timespec64_compare(&now, busy_until) > 0)) { if (unlikely(timespec64_compare(&now, busy_until) > 0)) {
ipmi_si_set_not_busy(busy_until); ipmi_si_set_not_busy(busy_until);
return 0; return 0;
......
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