diff options
author | Ingo Molnar <mingo@kernel.org> | 2023-12-23 15:52:13 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2023-12-23 15:52:13 +0100 |
commit | d2e9f53ac5dd76dadc0b5f04f6c27640604ce2af (patch) | |
tree | bf82d9fbfdc2ce67630fdacc18c2231f3d17876a /drivers/ptp/ptp_private.h | |
parent | 418146e39891ef1fb2284dee4cabbfe616cd21cf (diff) | |
parent | ceb6a6f023fd3e8b07761ed900352ef574010bcb (diff) |
Merge tag 'v6.7-rc6' into sched/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/ptp/ptp_private.h')
-rw-r--r-- | drivers/ptp/ptp_private.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h index 35fde0a05746..45f9002a5dca 100644 --- a/drivers/ptp/ptp_private.h +++ b/drivers/ptp/ptp_private.h @@ -85,9 +85,13 @@ struct ptp_vclock { * that a writer might concurrently increment the tail does not * matter, since the queue remains nonempty nonetheless. */ -static inline int queue_cnt(struct timestamp_event_queue *q) +static inline int queue_cnt(const struct timestamp_event_queue *q) { - int cnt = q->tail - q->head; + /* + * Paired with WRITE_ONCE() in enqueue_external_timestamp(), + * ptp_read(), extts_fifo_show(). + */ + int cnt = READ_ONCE(q->tail) - READ_ONCE(q->head); return cnt < 0 ? PTP_MAX_TIMESTAMPS + cnt : cnt; } |