mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-07-01 23:53:16 -04:00
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>
This commit is contained in:
parent
9da0f49c87
commit
ba26621e63
2 changed files with 10 additions and 51 deletions
|
@ -111,22 +111,17 @@ static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
|
|||
kt->nsec = ts.tv_nsec;
|
||||
}
|
||||
|
||||
static inline void pps_get_ts(struct pps_event_time *ts)
|
||||
{
|
||||
struct system_time_snapshot snap;
|
||||
|
||||
ktime_get_snapshot(&snap);
|
||||
ts->ts_real = ktime_to_timespec64(snap.real);
|
||||
#ifdef CONFIG_NTP_PPS
|
||||
|
||||
static inline void pps_get_ts(struct pps_event_time *ts)
|
||||
{
|
||||
ktime_get_raw_and_real_ts64(&ts->ts_raw, &ts->ts_real);
|
||||
ts->ts_raw = ktime_to_timespec64(snap.raw);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else /* CONFIG_NTP_PPS */
|
||||
|
||||
static inline void pps_get_ts(struct pps_event_time *ts)
|
||||
{
|
||||
ktime_get_real_ts64(&ts->ts_real);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NTP_PPS */
|
||||
|
||||
/* Subtract known time delay from PPS event time(s) */
|
||||
static inline void pps_sub_ts(struct pps_event_time *ts, struct timespec64 delta)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue