From: Jeff Hansen <x@jeffhansen.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH 3/4] ath9k: Add "debug" file to debugfs
Date: Wed, 27 May 2009 05:05:14 +0000 [thread overview]
Message-ID: <1243400715-13561-3-git-send-email-x@jeffhansen.com> (raw)
In-Reply-To: <1243400715-13561-1-git-send-email-x@jeffhansen.com>
This patch adds the debug file to the ath9k debugfs, which lets you modify
the debug_mask at runtime, without having to reload the ath9k module.
Signed-off-by: Jeff Hansen <x@jeffhansen.com>
---
drivers/net/wireless/ath/ath9k/debug.c | 38 ++++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath9k/debug.h | 1 +
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index d50821c..e2ff4a2 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -45,6 +45,38 @@ static int ath9k_debugfs_open(struct inode *inode, struct file *file)
return 0;
}
+static ssize_t read_file_debug(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ char buf[32];
+ unsigned int len = 0;
+ len += snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.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 ath_softc *sc = file->private_data;
+ unsigned long mask;
+ char buf[32];
+ if (copy_from_user(buf, user_buf, (sizeof(buf) - 1) < count ?
+ (sizeof(buf) - 1) : count))
+ return 0;
+ buf[sizeof(buf)-1] = 0;
+ if (strict_strtoul(buf, 0, &mask) == 0)
+ sc->debug.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
+};
+
static ssize_t read_file_dma(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
@@ -462,6 +494,11 @@ int ath9k_init_debug(struct ath_softc *sc)
if (!sc->debug.debugfs_phy)
goto err;
+ sc->debug.debugfs_debug = debugfs_create_file("debug",
+ S_IRUGO | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_debug);
+ if (!sc->debug.debugfs_debug)
+ goto err;
+
sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUGO,
sc->debug.debugfs_phy, sc, &fops_dma);
if (!sc->debug.debugfs_dma)
@@ -499,6 +536,7 @@ void ath9k_exit_debug(struct ath_softc *sc)
debugfs_remove(sc->debug.debugfs_rcstat);
debugfs_remove(sc->debug.debugfs_interrupt);
debugfs_remove(sc->debug.debugfs_dma);
+ debugfs_remove(sc->debug.debugfs_debug);
debugfs_remove(sc->debug.debugfs_phy);
}
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index cf9146a..edda15b 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -95,6 +95,7 @@ struct ath_stats {
struct ath9k_debug {
int debug_mask;
struct dentry *debugfs_phy;
+ struct dentry *debugfs_debug;
struct dentry *debugfs_dma;
struct dentry *debugfs_interrupt;
struct dentry *debugfs_rcstat;
--
1.6.0.4
WARNING: multiple messages have this Message-ID (diff)
From: Jeff Hansen <x@jeffhansen.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: "Luis R. Rodriguez" <lrodriguez@atheros.com>,
Jouni Malinen <jouni.malinen@atheros.com>,
ath9k-devel@lists.ath9k.org, Jeff Hansen <x@jeffhansen.com>
Subject: [PATCH 3/4] ath9k: Add "debug" file to debugfs
Date: Wed, 27 May 2009 05:05:14 +0000 [thread overview]
Message-ID: <1243400715-13561-3-git-send-email-x@jeffhansen.com> (raw)
In-Reply-To: <1243400715-13561-1-git-send-email-x@jeffhansen.com>
This patch adds the debug file to the ath9k debugfs, which lets you modify
the debug_mask at runtime, without having to reload the ath9k module.
Signed-off-by: Jeff Hansen <x@jeffhansen.com>
---
drivers/net/wireless/ath/ath9k/debug.c | 38 ++++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath9k/debug.h | 1 +
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index d50821c..e2ff4a2 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -45,6 +45,38 @@ static int ath9k_debugfs_open(struct inode *inode, struct file *file)
return 0;
}
+static ssize_t read_file_debug(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ char buf[32];
+ unsigned int len = 0;
+ len += snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.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 ath_softc *sc = file->private_data;
+ unsigned long mask;
+ char buf[32];
+ if (copy_from_user(buf, user_buf, (sizeof(buf) - 1) < count ?
+ (sizeof(buf) - 1) : count))
+ return 0;
+ buf[sizeof(buf)-1] = 0;
+ if (strict_strtoul(buf, 0, &mask) == 0)
+ sc->debug.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
+};
+
static ssize_t read_file_dma(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
@@ -462,6 +494,11 @@ int ath9k_init_debug(struct ath_softc *sc)
if (!sc->debug.debugfs_phy)
goto err;
+ sc->debug.debugfs_debug = debugfs_create_file("debug",
+ S_IRUGO | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_debug);
+ if (!sc->debug.debugfs_debug)
+ goto err;
+
sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUGO,
sc->debug.debugfs_phy, sc, &fops_dma);
if (!sc->debug.debugfs_dma)
@@ -499,6 +536,7 @@ void ath9k_exit_debug(struct ath_softc *sc)
debugfs_remove(sc->debug.debugfs_rcstat);
debugfs_remove(sc->debug.debugfs_interrupt);
debugfs_remove(sc->debug.debugfs_dma);
+ debugfs_remove(sc->debug.debugfs_debug);
debugfs_remove(sc->debug.debugfs_phy);
}
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index cf9146a..edda15b 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -95,6 +95,7 @@ struct ath_stats {
struct ath9k_debug {
int debug_mask;
struct dentry *debugfs_phy;
+ struct dentry *debugfs_debug;
struct dentry *debugfs_dma;
struct dentry *debugfs_interrupt;
struct dentry *debugfs_rcstat;
--
1.6.0.4
next prev parent reply other threads:[~2009-05-27 5:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 5:05 [ath9k-devel] [PATCH 1/4] ath9k: Reset SC_OP_TSF_RESET flag after stuck beacon Jeff Hansen
2009-05-27 5:05 ` Jeff Hansen
2009-05-27 5:05 ` [ath9k-devel] [PATCH 2/4] ath9k: Combine legacy and 11n rc statistics Jeff Hansen
2009-05-27 5:05 ` Jeff Hansen
2009-05-27 8:51 ` [ath9k-devel] " Vasanthakumar Thiagarajan
2009-05-27 9:02 ` Vasanthakumar Thiagarajan
2009-05-27 9:02 ` Vasanthakumar Thiagarajan
2009-05-27 5:05 ` Jeff Hansen [this message]
2009-05-27 5:05 ` [PATCH 3/4] ath9k: Add "debug" file to debugfs Jeff Hansen
2009-05-27 5:05 ` [ath9k-devel] [PATCH 4/4] mac80211: Fix typos in "set default QoS values according to spec" Jeff Hansen
2009-05-27 5:05 ` Jeff Hansen
2009-05-27 5:12 ` [ath9k-devel] " Jouni Malinen
2009-05-27 5:12 ` Jouni Malinen
-- strict thread matches above, loose matches on Subject: below --
2009-05-27 12:48 [ath9k-devel] [PATCH 1/4] ath9k: Reset SC_OP_TSF_RESET flag after stuck beacon Jeff Hansen
2009-05-27 12:48 ` [ath9k-devel] [PATCH 3/4] ath9k: Add "debug" file to debugfs Jeff Hansen
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=1243400715-13561-3-git-send-email-x@jeffhansen.com \
--to=x@jeffhansen.com \
--cc=ath9k-devel@lists.ath9k.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.