]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
remove some unneeded 5.15 ptp patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Feb 2025 08:45:38 +0000 (09:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Feb 2025 08:45:38 +0000 (09:45 +0100)
queue-5.15/i915-move-list_count-to-list.h-as-list_count_nodes-f.patch [deleted file]
queue-5.15/posix-clock-introduce-posix_clock_context-concept.patch [deleted file]
queue-5.15/ptp-properly-handle-compat-ioctls.patch
queue-5.15/ptp-remove-usage-of-the-deprecated-ida_simple_xxx-ap.patch [deleted file]
queue-5.15/ptp-replace-timestamp-event-queue-with-linked-list.patch [deleted file]
queue-5.15/ptp-support-event-queue-reader-channel-masks.patch [deleted file]
queue-5.15/ptp-support-multiple-timestamp-event-readers.patch [deleted file]
queue-5.15/series

diff --git a/queue-5.15/i915-move-list_count-to-list.h-as-list_count_nodes-f.patch b/queue-5.15/i915-move-list_count-to-list.h-as-list_count_nodes-f.patch
deleted file mode 100644 (file)
index c782d30..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-From e7acfdd65c2af947a6e8bf2fdfcc029c42aba44b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 30 Nov 2022 15:48:35 +0200
-Subject: i915: Move list_count() to list.h as list_count_nodes() for broader
- use
-
-From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
-[ Upstream commit 4d70c74659d9746502b23d055dba03d1d28ec388 ]
-
-Some of the existing users, and definitely will be new ones, want to
-count existing nodes in the list. Provide a generic API for that by
-moving code from i915 to list.h.
-
-Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
-Acked-by: Jani Nikula <jani.nikula@intel.com>
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/20221130134838.23805-1-andriy.shevchenko@linux.intel.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: 19ae40f572a9 ("ptp: Properly handle compat ioctls")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 15 ++-------------
- include/linux/list.h                      | 15 +++++++++++++++
- 2 files changed, 17 insertions(+), 13 deletions(-)
-
-diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
-index eb99441e0ada0..598a605d2cf71 100644
---- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
-+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
-@@ -1639,17 +1639,6 @@ static void print_request_ring(struct drm_printer *m, struct i915_request *rq)
-       }
- }
--static unsigned long list_count(struct list_head *list)
--{
--      struct list_head *pos;
--      unsigned long count = 0;
--
--      list_for_each(pos, list)
--              count++;
--
--      return count;
--}
--
- static unsigned long read_ul(void *p, size_t x)
- {
-       return *(unsigned long *)(p + x);
-@@ -1824,8 +1813,8 @@ void intel_engine_dump(struct intel_engine_cs *engine,
-       spin_lock_irqsave(&engine->sched_engine->lock, flags);
-       engine_dump_active_requests(engine, m);
--      drm_printf(m, "\tOn hold?: %lu\n",
--                 list_count(&engine->sched_engine->hold));
-+      drm_printf(m, "\tOn hold?: %zu\n",
-+                 list_count_nodes(&engine->sched_engine->hold));
-       spin_unlock_irqrestore(&engine->sched_engine->lock, flags);
-       drm_printf(m, "\tMMIO base:  0x%08x\n", engine->mmio_base);
-diff --git a/include/linux/list.h b/include/linux/list.h
-index d206ae93c06da..dd9285360dbc9 100644
---- a/include/linux/list.h
-+++ b/include/linux/list.h
-@@ -627,6 +627,21 @@ static inline void list_splice_tail_init(struct list_head *list,
-            !list_is_head(pos, (head)); \
-            pos = n, n = pos->prev)
-+/**
-+ * list_count_nodes - count nodes in the list
-+ * @head:     the head for your list.
-+ */
-+static inline size_t list_count_nodes(struct list_head *head)
-+{
-+      struct list_head *pos;
-+      size_t count = 0;
-+
-+      list_for_each(pos, head)
-+              count++;
-+
-+      return count;
-+}
-+
- /**
-  * list_entry_is_head - test if the entry points to the head of the list
-  * @pos:      the type * to cursor
--- 
-2.39.5
-
diff --git a/queue-5.15/posix-clock-introduce-posix_clock_context-concept.patch b/queue-5.15/posix-clock-introduce-posix_clock_context-concept.patch
deleted file mode 100644 (file)
index 73dcdda..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-From d3dbd7c7cecddf184931301a7970cbc1cd39da0b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 12 Oct 2023 00:39:53 +0200
-Subject: posix-clock: introduce posix_clock_context concept
-
-From: Xabier Marquiegui <reibax@gmail.com>
-
-[ Upstream commit 60c6946675fc06dd2fd2b7a4b6fd1c1f046f1056 ]
-
-Add the necessary structure to support custom private-data per
-posix-clock user.
-
-The previous implementation of posix-clock assumed all file open
-instances need access to the same clock structure on private_data.
-
-The need for individual data structures per file open instance has been
-identified when developing support for multiple timestamp event queue
-users for ptp_clock.
-
-Signed-off-by: Xabier Marquiegui <reibax@gmail.com>
-Suggested-by: Richard Cochran <richardcochran@gmail.com>
-Suggested-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: 19ae40f572a9 ("ptp: Properly handle compat ioctls")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/ptp/ptp_chardev.c   | 21 +++++++++++++--------
- drivers/ptp/ptp_private.h   | 16 +++++++++-------
- include/linux/posix-clock.h | 35 +++++++++++++++++++++++++++--------
- kernel/time/posix-clock.c   | 36 +++++++++++++++++++++++++++---------
- 4 files changed, 76 insertions(+), 32 deletions(-)
-
-diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
-index 8eb902fe73a98..2776f37713123 100644
---- a/drivers/ptp/ptp_chardev.c
-+++ b/drivers/ptp/ptp_chardev.c
-@@ -102,14 +102,16 @@ int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin,
-       return 0;
- }
--int ptp_open(struct posix_clock *pc, fmode_t fmode)
-+int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode)
- {
-       return 0;
- }
--long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
-+long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
-+             unsigned long arg)
- {
--      struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
-+      struct ptp_clock *ptp =
-+              container_of(pccontext->clk, struct ptp_clock, clock);
-       struct ptp_sys_offset_extended *extoff = NULL;
-       struct ptp_sys_offset_precise precise_offset;
-       struct system_device_crosststamp xtstamp;
-@@ -430,9 +432,11 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
-       return err;
- }
--__poll_t ptp_poll(struct posix_clock *pc, struct file *fp, poll_table *wait)
-+__poll_t ptp_poll(struct posix_clock_context *pccontext, struct file *fp,
-+                poll_table *wait)
- {
--      struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
-+      struct ptp_clock *ptp =
-+              container_of(pccontext->clk, struct ptp_clock, clock);
-       poll_wait(fp, &ptp->tsev_wq, wait);
-@@ -441,10 +445,11 @@ __poll_t ptp_poll(struct posix_clock *pc, struct file *fp, poll_table *wait)
- #define EXTTS_BUFSIZE (PTP_BUF_TIMESTAMPS * sizeof(struct ptp_extts_event))
--ssize_t ptp_read(struct posix_clock *pc,
--               uint rdflags, char __user *buf, size_t cnt)
-+ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags,
-+               char __user *buf, size_t cnt)
- {
--      struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
-+      struct ptp_clock *ptp =
-+              container_of(pccontext->clk, struct ptp_clock, clock);
-       struct timestamp_event_queue *queue = &ptp->tsevq;
-       struct ptp_extts_event *event;
-       unsigned long flags;
-diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
-index b336c12bb6976..ed6bf42fba86d 100644
---- a/drivers/ptp/ptp_private.h
-+++ b/drivers/ptp/ptp_private.h
-@@ -110,16 +110,18 @@ extern struct class *ptp_class;
- int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin,
-                   enum ptp_pin_function func, unsigned int chan);
--long ptp_ioctl(struct posix_clock *pc,
--             unsigned int cmd, unsigned long arg);
-+long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
-+             unsigned long arg);
--int ptp_open(struct posix_clock *pc, fmode_t fmode);
-+int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode);
--ssize_t ptp_read(struct posix_clock *pc,
--               uint flags, char __user *buf, size_t cnt);
-+int ptp_release(struct posix_clock_context *pccontext);
--__poll_t ptp_poll(struct posix_clock *pc,
--            struct file *fp, poll_table *wait);
-+ssize_t ptp_read(struct posix_clock_context *pccontext, uint flags, char __user *buf,
-+               size_t cnt);
-+
-+__poll_t ptp_poll(struct posix_clock_context *pccontext, struct file *fp,
-+                poll_table *wait);
- /*
-  * see ptp_sysfs.c
-diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
-index 468328b1e1dd5..ef8619f489203 100644
---- a/include/linux/posix-clock.h
-+++ b/include/linux/posix-clock.h
-@@ -14,6 +14,7 @@
- #include <linux/rwsem.h>
- struct posix_clock;
-+struct posix_clock_context;
- /**
-  * struct posix_clock_operations - functional interface to the clock
-@@ -50,18 +51,18 @@ struct posix_clock_operations {
-       /*
-        * Optional character device methods:
-        */
--      long    (*ioctl)   (struct posix_clock *pc,
--                          unsigned int cmd, unsigned long arg);
-+      long (*ioctl)(struct posix_clock_context *pccontext, unsigned int cmd,
-+                    unsigned long arg);
--      int     (*open)    (struct posix_clock *pc, fmode_t f_mode);
-+      int (*open)(struct posix_clock_context *pccontext, fmode_t f_mode);
--      __poll_t (*poll)   (struct posix_clock *pc,
--                          struct file *file, poll_table *wait);
-+      __poll_t (*poll)(struct posix_clock_context *pccontext, struct file *file,
-+                       poll_table *wait);
--      int     (*release) (struct posix_clock *pc);
-+      int (*release)(struct posix_clock_context *pccontext);
--      ssize_t (*read)    (struct posix_clock *pc,
--                          uint flags, char __user *buf, size_t cnt);
-+      ssize_t (*read)(struct posix_clock_context *pccontext, uint flags,
-+                      char __user *buf, size_t cnt);
- };
- /**
-@@ -90,6 +91,24 @@ struct posix_clock {
-       bool zombie;
- };
-+/**
-+ * struct posix_clock_context - represents clock file operations context
-+ *
-+ * @clk:              Pointer to the clock
-+ * @private_clkdata:  Pointer to user data
-+ *
-+ * Drivers should use struct posix_clock_context during specific character
-+ * device file operation methods to access the posix clock.
-+ *
-+ * Drivers can store a private data structure during the open operation
-+ * if they have specific information that is required in other file
-+ * operations.
-+ */
-+struct posix_clock_context {
-+      struct posix_clock *clk;
-+      void *private_clkdata;
-+};
-+
- /**
-  * posix_clock_register() - register a new clock
-  * @clk:   Pointer to the clock. Caller must provide 'ops' field
-diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
-index 05e73d209aa87..706559ed75793 100644
---- a/kernel/time/posix-clock.c
-+++ b/kernel/time/posix-clock.c
-@@ -19,7 +19,8 @@
-  */
- static struct posix_clock *get_posix_clock(struct file *fp)
- {
--      struct posix_clock *clk = fp->private_data;
-+      struct posix_clock_context *pccontext = fp->private_data;
-+      struct posix_clock *clk = pccontext->clk;
-       down_read(&clk->rwsem);
-@@ -39,6 +40,7 @@ static void put_posix_clock(struct posix_clock *clk)
- static ssize_t posix_clock_read(struct file *fp, char __user *buf,
-                               size_t count, loff_t *ppos)
- {
-+      struct posix_clock_context *pccontext = fp->private_data;
-       struct posix_clock *clk = get_posix_clock(fp);
-       int err = -EINVAL;
-@@ -46,7 +48,7 @@ static ssize_t posix_clock_read(struct file *fp, char __user *buf,
-               return -ENODEV;
-       if (clk->ops.read)
--              err = clk->ops.read(clk, fp->f_flags, buf, count);
-+              err = clk->ops.read(pccontext, fp->f_flags, buf, count);
-       put_posix_clock(clk);
-@@ -55,6 +57,7 @@ static ssize_t posix_clock_read(struct file *fp, char __user *buf,
- static __poll_t posix_clock_poll(struct file *fp, poll_table *wait)
- {
-+      struct posix_clock_context *pccontext = fp->private_data;
-       struct posix_clock *clk = get_posix_clock(fp);
-       __poll_t result = 0;
-@@ -62,7 +65,7 @@ static __poll_t posix_clock_poll(struct file *fp, poll_table *wait)
-               return EPOLLERR;
-       if (clk->ops.poll)
--              result = clk->ops.poll(clk, fp, wait);
-+              result = clk->ops.poll(pccontext, fp, wait);
-       put_posix_clock(clk);
-@@ -72,6 +75,7 @@ static __poll_t posix_clock_poll(struct file *fp, poll_table *wait)
- static long posix_clock_ioctl(struct file *fp,
-                             unsigned int cmd, unsigned long arg)
- {
-+      struct posix_clock_context *pccontext = fp->private_data;
-       struct posix_clock *clk = get_posix_clock(fp);
-       int err = -ENOTTY;
-@@ -79,7 +83,7 @@ static long posix_clock_ioctl(struct file *fp,
-               return -ENODEV;
-       if (clk->ops.ioctl)
--              err = clk->ops.ioctl(clk, cmd, arg);
-+              err = clk->ops.ioctl(pccontext, cmd, arg);
-       put_posix_clock(clk);
-@@ -90,6 +94,7 @@ static long posix_clock_ioctl(struct file *fp,
- static long posix_clock_compat_ioctl(struct file *fp,
-                                    unsigned int cmd, unsigned long arg)
- {
-+      struct posix_clock_context *pccontext = fp->private_data;
-       struct posix_clock *clk = get_posix_clock(fp);
-       int err = -ENOTTY;
-@@ -97,7 +102,7 @@ static long posix_clock_compat_ioctl(struct file *fp,
-               return -ENODEV;
-       if (clk->ops.ioctl)
--              err = clk->ops.ioctl(clk, cmd, arg);
-+              err = clk->ops.ioctl(pccontext, cmd, arg);
-       put_posix_clock(clk);
-@@ -110,6 +115,7 @@ static int posix_clock_open(struct inode *inode, struct file *fp)
-       int err;
-       struct posix_clock *clk =
-               container_of(inode->i_cdev, struct posix_clock, cdev);
-+      struct posix_clock_context *pccontext;
-       down_read(&clk->rwsem);
-@@ -117,14 +123,20 @@ static int posix_clock_open(struct inode *inode, struct file *fp)
-               err = -ENODEV;
-               goto out;
-       }
-+      pccontext = kzalloc(sizeof(*pccontext), GFP_KERNEL);
-+      if (!pccontext) {
-+              err = -ENOMEM;
-+              goto out;
-+      }
-+      pccontext->clk = clk;
-+      fp->private_data = pccontext;
-       if (clk->ops.open)
--              err = clk->ops.open(clk, fp->f_mode);
-+              err = clk->ops.open(pccontext, fp->f_mode);
-       else
-               err = 0;
-       if (!err) {
-               get_device(clk->dev);
--              fp->private_data = clk;
-       }
- out:
-       up_read(&clk->rwsem);
-@@ -133,14 +145,20 @@ static int posix_clock_open(struct inode *inode, struct file *fp)
- static int posix_clock_release(struct inode *inode, struct file *fp)
- {
--      struct posix_clock *clk = fp->private_data;
-+      struct posix_clock_context *pccontext = fp->private_data;
-+      struct posix_clock *clk;
-       int err = 0;
-+      if (!pccontext)
-+              return -ENODEV;
-+      clk = pccontext->clk;
-+
-       if (clk->ops.release)
--              err = clk->ops.release(clk);
-+              err = clk->ops.release(pccontext);
-       put_device(clk->dev);
-+      kfree(pccontext);
-       fp->private_data = NULL;
-       return err;
--- 
-2.39.5
-
index cd6093677142aa3eb9de77ecf3997f2694165fad..73cb12b492b2ed0223358a5ebc72b48cebc71ed1 100644 (file)
@@ -1,4 +1,4 @@
-From 7d612e2d279e7223b19b6a2d11d480396dcb37e9 Mon Sep 17 00:00:00 2001
+From 8c29a76b76bb089095af8d29efec226a005274ca Mon Sep 17 00:00:00 2001
 From: Sasha Levin <sashal@kernel.org>
 Date: Sat, 25 Jan 2025 10:28:38 +0100
 Subject: ptp: Properly handle compat ioctls
@@ -25,12 +25,11 @@ Acked-by: Richard Cochran <richardcochran@gmail.com>
 Link: https://patch.msgid.link/20250125-posix-clock-compat_ioctl-v2-1-11c865c500eb@weissschuh.net
 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
- drivers/ptp/ptp_chardev.c | 4 ++++
+ drivers/ptp/ptp_chardev.c |    4 ++++
  1 file changed, 4 insertions(+)
 
-diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
-index c48b9379ca094..8912e3efa00e2 100644
 --- a/drivers/ptp/ptp_chardev.c
 +++ b/drivers/ptp/ptp_chardev.c
 @@ -4,6 +4,7 @@
@@ -41,16 +40,13 @@ index c48b9379ca094..8912e3efa00e2 100644
  #include <linux/module.h>
  #include <linux/posix-clock.h>
  #include <linux/poll.h>
-@@ -159,6 +160,9 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
+@@ -124,6 +125,9 @@ long ptp_ioctl(struct posix_clock *pc, u
        struct timespec64 ts;
        int enable, err = 0;
  
 +      if (in_compat_syscall() && cmd != PTP_ENABLE_PPS && cmd != PTP_ENABLE_PPS2)
 +              arg = (unsigned long)compat_ptr(arg);
 +
-       tsevq = pccontext->private_clkdata;
        switch (cmd) {
--- 
-2.39.5
-
+       case PTP_CLOCK_GETCAPS:
diff --git a/queue-5.15/ptp-remove-usage-of-the-deprecated-ida_simple_xxx-ap.patch b/queue-5.15/ptp-remove-usage-of-the-deprecated-ida_simple_xxx-ap.patch
deleted file mode 100644 (file)
index 94558ca..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-From 8a4821b10bb2cb3b7032e73aa8d87e2d9574c870 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 25 Sep 2022 21:27:44 -0400
-Subject: ptp: Remove usage of the deprecated ida_simple_xxx API
-
-From: Bo Liu <liubo03@inspur.com>
-
-[ Upstream commit ab7ea1e73532247217d3e450015dd7ece966dc0e ]
-
-Use ida_alloc_xxx()/ida_free() instead of
-ida_simple_get()/ida_simple_remove().
-The latter is deprecated and more verbose.
-
-Signed-off-by: Bo Liu <liubo03@inspur.com>
-Link: https://lore.kernel.org/r/20220926012744.3363-1-liubo03@inspur.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 19ae40f572a9 ("ptp: Properly handle compat ioctls")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/ptp/ptp_clock.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
-index 92dd1c6f54f4a..25e37c2bc672b 100644
---- a/drivers/ptp/ptp_clock.c
-+++ b/drivers/ptp/ptp_clock.c
-@@ -176,7 +176,7 @@ static void ptp_clock_release(struct device *dev)
-       mutex_destroy(&ptp->tsevq_mux);
-       mutex_destroy(&ptp->pincfg_mux);
-       mutex_destroy(&ptp->n_vclocks_mux);
--      ida_simple_remove(&ptp_clocks_map, ptp->index);
-+      ida_free(&ptp_clocks_map, ptp->index);
-       kfree(ptp);
- }
-@@ -211,7 +211,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
-       if (ptp == NULL)
-               goto no_memory;
--      index = ida_simple_get(&ptp_clocks_map, 0, MINORMASK + 1, GFP_KERNEL);
-+      index = ida_alloc_max(&ptp_clocks_map, MINORMASK, GFP_KERNEL);
-       if (index < 0) {
-               err = index;
-               goto no_slot;
-@@ -311,7 +311,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
-       mutex_destroy(&ptp->tsevq_mux);
-       mutex_destroy(&ptp->pincfg_mux);
-       mutex_destroy(&ptp->n_vclocks_mux);
--      ida_simple_remove(&ptp_clocks_map, index);
-+      ida_free(&ptp_clocks_map, index);
- no_slot:
-       kfree(ptp);
- no_memory:
--- 
-2.39.5
-
diff --git a/queue-5.15/ptp-replace-timestamp-event-queue-with-linked-list.patch b/queue-5.15/ptp-replace-timestamp-event-queue-with-linked-list.patch
deleted file mode 100644 (file)
index 5a89b0c..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-From f1a224315c4ce57c28eb4d157062f342bc25250e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 12 Oct 2023 00:39:54 +0200
-Subject: ptp: Replace timestamp event queue with linked list
-
-From: Xabier Marquiegui <reibax@gmail.com>
-
-[ Upstream commit d26ab5a35ad9920940a9e07665130d501b2ae1a3 ]
-
-Introduce linked lists to access the timestamp event queue.
-
-Signed-off-by: Xabier Marquiegui <reibax@gmail.com>
-Suggested-by: Richard Cochran <richardcochran@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: 19ae40f572a9 ("ptp: Properly handle compat ioctls")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/ptp/ptp_chardev.c | 12 ++++++++++--
- drivers/ptp/ptp_clock.c   | 26 ++++++++++++++++++++++++--
- drivers/ptp/ptp_private.h |  4 +++-
- drivers/ptp/ptp_sysfs.c   |  6 +++++-
- 4 files changed, 42 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
-index 2776f37713123..82b5a68d1ca34 100644
---- a/drivers/ptp/ptp_chardev.c
-+++ b/drivers/ptp/ptp_chardev.c
-@@ -437,10 +437,14 @@ __poll_t ptp_poll(struct posix_clock_context *pccontext, struct file *fp,
- {
-       struct ptp_clock *ptp =
-               container_of(pccontext->clk, struct ptp_clock, clock);
-+      struct timestamp_event_queue *queue;
-       poll_wait(fp, &ptp->tsev_wq, wait);
--      return queue_cnt(&ptp->tsevq) ? EPOLLIN : 0;
-+      /* Extract only the first element in the queue list */
-+      queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, qlist);
-+
-+      return queue_cnt(queue) ? EPOLLIN : 0;
- }
- #define EXTTS_BUFSIZE (PTP_BUF_TIMESTAMPS * sizeof(struct ptp_extts_event))
-@@ -450,12 +454,16 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags,
- {
-       struct ptp_clock *ptp =
-               container_of(pccontext->clk, struct ptp_clock, clock);
--      struct timestamp_event_queue *queue = &ptp->tsevq;
-+      struct timestamp_event_queue *queue;
-       struct ptp_extts_event *event;
-       unsigned long flags;
-       size_t qcnt, i;
-       int result;
-+      /* Extract only the first element in the queue list */
-+      queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue,
-+                               qlist);
-+
-       if (cnt % sizeof(struct ptp_extts_event) != 0)
-               return -EINVAL;
-diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
-index 25e37c2bc672b..ff40f902f706f 100644
---- a/drivers/ptp/ptp_clock.c
-+++ b/drivers/ptp/ptp_clock.c
-@@ -170,12 +170,21 @@ static struct posix_clock_operations ptp_clock_ops = {
- static void ptp_clock_release(struct device *dev)
- {
-       struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev);
-+      struct timestamp_event_queue *tsevq;
-+      unsigned long flags;
-       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 */
-+      tsevq = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue,
-+                               qlist);
-+      spin_lock_irqsave(&tsevq->lock, flags);
-+      list_del(&tsevq->qlist);
-+      spin_unlock_irqrestore(&tsevq->lock, flags);
-+      kfree(tsevq);
-       ida_free(&ptp_clocks_map, ptp->index);
-       kfree(ptp);
- }
-@@ -199,6 +208,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
-                                    struct device *parent)
- {
-       struct ptp_clock *ptp;
-+      struct timestamp_event_queue *queue = NULL;
-       int err = 0, index, major = MAJOR(ptp_devt);
-       size_t size;
-@@ -221,7 +231,12 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
-       ptp->info = info;
-       ptp->devid = MKDEV(major, index);
-       ptp->index = index;
--      spin_lock_init(&ptp->tsevq.lock);
-+      INIT_LIST_HEAD(&ptp->tsevqs);
-+      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);
-       mutex_init(&ptp->pincfg_mux);
-       mutex_init(&ptp->n_vclocks_mux);
-@@ -311,6 +326,9 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
-       mutex_destroy(&ptp->tsevq_mux);
-       mutex_destroy(&ptp->pincfg_mux);
-       mutex_destroy(&ptp->n_vclocks_mux);
-+      list_del(&queue->qlist);
-+      kfree(queue);
-+no_memory_queue:
-       ida_free(&ptp_clocks_map, index);
- no_slot:
-       kfree(ptp);
-@@ -353,6 +371,7 @@ EXPORT_SYMBOL(ptp_clock_unregister);
- void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event)
- {
-+      struct timestamp_event_queue *tsevq;
-       struct pps_event_time evt;
-       switch (event->type) {
-@@ -361,7 +380,10 @@ void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event)
-               break;
-       case PTP_CLOCK_EXTTS:
--              enqueue_external_timestamp(&ptp->tsevq, event);
-+              /* Enqueue timestamp on all queues */
-+              list_for_each_entry(tsevq, &ptp->tsevqs, qlist) {
-+                      enqueue_external_timestamp(tsevq, event);
-+              }
-               wake_up_interruptible(&ptp->tsev_wq);
-               break;
-diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
-index ed6bf42fba86d..a469623f22751 100644
---- a/drivers/ptp/ptp_private.h
-+++ b/drivers/ptp/ptp_private.h
-@@ -15,6 +15,7 @@
- #include <linux/ptp_clock.h>
- #include <linux/ptp_clock_kernel.h>
- #include <linux/time.h>
-+#include <linux/list.h>
- #define PTP_MAX_TIMESTAMPS 128
- #define PTP_BUF_TIMESTAMPS 30
-@@ -25,6 +26,7 @@ struct timestamp_event_queue {
-       int head;
-       int tail;
-       spinlock_t lock;
-+      struct list_head qlist;
- };
- struct ptp_clock {
-@@ -35,7 +37,7 @@ struct ptp_clock {
-       int index; /* index into clocks.map */
-       struct pps_device *pps_source;
-       long dialed_frequency; /* remembers the frequency adjustment */
--      struct timestamp_event_queue tsevq; /* simple fifo for time stamps */
-+      struct list_head tsevqs; /* timestamp fifo list */
-       struct mutex tsevq_mux; /* one process at a time reading the fifo */
-       struct mutex pincfg_mux; /* protect concurrent info->pin_config access */
-       wait_queue_head_t tsev_wq;
-diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
-index be58d5257bcb6..2b2caca45a7d7 100644
---- a/drivers/ptp/ptp_sysfs.c
-+++ b/drivers/ptp/ptp_sysfs.c
-@@ -64,12 +64,16 @@ static ssize_t extts_fifo_show(struct device *dev,
-                              struct device_attribute *attr, char *page)
- {
-       struct ptp_clock *ptp = dev_get_drvdata(dev);
--      struct timestamp_event_queue *queue = &ptp->tsevq;
-+      struct timestamp_event_queue *queue;
-       struct ptp_extts_event event;
-       unsigned long flags;
-       size_t qcnt;
-       int cnt = 0;
-+      /* The sysfs fifo will always draw from the fist queue */
-+      queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue,
-+                               qlist);
-+
-       memset(&event, 0, sizeof(event));
-       if (mutex_lock_interruptible(&ptp->tsevq_mux))
--- 
-2.39.5
-
diff --git a/queue-5.15/ptp-support-event-queue-reader-channel-masks.patch b/queue-5.15/ptp-support-event-queue-reader-channel-masks.patch
deleted file mode 100644 (file)
index 7ad6ba7..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-From aa92e17a6bc056b506704a3fbaf3c553ffdc4ff6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 12 Oct 2023 00:39:56 +0200
-Subject: ptp: support event queue reader channel masks
-
-From: Xabier Marquiegui <reibax@gmail.com>
-
-[ Upstream commit c5a445b1e9347b14752b01f1a304bd7a2f260acc ]
-
-On systems with multiple timestamp event channels, some readers might
-want to receive only a subset of those channels.
-
-Add the necessary modifications to support timestamp event channel
-filtering, including two IOCTL operations:
-
-- Clear all channels
-- Enable one channel
-
-The mask modification operations will be applied exclusively on the
-event queue assigned to the file descriptor used on the IOCTL operation,
-so the typical procedure to have a reader receiving only a subset of the
-enabled channels would be:
-
-- Open device file
-- ioctl: clear all channels
-- ioctl: enable one channel
-- start reading
-
-Calling the enable one channel ioctl more than once will result in
-multiple enabled channels.
-
-Signed-off-by: Xabier Marquiegui <reibax@gmail.com>
-Suggested-by: Richard Cochran <richardcochran@gmail.com>
-Suggested-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: 19ae40f572a9 ("ptp: Properly handle compat ioctls")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/ptp/ptp_chardev.c      | 26 ++++++++++++++++++++++++++
- drivers/ptp/ptp_clock.c        | 12 ++++++++++--
- drivers/ptp/ptp_private.h      |  3 +++
- include/uapi/linux/ptp_clock.h |  2 ++
- 4 files changed, 41 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
-index 3c795fee49262..c48b9379ca094 100644
---- a/drivers/ptp/ptp_chardev.c
-+++ b/drivers/ptp/ptp_chardev.c
-@@ -111,6 +111,12 @@ int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode)
-       queue = kzalloc(sizeof(*queue), GFP_KERNEL);
-       if (!queue)
-               return -EINVAL;
-+      queue->mask = bitmap_alloc(PTP_MAX_CHANNELS, GFP_KERNEL);
-+      if (!queue->mask) {
-+              kfree(queue);
-+              return -EINVAL;
-+      }
-+      bitmap_set(queue->mask, 0, PTP_MAX_CHANNELS);
-       spin_lock_init(&queue->lock);
-       list_add_tail(&queue->qlist, &ptp->tsevqs);
-       pccontext->private_clkdata = queue;
-@@ -127,6 +133,7 @@ int ptp_release(struct posix_clock_context *pccontext)
-               spin_lock_irqsave(&queue->lock, flags);
-               list_del(&queue->qlist);
-               spin_unlock_irqrestore(&queue->lock, flags);
-+              bitmap_free(queue->mask);
-               kfree(queue);
-       }
-       return 0;
-@@ -142,6 +149,7 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
-       struct system_device_crosststamp xtstamp;
-       struct ptp_clock_info *ops = ptp->info;
-       struct ptp_sys_offset *sysoff = NULL;
-+      struct timestamp_event_queue *tsevq;
-       struct ptp_system_timestamp sts;
-       struct ptp_clock_request req;
-       struct ptp_clock_caps caps;
-@@ -151,6 +159,8 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
-       struct timespec64 ts;
-       int enable, err = 0;
-+      tsevq = pccontext->private_clkdata;
-+
-       switch (cmd) {
-       case PTP_CLOCK_GETCAPS:
-@@ -446,6 +456,22 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
-               mutex_unlock(&ptp->pincfg_mux);
-               break;
-+      case PTP_MASK_CLEAR_ALL:
-+              bitmap_clear(tsevq->mask, 0, PTP_MAX_CHANNELS);
-+              break;
-+
-+      case PTP_MASK_EN_SINGLE:
-+              if (copy_from_user(&i, (void __user *)arg, sizeof(i))) {
-+                      err = -EFAULT;
-+                      break;
-+              }
-+              if (i >= PTP_MAX_CHANNELS) {
-+                      err = -EFAULT;
-+                      break;
-+              }
-+              set_bit(i, tsevq->mask);
-+              break;
-+
-       default:
-               err = -ENOTTY;
-               break;
-diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
-index c677a45474360..1e398fe5694db 100644
---- a/drivers/ptp/ptp_clock.c
-+++ b/drivers/ptp/ptp_clock.c
-@@ -184,6 +184,7 @@ static void ptp_clock_release(struct device *dev)
-       spin_lock_irqsave(&tsevq->lock, flags);
-       list_del(&tsevq->qlist);
-       spin_unlock_irqrestore(&tsevq->lock, flags);
-+      bitmap_free(tsevq->mask);
-       kfree(tsevq);
-       ida_free(&ptp_clocks_map, ptp->index);
-       kfree(ptp);
-@@ -236,6 +237,10 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
-       if (!queue)
-               goto no_memory_queue;
-       list_add_tail(&queue->qlist, &ptp->tsevqs);
-+      queue->mask = bitmap_alloc(PTP_MAX_CHANNELS, GFP_KERNEL);
-+      if (!queue->mask)
-+              goto no_memory_bitmap;
-+      bitmap_set(queue->mask, 0, PTP_MAX_CHANNELS);
-       spin_lock_init(&queue->lock);
-       mutex_init(&ptp->pincfg_mux);
-       mutex_init(&ptp->n_vclocks_mux);
-@@ -324,6 +329,8 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
- kworker_err:
-       mutex_destroy(&ptp->pincfg_mux);
-       mutex_destroy(&ptp->n_vclocks_mux);
-+      bitmap_free(queue->mask);
-+no_memory_bitmap:
-       list_del(&queue->qlist);
-       kfree(queue);
- no_memory_queue:
-@@ -378,9 +385,10 @@ void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event)
-               break;
-       case PTP_CLOCK_EXTTS:
--              /* Enqueue timestamp on all queues */
-+              /* Enqueue timestamp on selected queues */
-               list_for_each_entry(tsevq, &ptp->tsevqs, qlist) {
--                      enqueue_external_timestamp(tsevq, event);
-+                      if (test_bit((unsigned int)event->index, tsevq->mask))
-+                              enqueue_external_timestamp(tsevq, event);
-               }
-               wake_up_interruptible(&ptp->tsev_wq);
-               break;
-diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
-index baee5123dc22f..cc95f49abce5f 100644
---- a/drivers/ptp/ptp_private.h
-+++ b/drivers/ptp/ptp_private.h
-@@ -16,10 +16,12 @@
- #include <linux/ptp_clock_kernel.h>
- #include <linux/time.h>
- #include <linux/list.h>
-+#include <linux/bitmap.h>
- #define PTP_MAX_TIMESTAMPS 128
- #define PTP_BUF_TIMESTAMPS 30
- #define PTP_DEFAULT_MAX_VCLOCKS 20
-+#define PTP_MAX_CHANNELS 2048
- struct timestamp_event_queue {
-       struct ptp_extts_event buf[PTP_MAX_TIMESTAMPS];
-@@ -27,6 +29,7 @@ struct timestamp_event_queue {
-       int tail;
-       spinlock_t lock;
-       struct list_head qlist;
-+      unsigned long *mask;
- };
- struct ptp_clock {
-diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h
-index 1d108d597f66d..2c4a479084b14 100644
---- a/include/uapi/linux/ptp_clock.h
-+++ b/include/uapi/linux/ptp_clock.h
-@@ -223,6 +223,8 @@ struct ptp_pin_desc {
-       _IOWR(PTP_CLK_MAGIC, 17, struct ptp_sys_offset_precise)
- #define PTP_SYS_OFFSET_EXTENDED2 \
-       _IOWR(PTP_CLK_MAGIC, 18, struct ptp_sys_offset_extended)
-+#define PTP_MASK_CLEAR_ALL  _IO(PTP_CLK_MAGIC, 19)
-+#define PTP_MASK_EN_SINGLE  _IOW(PTP_CLK_MAGIC, 20, unsigned int)
- struct ptp_extts_event {
-       struct ptp_clock_time t; /* Time event occured. */
--- 
-2.39.5
-
diff --git a/queue-5.15/ptp-support-multiple-timestamp-event-readers.patch b/queue-5.15/ptp-support-multiple-timestamp-event-readers.patch
deleted file mode 100644 (file)
index b187ce5..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-From 71884617a75ed903c04c09be4f759f634e9127f0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 12 Oct 2023 00:39:55 +0200
-Subject: ptp: support multiple timestamp event readers
-
-From: Xabier Marquiegui <reibax@gmail.com>
-
-[ Upstream commit 8f5de6fb245326704f37d91780b9a10253a8a100 ]
-
-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>
-Stable-dep-of: 19ae40f572a9 ("ptp: Properly handle compat ioctls")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/ptp/ptp_chardev.c | 68 ++++++++++++++++++++++++++++-----------
- drivers/ptp/ptp_clock.c   |  6 ++--
- drivers/ptp/ptp_private.h |  1 -
- drivers/ptp/ptp_sysfs.c   |  9 +++---
- 4 files changed, 55 insertions(+), 29 deletions(-)
-
-diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
-index 82b5a68d1ca34..3c795fee49262 100644
---- a/drivers/ptp/ptp_chardev.c
-+++ b/drivers/ptp/ptp_chardev.c
-@@ -104,6 +104,31 @@ int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin,
- int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode)
- {
-+      struct ptp_clock *ptp =
-+              container_of(pccontext->clk, struct ptp_clock, clock);
-+      struct timestamp_event_queue *queue;
-+
-+      queue = kzalloc(sizeof(*queue), GFP_KERNEL);
-+      if (!queue)
-+              return -EINVAL;
-+      spin_lock_init(&queue->lock);
-+      list_add_tail(&queue->qlist, &ptp->tsevqs);
-+      pccontext->private_clkdata = queue;
-+      return 0;
-+}
-+
-+int ptp_release(struct posix_clock_context *pccontext)
-+{
-+      struct timestamp_event_queue *queue = pccontext->private_clkdata;
-+      unsigned long flags;
-+
-+      if (queue) {
-+              pccontext->private_clkdata = NULL;
-+              spin_lock_irqsave(&queue->lock, flags);
-+              list_del(&queue->qlist);
-+              spin_unlock_irqrestore(&queue->lock, flags);
-+              kfree(queue);
-+      }
-       return 0;
- }
-@@ -439,10 +464,11 @@ __poll_t ptp_poll(struct posix_clock_context *pccontext, struct file *fp,
-               container_of(pccontext->clk, struct ptp_clock, clock);
-       struct timestamp_event_queue *queue;
--      poll_wait(fp, &ptp->tsev_wq, wait);
-+      queue = pccontext->private_clkdata;
-+      if (!queue)
-+              return EPOLLERR;
--      /* Extract only the first element in the queue list */
--      queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, qlist);
-+      poll_wait(fp, &ptp->tsev_wq, wait);
-       return queue_cnt(queue) ? EPOLLIN : 0;
- }
-@@ -460,36 +486,36 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags,
-       size_t qcnt, i;
-       int result;
--      /* Extract only the first element in the queue list */
--      queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue,
--                               qlist);
-+      queue = pccontext->private_clkdata;
-+      if (!queue) {
-+              result = -EINVAL;
-+              goto exit;
-+      }
--      if (cnt % sizeof(struct ptp_extts_event) != 0)
--              return -EINVAL;
-+      if (cnt % sizeof(struct ptp_extts_event) != 0) {
-+              result = -EINVAL;
-+              goto exit;
-+      }
-       if (cnt > EXTTS_BUFSIZE)
-               cnt = EXTTS_BUFSIZE;
-       cnt = cnt / sizeof(struct ptp_extts_event);
--      if (mutex_lock_interruptible(&ptp->tsevq_mux))
--              return -ERESTARTSYS;
--
-       if (wait_event_interruptible(ptp->tsev_wq,
-                                    ptp->defunct || queue_cnt(queue))) {
--              mutex_unlock(&ptp->tsevq_mux);
-               return -ERESTARTSYS;
-       }
-       if (ptp->defunct) {
--              mutex_unlock(&ptp->tsevq_mux);
--              return -ENODEV;
-+              result = -ENODEV;
-+              goto exit;
-       }
-       event = kmalloc(EXTTS_BUFSIZE, GFP_KERNEL);
-       if (!event) {
--              mutex_unlock(&ptp->tsevq_mux);
--              return -ENOMEM;
-+              result = -ENOMEM;
-+              goto exit;
-       }
-       spin_lock_irqsave(&queue->lock, flags);
-@@ -509,12 +535,16 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags,
-       cnt = cnt * sizeof(struct ptp_extts_event);
--      mutex_unlock(&ptp->tsevq_mux);
--
-       result = cnt;
--      if (copy_to_user(buf, event, cnt))
-+      if (copy_to_user(buf, event, cnt)) {
-               result = -EFAULT;
-+              goto free_event;
-+      }
-+free_event:
-       kfree(event);
-+exit:
-+      if (result < 0)
-+              ptp_release(pccontext);
-       return result;
- }
-diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
-index ff40f902f706f..c677a45474360 100644
---- a/drivers/ptp/ptp_clock.c
-+++ b/drivers/ptp/ptp_clock.c
-@@ -163,6 +163,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,
- };
-@@ -175,7 +176,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 */
-@@ -235,9 +235,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);
-@@ -323,7 +322,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
-       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);
-diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
-index a469623f22751..baee5123dc22f 100644
---- a/drivers/ptp/ptp_private.h
-+++ b/drivers/ptp/ptp_private.h
-@@ -38,7 +38,6 @@ struct ptp_clock {
-       struct pps_device *pps_source;
-       long dialed_frequency; /* remembers the frequency adjustment */
-       struct list_head tsevqs; /* timestamp fifo list */
--      struct mutex tsevq_mux; /* one process at a time reading the fifo */
-       struct mutex pincfg_mux; /* protect concurrent info->pin_config access */
-       wait_queue_head_t tsev_wq;
-       int defunct; /* tells readers to go away when clock is being removed */
-diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
-index 2b2caca45a7d7..5986cb0c502c9 100644
---- a/drivers/ptp/ptp_sysfs.c
-+++ b/drivers/ptp/ptp_sysfs.c
-@@ -70,15 +70,15 @@ static ssize_t extts_fifo_show(struct device *dev,
-       size_t qcnt;
-       int cnt = 0;
-+      cnt = list_count_nodes(&ptp->tsevqs);
-+      if (cnt <= 0)
-+              goto out;
-+
-       /* The sysfs fifo will always draw from the fist queue */
-       queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue,
-                                qlist);
-       memset(&event, 0, sizeof(event));
--
--      if (mutex_lock_interruptible(&ptp->tsevq_mux))
--              return -ERESTARTSYS;
--
-       spin_lock_irqsave(&queue->lock, flags);
-       qcnt = queue_cnt(queue);
-       if (qcnt) {
-@@ -94,7 +94,6 @@ static ssize_t extts_fifo_show(struct device *dev,
-       cnt = snprintf(page, PAGE_SIZE, "%u %lld %u\n",
-                      event.index, event.t.sec, event.t.nsec);
- out:
--      mutex_unlock(&ptp->tsevq_mux);
-       return cnt;
- }
- static DEVICE_ATTR(fifo, 0444, extts_fifo_show, NULL);
--- 
-2.39.5
-
index 5e5e21ee7d5b9920a92478e49b1312091e163187..1f1ee81b41432893ba70c5e033e4ca5567fd24fe 100644 (file)
@@ -168,12 +168,6 @@ pm-hibernate-add-error-handling-for-syscore_suspend.patch
 net-rose-fix-timer-races-against-user-threads.patch
 net-netdevsim-try-to-close-udp-port-harness-races.patch
 net-davicom-fix-uaf-in-dm9000_drv_remove.patch
-ptp-remove-usage-of-the-deprecated-ida_simple_xxx-ap.patch
-i915-move-list_count-to-list.h-as-list_count_nodes-f.patch
-posix-clock-introduce-posix_clock_context-concept.patch
-ptp-replace-timestamp-event-queue-with-linked-list.patch
-ptp-support-multiple-timestamp-event-readers.patch
-ptp-support-event-queue-reader-channel-masks.patch
 ptp-properly-handle-compat-ioctls.patch
 perf-trace-fix-runtime-error-of-index-out-of-bounds.patch
 pm-sleep-restore-asynchronous-device-resume-optimiza.patch