Re: [PATCH] ptp: Demultiplexed timestamp channels
From: Richard Cochran <richardcochran@gmail.com>
Date: 2023-08-30 22:03:09
On Wed, Aug 30, 2023 at 11:41:01PM +0200, Xabier Marquiegui wrote:
+ssize_t ptp_dmtsc_read(struct file *file, char __user *buf, size_t cnt,
+ loff_t *offset)
+{
+ struct ptp_dmtsc_cdev_info *cdev = file->private_data;
+
+ return ptp_queue_read(cdev->pclock, buf, cnt, cdev->minor);
+}
+
+static const struct file_operations fops = {
+ .owner = THIS_MODULE,
+ .open = ptp_dmtsc_open,
+ .read = ptp_dmtsc_read,
+ .release = ptp_dmtsc_release
+ };I'll say it again... There is no need to add a new char dev! You will need a patch series of at least three patches, step by step: 1. Delete ptp_clock.tsevq Replace it will a linked list of `struct timestamp_event_queue` Populate the list with ONE queue in ptp_clock_register() This will be your first patch. It will have the same functionality as before. 2. Allocate a new `struct timestamp_event_queue` on posix_clock_operations.open() Add it into the list. Remove it again on posix_clock_operations.release() This will introduce new functionality, as all events will go to all consumers. 3. Introduce a new ioctl that filters events based on user preference. Hm? Thanks, Richard