diff options
| author | Christopher S. Hall <christopher.s.hall@intel.com> | 2016-02-22 06:15:21 -0500 |
|---|---|---|
| committer | John Stultz <john.stultz@linaro.org> | 2016-03-02 20:13:02 -0500 |
| commit | ba26621e63ce6dc481d90ab9f6902e058d4ea39a (patch) | |
| tree | 10052e1f9f2faead421bf452a8d259ae4bf840ee /include/linux/pps_kernel.h | |
| parent | 9da0f49c8767cc0ef6101cb21156cf4380ed50dd (diff) | |
time: Remove duplicated code in ktime_get_raw_and_real()
The code in ktime_get_snapshot() is a superset of the code in
ktime_get_raw_and_real() code. Further, ktime_get_raw_and_real() is
called only by the PPS code, pps_get_ts(). Consolidate the
pps_get_ts() code into a single function calling ktime_get_snapshot()
and eliminate ktime_get_raw_and_real(). A side effect of this is that
the raw and real results of pps_get_ts() correspond to exactly the
same clock cycle. Previously these values represented separate reads
of the system clock.
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: kevin.b.stanton@intel.com
Cc: kevin.j.clarke@intel.com
Cc: hpa@zytor.com
Cc: jeffrey.t.kirsher@intel.com
Cc: netdev@vger.kernel.org
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Christopher S. Hall <christopher.s.hall@intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'include/linux/pps_kernel.h')
| -rw-r--r-- | include/linux/pps_kernel.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h index 54bf1484d41f..35ac903956c7 100644 --- a/include/linux/pps_kernel.h +++ b/include/linux/pps_kernel.h | |||
| @@ -111,22 +111,17 @@ static inline void timespec_to_pps_ktime(struct pps_ktime *kt, | |||
| 111 | kt->nsec = ts.tv_nsec; | 111 | kt->nsec = ts.tv_nsec; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | #ifdef CONFIG_NTP_PPS | ||
| 115 | |||
| 116 | static inline void pps_get_ts(struct pps_event_time *ts) | 114 | static inline void pps_get_ts(struct pps_event_time *ts) |
| 117 | { | 115 | { |
| 118 | ktime_get_raw_and_real_ts64(&ts->ts_raw, &ts->ts_real); | 116 | struct system_time_snapshot snap; |
| 119 | } | ||
| 120 | 117 | ||
| 121 | #else /* CONFIG_NTP_PPS */ | 118 | ktime_get_snapshot(&snap); |
| 122 | 119 | ts->ts_real = ktime_to_timespec64(snap.real); | |
| 123 | static inline void pps_get_ts(struct pps_event_time *ts) | 120 | #ifdef CONFIG_NTP_PPS |
| 124 | { | 121 | ts->ts_raw = ktime_to_timespec64(snap.raw); |
| 125 | ktime_get_real_ts64(&ts->ts_real); | 122 | #endif |
| 126 | } | 123 | } |
| 127 | 124 | ||
| 128 | #endif /* CONFIG_NTP_PPS */ | ||
| 129 | |||
| 130 | /* Subtract known time delay from PPS event time(s) */ | 125 | /* Subtract known time delay from PPS event time(s) */ |
| 131 | static inline void pps_sub_ts(struct pps_event_time *ts, struct timespec64 delta) | 126 | static inline void pps_sub_ts(struct pps_event_time *ts, struct timespec64 delta) |
| 132 | { | 127 | { |
