summaryrefslogtreecommitdiffstats
path: root/drivers/ptp/ptp_chardev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ptp/ptp_chardev.c')
-rw-r--r--drivers/ptp/ptp_chardev.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index ac2f2b5ea0b7..282cd7d24077 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -10,6 +10,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/timekeeping.h>
+#include <linux/debugfs.h>
#include <linux/nospec.h>
@@ -106,6 +107,7 @@ 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;
+ char debugfsname[32];
queue = kzalloc(sizeof(*queue), GFP_KERNEL);
if (!queue)
@@ -119,6 +121,17 @@ int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode)
spin_lock_init(&queue->lock);
list_add_tail(&queue->qlist, &ptp->tsevqs);
pccontext->private_clkdata = queue;
+
+ /* Debugfs contents */
+ sprintf(debugfsname, "0x%p", queue);
+ queue->debugfs_instance =
+ debugfs_create_dir(debugfsname, ptp->debugfs_root);
+ queue->dfs_bitmap.array = (u32 *)queue->mask;
+ queue->dfs_bitmap.n_elements =
+ DIV_ROUND_UP(PTP_MAX_CHANNELS, BITS_PER_BYTE * sizeof(u32));
+ debugfs_create_u32_array("mask", 0444, queue->debugfs_instance,
+ &queue->dfs_bitmap);
+
return 0;
}
@@ -128,6 +141,7 @@ int ptp_release(struct posix_clock_context *pccontext)
unsigned long flags;
if (queue) {
+ debugfs_remove(queue->debugfs_instance);
pccontext->private_clkdata = NULL;
spin_lock_irqsave(&queue->lock, flags);
list_del(&queue->qlist);