forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h
....@@ -36,7 +36,6 @@
3636 #if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
3737 void mlx5_init_clock(struct mlx5_core_dev *mdev);
3838 void mlx5_cleanup_clock(struct mlx5_core_dev *mdev);
39
-void mlx5_pps_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe);
4039
4140 static inline int mlx5_clock_get_ptp_index(struct mlx5_core_dev *mdev)
4241 {
....@@ -46,11 +45,13 @@
4645 static inline ktime_t mlx5_timecounter_cyc2time(struct mlx5_clock *clock,
4746 u64 timestamp)
4847 {
48
+ unsigned int seq;
4949 u64 nsec;
5050
51
- read_lock(&clock->lock);
52
- nsec = timecounter_cyc2time(&clock->tc, timestamp);
53
- read_unlock(&clock->lock);
51
+ do {
52
+ seq = read_seqbegin(&clock->lock);
53
+ nsec = timecounter_cyc2time(&clock->tc, timestamp);
54
+ } while (read_seqretry(&clock->lock, seq));
5455
5556 return ns_to_ktime(nsec);
5657 }
....@@ -58,8 +59,6 @@
5859 #else
5960 static inline void mlx5_init_clock(struct mlx5_core_dev *mdev) {}
6061 static inline void mlx5_cleanup_clock(struct mlx5_core_dev *mdev) {}
61
-static inline void mlx5_pps_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe) {}
62
-
6362 static inline int mlx5_clock_get_ptp_index(struct mlx5_core_dev *mdev)
6463 {
6564 return -1;