Re: [PATCH v7 3/8] time: Remove duplicated code in ktime_get_raw_and_real()

From: Christopher Hall
Date: Tue Feb 16 2016 - 13:25:29 EST


On Mon, 15 Feb 2016 23:52:10 -0800, Richard Cochran <richardcochran@xxxxxxxxx> wrote:
@@ -888,6 +888,8 @@ void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot)
s64 nsec_real;
cycle_t now;

+ WARN_ON(timekeeping_suspended);
...
- WARN_ON_ONCE(timekeeping_suspended);

Is this change intentional?

Yes it is. The code I replaced in pps_kernel.h (pps_get_ts()) has two call paths depending on whether CONFIG_NTP_PPS is set. On one call path (realtime only, config unset) WARN_ON(), from getnstimeofday64, is used, on the other WARN_ON_ONCE(), from ktime_get_raw_and_real_ts64(), is used. I opted for the greater verbosity of the two when I combined the code.

Is WARN_ON_ONCE() better here?

Thanks,
Chris