summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qdf/inc/qdf_debugfs.h60
-rw-r--r--qdf/linux/src/i_qdf_debugfs.h36
-rw-r--r--qdf/linux/src/qdf_debugfs.c54
3 files changed, 150 insertions, 0 deletions
diff --git a/qdf/inc/qdf_debugfs.h b/qdf/inc/qdf_debugfs.h
new file mode 100644
index 000000000000..339e5ac84e04
--- /dev/null
+++ b/qdf/inc/qdf_debugfs.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: qdf_debugfs.h
+ * This file provides OS abstraction for debug filesystem APIs.
+ */
+
+#ifndef _QDF_DEBUGFS_H
+#define _QDF_DEBUGFS_H
+
+#include <qdf_status.h>
+#include <i_qdf_debugfs.h>
+
+#ifdef WLAN_DEBUGFS
+/**
+ * qdf_debugfs_init() - initialize debugfs
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS qdf_debugfs_init(void);
+
+/**
+ * qdf_debugfs_exit() - cleanup debugfs
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS qdf_debugfs_exit(void);
+
+#else
+
+static inline QDF_STATUS qdf_debugfs_init(void)
+{
+ return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline QDF_STATUS qdf_debugfs_exit(void)
+{
+ return QDF_STATUS_E_NOSUPPORT;
+}
+
+#endif /* WLAN_DEBUGFS */
+#endif /* _QDF_DEBUGFS_H */
+
+
diff --git a/qdf/linux/src/i_qdf_debugfs.h b/qdf/linux/src/i_qdf_debugfs.h
new file mode 100644
index 000000000000..4f64484a3cdf
--- /dev/null
+++ b/qdf/linux/src/i_qdf_debugfs.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: qdf_debugfs.h
+ * Linux specific implementation for debug filesystem APIs.
+ */
+
+
+#ifndef _I_QDF_DEBUGFS_H
+#define _I_QDF_DEBUGFS_H
+
+#include <linux/fs.h>
+#include <linux/debugfs.h>
+
+#ifdef WLAN_DEBUGFS
+
+struct dentry *qdf_debugfs_get_root(void);
+
+#endif /* WLAN_DEBUGFS */
+#endif /* _I_QDF_DEBUGFS_H */
diff --git a/qdf/linux/src/qdf_debugfs.c b/qdf/linux/src/qdf_debugfs.c
new file mode 100644
index 000000000000..4a8bb9d7ca2d
--- /dev/null
+++ b/qdf/linux/src/qdf_debugfs.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: qdf_debugfs
+ * This file provides QDF debug file system APIs
+ */
+
+#include <qdf_debugfs.h>
+#include <i_qdf_debugfs.h>
+
+/* entry for root debugfs directory*/
+static struct dentry *qdf_debugfs_root;
+
+QDF_STATUS qdf_debugfs_init(void)
+{
+ qdf_debugfs_root = debugfs_create_dir(KBUILD_MODNAME"_qdf", NULL);
+
+ if (!qdf_debugfs_root)
+ return QDF_STATUS_E_FAILURE;
+
+ return QDF_STATUS_SUCCESS;
+}
+EXPORT_SYMBOL(qdf_debugfs_init);
+
+QDF_STATUS qdf_debugfs_exit(void)
+{
+ debugfs_remove_recursive(qdf_debugfs_root);
+ qdf_debugfs_root = NULL;
+
+ return QDF_STATUS_SUCCESS;
+}
+EXPORT_SYMBOL(qdf_debugfs_exit);
+
+struct dentry *qdf_debugfs_get_root(void)
+{
+ return qdf_debugfs_root;
+}
+