Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: chromeos/compat-wireless/drivers/net/wireless/ath/ath9k/debug.c

Issue 6393011: ath9k: Add pktlog support Base URL: ssh://git@gitrw.chromium.org:9222/kernel.git@master
Patch Set: add missing files Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/compat-wireless/drivers/net/wireless/ath/ath9k/debug.c
diff --git a/chromeos/compat-wireless/drivers/net/wireless/ath/ath9k/debug.c b/chromeos/compat-wireless/drivers/net/wireless/ath/ath9k/debug.c
index 7a6367c1c50b938752f435798c00429b9b4b0eff..52791187329125344a3e3fd8628560a745223e51 100644
--- a/chromeos/compat-wireless/drivers/net/wireless/ath/ath9k/debug.c
+++ b/chromeos/compat-wireless/drivers/net/wireless/ath/ath9k/debug.c
@@ -15,6 +15,7 @@
*/
#include <linux/slab.h>
+#include <linux/vmalloc.h>
#include <asm/unaligned.h>
#include "ath9k.h"
@@ -32,6 +33,19 @@ static int ath9k_debugfs_open(struct inode *inode, struct file *file)
return 0;
}
+static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ u8 *buf = file->private_data;
+ return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
+}
+
+static int ath9k_debugfs_release_buf (struct inode *inode, struct file *file)
+{
+ vfree(file->private_data);
+ return 0;
+}
+
#ifdef CONFIG_ATH_DEBUG
static ssize_t read_file_debug(struct file *file, char __user *user_buf,
@@ -895,7 +909,38 @@ static ssize_t write_file_regval(struct file *file, const char __user *user_buf,
static const struct file_operations fops_regval = {
.read = read_file_regval,
.write = write_file_regval,
- .open = ath9k_debugfs_open,
+};
+
+#define REGDUMP_LINE_SIZE 20
+#define REGDUMP_NUM_REGS (0x16bd4 / 4 + 1)
+#define REGDUMP_DATA_LEN (REGDUMP_NUM_REGS * REGDUMP_LINE_SIZE + 1)
+
+static int open_file_regdump(struct inode *inode, struct file *file)
+{
+ struct ath_softc *sc = inode->i_private;
+ unsigned int len = 0;
+ u8 *buf;
+ int i;
+
+ buf = vmalloc(REGDUMP_DATA_LEN);
+ if (!buf)
+ return -ENOMEM;
+
+ ath9k_ps_wakeup(sc);
+ for (i = 0; i < REGDUMP_NUM_REGS; i++)
+ len += scnprintf(buf + len, REGDUMP_DATA_LEN - len,
+ "0x%06x 0x%08x\n", i << 2, REG_READ(sc->sc_ah, i << 2));
+ ath9k_ps_restore(sc);
+
+ file->private_data = buf;
+
+ return 0;
+}
+
+static const struct file_operations fops_regdump = {
+ .open = open_file_regdump,
+ .read = ath9k_debugfs_read_buf,
+ .release = ath9k_debugfs_release_buf,
.owner = THIS_MODULE
};
@@ -963,6 +1008,14 @@ int ath9k_init_debug(struct ath_hw *ah)
goto err;
sc->debug.regidx = 0;
+
+ if (!debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy,
+ sc, &fops_regdump))
+ goto err;
+
+ if (ath9k_init_pktlog(sc) != 0)
+ goto err;
+
return 0;
err:
ath9k_exit_debug(ah);
@@ -974,6 +1027,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
struct ath_common *common = ath9k_hw_common(ah);
struct ath_softc *sc = (struct ath_softc *) common->priv;
+ ath9k_deinit_pktlog(sc);
+ debugfs_remove(sc->debug.debugfs_regdump);
debugfs_remove_recursive(sc->debug.debugfs_phy);
}

Powered by Google App Engine
This is Rietveld 408576698