summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajkumar Manoharan <rmanoharan@atheros.com>2011-04-15 12:28:52 +0530
committerJohn W. Linville <linville@tuxdriver.com>2011-04-19 15:38:03 -0400
commit00bca7e2f2b58b93ce408e92d18a8c42bbe8d6e5 (patch)
tree709094fd9d9b43e6228358a775598bb2da5c7071
parent2290a9c35df271cc33601b69e7836fa288e2fc7d (diff)
ath9k_htc: Add debugfs support to change debug mask
Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com> Acked-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_debug.c49
2 files changed, 50 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index cc5d0a4b9da2..852cdcfbcbb6 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -366,6 +366,7 @@ struct ath9k_debug {
struct dentry *debugfs_recv;
struct dentry *debugfs_slot;
struct dentry *debugfs_queue;
+ struct dentry *debugfs_debug;
struct ath_tx_stats tx_stats;
struct ath_rx_stats rx_stats;
};
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index 8d0de60e0c27..7394a1b9882a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -435,6 +435,47 @@ static const struct file_operations fops_queue = {
.llseek = default_llseek,
};
+static ssize_t read_file_debug(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ struct ath_common *common = ath9k_hw_common(priv->ah);
+ char buf[32];
+ unsigned int len;
+
+ len = sprintf(buf, "0x%08x\n", common->debug_mask);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ struct ath_common *common = ath9k_hw_common(priv->ah);
+ unsigned long mask;
+ char buf[32];
+ ssize_t len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+
+ buf[len] = '\0';
+ if (strict_strtoul(buf, 0, &mask))
+ return -EINVAL;
+
+ common->debug_mask = mask;
+ return count;
+}
+
+static const struct file_operations fops_debug = {
+ .read = read_file_debug,
+ .write = write_file_debug,
+ .open = ath9k_debugfs_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
int ath9k_htc_init_debug(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
@@ -493,6 +534,13 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
if (!priv->debug.debugfs_queue)
goto err;
+ priv->debug.debugfs_debug = debugfs_create_file("debug",
+ S_IRUSR | S_IWUSR,
+ priv->debug.debugfs_phy,
+ priv, &fops_debug);
+ if (!priv->debug.debugfs_debug)
+ goto err;
+
return 0;
err:
@@ -512,6 +560,7 @@ void ath9k_htc_exit_debug(struct ath_hw *ah)
debugfs_remove(priv->debug.debugfs_tgt_int_stats);
debugfs_remove(priv->debug.debugfs_tgt_tx_stats);
debugfs_remove(priv->debug.debugfs_tgt_rx_stats);
+ debugfs_remove(priv->debug.debugfs_debug);
debugfs_remove(priv->debug.debugfs_phy);
}