Skip to content

Commit

Permalink
ptp: cleanup timestamp event queue when extts is disabled
Browse files Browse the repository at this point in the history
When extts is disabled, the queue that holds the existing reported
timestamps should be cleaned up in order to prevent user applications from
using old timestamps when extts is re-enabled.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
  • Loading branch information
wingmankwok committed Nov 8, 2019
1 parent 106aec4 commit bcada72
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/ptp/ptp_chardev.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
req.type = PTP_CLK_REQ_EXTTS;
enable = req.extts.flags & PTP_ENABLE_FEATURE ? 1 : 0;
err = ops->enable(ops, &req, enable);
if (!enable && !err && queue_cnt(&ptp->tsevq)) {
struct timestamp_event_queue *queue = &ptp->tsevq;
unsigned long flags;

spin_lock_irqsave(&queue->lock, flags);
queue->head = 0;
queue->tail = 0;
spin_unlock_irqrestore(&queue->lock, flags);
}
break;

case PTP_PEROUT_REQUEST:
Expand Down

0 comments on commit bcada72

Please sign in to comment.