[PATCH 1/5] Add the debug filesystem framework
dreamfly281 at gmail.com
dreamfly281 at gmail.com
Mon Jul 8 03:04:11 EDT 2013
From: Yanbo Li <yanbol at qti.qualcomm.com>
This patch add the debug file system framework which
will be used to add some dynamic debug switcher.
Signed-off-by: Yanbo Li <yanbol at qti.qualcomm.com>
---
Makefile | 3 ++-
debug.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
debug.h | 39 +++++++++++++++++++++++++++++++++++++++
main.c | 2 ++
wcn36xx.h | 4 ++++
5 files changed, 104 insertions(+), 1 deletion(-)
create mode 100644 debug.c
create mode 100644 debug.h
diff --git a/Makefile b/Makefile
index 302216f..12c6d23 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,8 @@ ifneq ($(KERNELRELEASE),)
main.o \
dxe.o \
txrx.o \
- smd.o
+ smd.o \
+ debug.o
obj-m := wcn36xx.o
else
diff --git a/debug.c b/debug.c
new file mode 100644
index 0000000..a54f15d
--- /dev/null
+++ b/debug.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+ *
+ * Licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * 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.
+ */
+
+#include <linux/debugfs.h>
+#include <linux/uaccess.h>
+#include "wcn36xx.h"
+#include "debug.h"
+
+#define ADD_FILE_BOOL(name, mode, fop, priv_data) \
+ do { \
+ struct dentry *d; \
+ d = debugfs_create_file(__stringify(name), \
+ mode, dfs->rootdir, \
+ priv_data, fop); \
+ dfs->file_##name.dentry = d; \
+ if (IS_ERR(d)) { \
+ wcn36xx_warn("Create the debugfs entry failed");\
+ dfs->file_##name.dentry = NULL; \
+ } \
+ } while (0)
+
+
+void wcn36xx_debugfs_init(struct wcn36xx *wcn)
+{
+ struct wcn36xx_dfs_entry *dfs = &wcn->dfs;
+
+ dfs->rootdir = debugfs_create_dir(KBUILD_MODNAME,
+ wcn->hw->wiphy->debugfsdir);
+ if (IS_ERR(dfs->rootdir)) {
+ wcn36xx_warn("Create the debugfs failed");
+ dfs->rootdir = NULL;
+ }
+}
+
+void wcn36xx_debugfs_exit(struct wcn36xx *wcn)
+{
+ struct wcn36xx_dfs_entry *dfs = &wcn->dfs;
+ debugfs_remove_recursive(dfs->rootdir);
+}
diff --git a/debug.h b/debug.h
new file mode 100644
index 0000000..f74e582
--- /dev/null
+++ b/debug.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+ *
+ * Licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * 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.
+ */
+
+#ifndef _WCN36XX_DEBUG_H_
+#define _WCN36XX_DEBUG_H_
+
+#include <linux/kernel.h>
+
+struct wcn36xx_dfs_file {
+ struct dentry *dentry;
+ u32 value;
+};
+
+struct wcn36xx_dfs_entry {
+ struct dentry *rootdir;
+};
+
+void wcn36xx_debugfs_init(struct wcn36xx *wcn);
+void wcn36xx_debugfs_exit(struct wcn36xx *wcn);
+
+#endif /* _WCN36XX_DEBUG_H_ */
diff --git a/main.c b/main.c
index 0cc3e02..3798744 100644
--- a/main.c
+++ b/main.c
@@ -235,6 +235,7 @@ static int wcn36xx_start(struct ieee80211_hw *hw)
wcn36xx_error("DXE init failed");
goto out_smd_stop;
}
+ wcn36xx_debugfs_init(wcn);
return 0;
out_smd_stop:
@@ -256,6 +257,7 @@ static void wcn36xx_stop(struct ieee80211_hw *hw)
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac stop");
+ wcn36xx_debugfs_exit(wcn);
wcn36xx_smd_stop(wcn);
wcn36xx_dxe_deinit(wcn);
wcn36xx_smd_close(wcn);
diff --git a/wcn36xx.h b/wcn36xx.h
index 2c72349..c1ceafb 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -28,6 +28,7 @@
#include "hal.h"
#include "smd.h"
#include "dxe.h"
+#include "debug.h"
#define DRIVER_PREFIX "wcn36xx: "
#define WLAN_NV_FILE "wlan/prima/WCNSS_qcom_wlan_nv.bin"
@@ -161,6 +162,9 @@ struct wcn36xx {
struct wcn36xx_dxe_mem_pool data_mem_pool;
struct sk_buff *tx_ack_skb;
+
+ /* Debug file system entry */
+ struct wcn36xx_dfs_entry dfs;
};
#endif /* _WCN36XX_H_ */
--
1.7.9.5
More information about the wcn36xx
mailing list