From: Rajkumar Manoharan <rmanoharan@atheros.com>
To: <linville@tuxdriver.com>
Cc: <linux-wireless@vger.kernel.org>,
Rajkumar Manoharan <rmanoharan@atheros.com>
Subject: [PATCH 1/2] ath9k_htc: Add debugfs support to change debug mask
Date: Fri, 15 Apr 2011 11:43:52 +0530 [thread overview]
Message-ID: <1302848033-7072-1-git-send-email-rmanoharan@atheros.com> (raw)
Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
---
drivers/net/wireless/ath/ath9k/htc.h | 1 +
drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 48 ++++++++++++++++++++++++
2 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index cc5d0a4..852cdcf 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 8d0de60..3899eaa 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,12 @@ 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,
+ priv->debug.debugfs_phy,
+ priv, &fops_debug);
+ if (!priv->debug.debugfs_debug)
+ goto err;
+
return 0;
err:
@@ -512,6 +559,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);
}
--
1.7.4.4
next reply other threads:[~2011-04-15 6:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-15 6:13 Rajkumar Manoharan [this message]
2011-04-15 6:13 ` [PATCH 2/2] ath9k_htc: Cleanup HTC debugfs Rajkumar Manoharan
2011-04-15 6:40 ` Sujith
2011-04-15 7:06 ` Rajkumar Manoharan
2011-04-15 7:10 ` Johannes Berg
2011-04-15 7:12 ` Sujith
2011-04-15 6:26 ` [PATCH 1/2] ath9k_htc: Add debugfs support to change debug mask Sujith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1302848033-7072-1-git-send-email-rmanoharan@atheros.com \
--to=rmanoharan@atheros.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox