summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti/wl18xx/debugfs.c
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2012-06-07 23:39:22 +0300
committerLuciano Coelho <coelho@ti.com>2012-06-08 09:14:07 +0300
commitf74ea74b82cf6b6aeef1e46d68fbbb02d2bce8b7 (patch)
treec0117cf3704b0ff16d1f853c273efb31af73c021 /drivers/net/wireless/ti/wl18xx/debugfs.c
parent3e8d69352bd9ac7287ab735d45582d79c1f9f2d9 (diff)
wl18xx: add support to clear FW statistics
This patch calls ACX_CLEAR_STATISTICS to clear the firmware statistics. The trigger is a new debugfs file called clear_fw_statistics in the fw_stats directory. Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/ti/wl18xx/debugfs.c')
-rw-r--r--drivers/net/wireless/ti/wl18xx/debugfs.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c b/drivers/net/wireless/ti/wl18xx/debugfs.c
index 93c625b23a2..468651c2f54 100644
--- a/drivers/net/wireless/ti/wl18xx/debugfs.c
+++ b/drivers/net/wireless/ti/wl18xx/debugfs.c
@@ -158,6 +158,34 @@ WL18XX_DEBUGFS_FWSTATS_FILE(mem, tx_free_mem_blks, "%u");
WL18XX_DEBUGFS_FWSTATS_FILE(mem, fwlog_free_mem_blks, "%u");
WL18XX_DEBUGFS_FWSTATS_FILE(mem, fw_gen_free_mem_blks, "%u");
+static ssize_t clear_fw_stats_write(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct wl1271 *wl = file->private_data;
+ int ret;
+
+ mutex_lock(&wl->mutex);
+
+ if (wl->state == WL1271_STATE_OFF)
+ goto out;
+
+ ret = wl18xx_acx_clear_statistics(wl);
+ if (ret < 0) {
+ count = ret;
+ goto out;
+ }
+out:
+ mutex_unlock(&wl->mutex);
+ return count;
+}
+
+static const struct file_operations clear_fw_stats_ops = {
+ .write = clear_fw_stats_write,
+ .open = simple_open,
+ .llseek = default_llseek,
+};
+
int wl18xx_debugfs_add_files(struct wl1271 *wl,
struct dentry *rootdir)
{
@@ -176,6 +204,8 @@ int wl18xx_debugfs_add_files(struct wl1271 *wl,
goto err;
}
+ DEBUGFS_ADD(clear_fw_stats, stats);
+
DEBUGFS_FWSTATS_ADD(debug, debug1);
DEBUGFS_FWSTATS_ADD(debug, debug2);
DEBUGFS_FWSTATS_ADD(debug, debug3);