Loading drivers/net/ethernet/sfc/ptp.c +15 −15 Original line number Diff line number Diff line Loading @@ -401,8 +401,8 @@ size_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats) /* For Siena platforms NIC time is s and ns */ static void efx_ptp_ns_to_s_ns(s64 ns, u32 *nic_major, u32 *nic_minor) { struct timespec ts = ns_to_timespec(ns); *nic_major = ts.tv_sec; struct timespec64 ts = ns_to_timespec64(ns); *nic_major = (u32)ts.tv_sec; *nic_minor = ts.tv_nsec; } Loading Loading @@ -431,8 +431,8 @@ static ktime_t efx_ptp_s_ns_to_ktime_correction(u32 nic_major, u32 nic_minor, */ static void efx_ptp_ns_to_s27(s64 ns, u32 *nic_major, u32 *nic_minor) { struct timespec ts = ns_to_timespec(ns); u32 maj = ts.tv_sec; struct timespec64 ts = ns_to_timespec64(ns); u32 maj = (u32)ts.tv_sec; u32 min = (u32)(((u64)ts.tv_nsec * NS_TO_S27_MULT + (1ULL << (NS_TO_S27_SHIFT - 1))) >> NS_TO_S27_SHIFT); Loading Loading @@ -646,28 +646,28 @@ static void efx_ptp_send_times(struct efx_nic *efx, struct pps_event_time *last_time) { struct pps_event_time now; struct timespec limit; struct timespec64 limit; struct efx_ptp_data *ptp = efx->ptp_data; struct timespec start; struct timespec64 start; int *mc_running = ptp->start.addr; pps_get_ts(&now); start = now.ts_real; limit = now.ts_real; timespec_add_ns(&limit, SYNCHRONISE_PERIOD_NS); timespec64_add_ns(&limit, SYNCHRONISE_PERIOD_NS); /* Write host time for specified period or until MC is done */ while ((timespec_compare(&now.ts_real, &limit) < 0) && while ((timespec64_compare(&now.ts_real, &limit) < 0) && ACCESS_ONCE(*mc_running)) { struct timespec update_time; struct timespec64 update_time; unsigned int host_time; /* Don't update continuously to avoid saturating the PCIe bus */ update_time = now.ts_real; timespec_add_ns(&update_time, SYNCHRONISATION_GRANULARITY_NS); timespec64_add_ns(&update_time, SYNCHRONISATION_GRANULARITY_NS); do { pps_get_ts(&now); } while ((timespec_compare(&now.ts_real, &update_time) < 0) && } while ((timespec64_compare(&now.ts_real, &update_time) < 0) && ACCESS_ONCE(*mc_running)); /* Synchronise NIC with single word of time only */ Loading Loading @@ -723,7 +723,7 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf), struct efx_ptp_data *ptp = efx->ptp_data; u32 last_sec; u32 start_sec; struct timespec delta; struct timespec64 delta; ktime_t mc_time; if (number_readings == 0) Loading @@ -737,14 +737,14 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf), */ for (i = 0; i < number_readings; i++) { s32 window, corrected; struct timespec wait; struct timespec64 wait; efx_ptp_read_timeset( MCDI_ARRAY_STRUCT_PTR(synch_buf, PTP_OUT_SYNCHRONIZE_TIMESET, i), &ptp->timeset[i]); wait = ktime_to_timespec( wait = ktime_to_timespec64( ptp->nic_to_kernel_time(0, ptp->timeset[i].wait, 0)); window = ptp->timeset[i].window; corrected = window - wait.tv_nsec; Loading Loading @@ -803,7 +803,7 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf), ptp->timeset[last_good].minor, 0); /* Calculate delay from NIC top of second to last_time */ delta.tv_nsec += ktime_to_timespec(mc_time).tv_nsec; delta.tv_nsec += ktime_to_timespec64(mc_time).tv_nsec; /* Set PPS timestamp to match NIC top of second */ ptp->host_time_pps = *last_time; Loading drivers/pps/kapi.c +2 −2 Original line number Diff line number Diff line Loading @@ -179,8 +179,8 @@ void pps_event(struct pps_device *pps, struct pps_event_time *ts, int event, /* check event type */ BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0); dev_dbg(pps->dev, "PPS event at %ld.%09ld\n", ts->ts_real.tv_sec, ts->ts_real.tv_nsec); dev_dbg(pps->dev, "PPS event at %lld.%09ld\n", (s64)ts->ts_real.tv_sec, ts->ts_real.tv_nsec); timespec_to_pps_ktime(&ts_real, ts->ts_real); Loading include/linux/pps_kernel.h +8 −8 Original line number Diff line number Diff line Loading @@ -48,9 +48,9 @@ struct pps_source_info { struct pps_event_time { #ifdef CONFIG_NTP_PPS struct timespec ts_raw; struct timespec64 ts_raw; #endif /* CONFIG_NTP_PPS */ struct timespec ts_real; struct timespec64 ts_real; }; /* The main struct */ Loading Loading @@ -105,7 +105,7 @@ extern void pps_event(struct pps_device *pps, struct pps_device *pps_lookup_dev(void const *cookie); static inline void timespec_to_pps_ktime(struct pps_ktime *kt, struct timespec ts) struct timespec64 ts) { kt->sec = ts.tv_sec; kt->nsec = ts.tv_nsec; Loading @@ -115,24 +115,24 @@ static inline void timespec_to_pps_ktime(struct pps_ktime *kt, static inline void pps_get_ts(struct pps_event_time *ts) { getnstime_raw_and_real(&ts->ts_raw, &ts->ts_real); ktime_get_raw_and_real_ts64(&ts->ts_raw, &ts->ts_real); } #else /* CONFIG_NTP_PPS */ static inline void pps_get_ts(struct pps_event_time *ts) { getnstimeofday(&ts->ts_real); 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 timespec delta) static inline void pps_sub_ts(struct pps_event_time *ts, struct timespec64 delta) { ts->ts_real = timespec_sub(ts->ts_real, delta); ts->ts_real = timespec64_sub(ts->ts_real, delta); #ifdef CONFIG_NTP_PPS ts->ts_raw = timespec_sub(ts->ts_raw, delta); ts->ts_raw = timespec64_sub(ts->ts_raw, delta); #endif } Loading include/linux/timekeeping.h +2 −2 Original line number Diff line number Diff line Loading @@ -263,8 +263,8 @@ extern void timekeeping_inject_sleeptime64(struct timespec64 *delta); /* * PPS accessor */ extern void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real); extern void ktime_get_raw_and_real_ts64(struct timespec64 *ts_raw, struct timespec64 *ts_real); /* * Persistent clock related interfaces Loading include/linux/timex.h +1 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */ #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) extern int do_adjtimex(struct timex *); extern void hardpps(const struct timespec *, const struct timespec *); extern void hardpps(const struct timespec64 *, const struct timespec64 *); int read_current_timer(unsigned long *timer_val); void ntp_notify_cmos_timer(void); Loading Loading
drivers/net/ethernet/sfc/ptp.c +15 −15 Original line number Diff line number Diff line Loading @@ -401,8 +401,8 @@ size_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats) /* For Siena platforms NIC time is s and ns */ static void efx_ptp_ns_to_s_ns(s64 ns, u32 *nic_major, u32 *nic_minor) { struct timespec ts = ns_to_timespec(ns); *nic_major = ts.tv_sec; struct timespec64 ts = ns_to_timespec64(ns); *nic_major = (u32)ts.tv_sec; *nic_minor = ts.tv_nsec; } Loading Loading @@ -431,8 +431,8 @@ static ktime_t efx_ptp_s_ns_to_ktime_correction(u32 nic_major, u32 nic_minor, */ static void efx_ptp_ns_to_s27(s64 ns, u32 *nic_major, u32 *nic_minor) { struct timespec ts = ns_to_timespec(ns); u32 maj = ts.tv_sec; struct timespec64 ts = ns_to_timespec64(ns); u32 maj = (u32)ts.tv_sec; u32 min = (u32)(((u64)ts.tv_nsec * NS_TO_S27_MULT + (1ULL << (NS_TO_S27_SHIFT - 1))) >> NS_TO_S27_SHIFT); Loading Loading @@ -646,28 +646,28 @@ static void efx_ptp_send_times(struct efx_nic *efx, struct pps_event_time *last_time) { struct pps_event_time now; struct timespec limit; struct timespec64 limit; struct efx_ptp_data *ptp = efx->ptp_data; struct timespec start; struct timespec64 start; int *mc_running = ptp->start.addr; pps_get_ts(&now); start = now.ts_real; limit = now.ts_real; timespec_add_ns(&limit, SYNCHRONISE_PERIOD_NS); timespec64_add_ns(&limit, SYNCHRONISE_PERIOD_NS); /* Write host time for specified period or until MC is done */ while ((timespec_compare(&now.ts_real, &limit) < 0) && while ((timespec64_compare(&now.ts_real, &limit) < 0) && ACCESS_ONCE(*mc_running)) { struct timespec update_time; struct timespec64 update_time; unsigned int host_time; /* Don't update continuously to avoid saturating the PCIe bus */ update_time = now.ts_real; timespec_add_ns(&update_time, SYNCHRONISATION_GRANULARITY_NS); timespec64_add_ns(&update_time, SYNCHRONISATION_GRANULARITY_NS); do { pps_get_ts(&now); } while ((timespec_compare(&now.ts_real, &update_time) < 0) && } while ((timespec64_compare(&now.ts_real, &update_time) < 0) && ACCESS_ONCE(*mc_running)); /* Synchronise NIC with single word of time only */ Loading Loading @@ -723,7 +723,7 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf), struct efx_ptp_data *ptp = efx->ptp_data; u32 last_sec; u32 start_sec; struct timespec delta; struct timespec64 delta; ktime_t mc_time; if (number_readings == 0) Loading @@ -737,14 +737,14 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf), */ for (i = 0; i < number_readings; i++) { s32 window, corrected; struct timespec wait; struct timespec64 wait; efx_ptp_read_timeset( MCDI_ARRAY_STRUCT_PTR(synch_buf, PTP_OUT_SYNCHRONIZE_TIMESET, i), &ptp->timeset[i]); wait = ktime_to_timespec( wait = ktime_to_timespec64( ptp->nic_to_kernel_time(0, ptp->timeset[i].wait, 0)); window = ptp->timeset[i].window; corrected = window - wait.tv_nsec; Loading Loading @@ -803,7 +803,7 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf), ptp->timeset[last_good].minor, 0); /* Calculate delay from NIC top of second to last_time */ delta.tv_nsec += ktime_to_timespec(mc_time).tv_nsec; delta.tv_nsec += ktime_to_timespec64(mc_time).tv_nsec; /* Set PPS timestamp to match NIC top of second */ ptp->host_time_pps = *last_time; Loading
drivers/pps/kapi.c +2 −2 Original line number Diff line number Diff line Loading @@ -179,8 +179,8 @@ void pps_event(struct pps_device *pps, struct pps_event_time *ts, int event, /* check event type */ BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0); dev_dbg(pps->dev, "PPS event at %ld.%09ld\n", ts->ts_real.tv_sec, ts->ts_real.tv_nsec); dev_dbg(pps->dev, "PPS event at %lld.%09ld\n", (s64)ts->ts_real.tv_sec, ts->ts_real.tv_nsec); timespec_to_pps_ktime(&ts_real, ts->ts_real); Loading
include/linux/pps_kernel.h +8 −8 Original line number Diff line number Diff line Loading @@ -48,9 +48,9 @@ struct pps_source_info { struct pps_event_time { #ifdef CONFIG_NTP_PPS struct timespec ts_raw; struct timespec64 ts_raw; #endif /* CONFIG_NTP_PPS */ struct timespec ts_real; struct timespec64 ts_real; }; /* The main struct */ Loading Loading @@ -105,7 +105,7 @@ extern void pps_event(struct pps_device *pps, struct pps_device *pps_lookup_dev(void const *cookie); static inline void timespec_to_pps_ktime(struct pps_ktime *kt, struct timespec ts) struct timespec64 ts) { kt->sec = ts.tv_sec; kt->nsec = ts.tv_nsec; Loading @@ -115,24 +115,24 @@ static inline void timespec_to_pps_ktime(struct pps_ktime *kt, static inline void pps_get_ts(struct pps_event_time *ts) { getnstime_raw_and_real(&ts->ts_raw, &ts->ts_real); ktime_get_raw_and_real_ts64(&ts->ts_raw, &ts->ts_real); } #else /* CONFIG_NTP_PPS */ static inline void pps_get_ts(struct pps_event_time *ts) { getnstimeofday(&ts->ts_real); 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 timespec delta) static inline void pps_sub_ts(struct pps_event_time *ts, struct timespec64 delta) { ts->ts_real = timespec_sub(ts->ts_real, delta); ts->ts_real = timespec64_sub(ts->ts_real, delta); #ifdef CONFIG_NTP_PPS ts->ts_raw = timespec_sub(ts->ts_raw, delta); ts->ts_raw = timespec64_sub(ts->ts_raw, delta); #endif } Loading
include/linux/timekeeping.h +2 −2 Original line number Diff line number Diff line Loading @@ -263,8 +263,8 @@ extern void timekeeping_inject_sleeptime64(struct timespec64 *delta); /* * PPS accessor */ extern void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real); extern void ktime_get_raw_and_real_ts64(struct timespec64 *ts_raw, struct timespec64 *ts_real); /* * Persistent clock related interfaces Loading
include/linux/timex.h +1 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */ #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) extern int do_adjtimex(struct timex *); extern void hardpps(const struct timespec *, const struct timespec *); extern void hardpps(const struct timespec64 *, const struct timespec64 *); int read_current_timer(unsigned long *timer_val); void ntp_notify_cmos_timer(void); Loading