aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ptp/ptp_clock.c
diff options
context:
space:
mode:
authorXabier Marquiegui <reibax@gmail.com>2023-10-12 00:39:55 +0200
committerDavid S. Miller <davem@davemloft.net>2023-10-15 20:07:52 +0100
commit8f5de6fb245326704f37d91780b9a10253a8a100 (patch)
treea37b5c6fc49fa23bf73af97bb9146b28d75d78d4 /drivers/ptp/ptp_clock.c
parentptp: Replace timestamp event queue with linked list (diff)
downloadlinux-8f5de6fb245326704f37d91780b9a10253a8a100.tar.xz
linux-8f5de6fb245326704f37d91780b9a10253a8a100.zip
ptp: support multiple timestamp event readers
Use linked lists to create one event queue per open file. This enables simultaneous readers for timestamp event queues. Signed-off-by: Xabier Marquiegui <reibax@gmail.com> Suggested-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ptp/ptp_clock.c')
-rw-r--r--drivers/ptp/ptp_clock.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 157ef25bc1b1..74f1ce2dbccb 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -162,6 +162,7 @@ static struct posix_clock_operations ptp_clock_ops = {
.clock_settime = ptp_clock_settime,
.ioctl = ptp_ioctl,
.open = ptp_open,
+ .release = ptp_release,
.poll = ptp_poll,
.read = ptp_read,
};
@@ -174,7 +175,6 @@ static void ptp_clock_release(struct device *dev)
ptp_cleanup_pin_groups(ptp);
kfree(ptp->vclock_index);
- mutex_destroy(&ptp->tsevq_mux);
mutex_destroy(&ptp->pincfg_mux);
mutex_destroy(&ptp->n_vclocks_mux);
/* Delete first entry */
@@ -242,9 +242,8 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
queue = kzalloc(sizeof(*queue), GFP_KERNEL);
if (!queue)
goto no_memory_queue;
- spin_lock_init(&queue->lock);
list_add_tail(&queue->qlist, &ptp->tsevqs);
- mutex_init(&ptp->tsevq_mux);
+ spin_lock_init(&queue->lock);
mutex_init(&ptp->pincfg_mux);
mutex_init(&ptp->n_vclocks_mux);
init_waitqueue_head(&ptp->tsev_wq);
@@ -345,7 +344,6 @@ no_mem_for_vclocks:
if (ptp->kworker)
kthread_destroy_worker(ptp->kworker);
kworker_err:
- mutex_destroy(&ptp->tsevq_mux);
mutex_destroy(&ptp->pincfg_mux);
mutex_destroy(&ptp->n_vclocks_mux);
list_del(&queue->qlist);