linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, rt2400-devel@lists.sourceforge.net
Subject: [PATCH 7/12] rt2x00: Add rt2x00dev->flags to debugfs
Date: Tue, 25 Sep 2007 20:56:13 +0200	[thread overview]
Message-ID: <200709252056.13525.IvDoorn@gmail.com> (raw)
In-Reply-To: <200709252052.34803.IvDoorn@gmail.com>

>From aff2d533a74a6346d704321ff87b8874353ed5fa Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
Date: Tue, 25 Sep 2007 20:13:51 +0200
Subject: [PATCH] rt2x00: Add rt2x00dev->flags to debugfs

Loosely based on the patch by Matthijs Kooijman,
this will add the dev_flags entry into debugfs which
will display rt2x00dev->flags.
This will allow easier debugging of flag handling.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
 drivers/net/wireless/rt2x00/rt2x00debug.c |   37 +++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c
index 4d2aaec..9275d6f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00debug.c
+++ b/drivers/net/wireless/rt2x00/rt2x00debug.c
@@ -57,6 +57,7 @@ struct rt2x00debug_intf {
 	 * - driver folder
 	 * - driver file
 	 * - chipset file
+	 * - device flags file
 	 * - register offset/value files
 	 * - eeprom offset/value files
 	 * - bbp offset/value files
@@ -65,6 +66,7 @@ struct rt2x00debug_intf {
 	struct dentry *driver_folder;
 	struct dentry *driver_entry;
 	struct dentry *chipset_entry;
+	struct dentry *dev_flags;
 	struct dentry *csr_off_entry;
 	struct dentry *csr_val_entry;
 	struct dentry *eeprom_off_entry;
@@ -193,6 +195,34 @@ RT2X00DEBUGFS_OPS(eeprom, "0x%.4x\n", u16);
 RT2X00DEBUGFS_OPS(bbp, "0x%.2x\n", u8);
 RT2X00DEBUGFS_OPS(rf, "0x%.8x\n", u32);
 
+static ssize_t rt2x00debug_read_dev_flags(struct file *file,
+					  char __user *buf,
+					  size_t length,
+					  loff_t *offset)
+{
+	struct rt2x00debug_intf *intf =	file->private_data;
+	char line[16];
+	size_t size;
+
+	if (*offset)
+		return 0;
+
+	size = sprintf(line, "0x%.8x\n", (unsigned int)intf->rt2x00dev->flags);
+
+	if (copy_to_user(buf, line, size))
+		return -EFAULT;
+
+	*offset += size;
+	return size;
+}
+
+static const struct file_operations rt2x00debug_fop_dev_flags = {
+	.owner		= THIS_MODULE,
+	.read		= rt2x00debug_read_dev_flags,
+	.open		= rt2x00debug_file_open,
+	.release	= rt2x00debug_file_release,
+};
+
 static struct dentry *rt2x00debug_create_file_driver(const char *name,
 						     struct rt2x00debug_intf
 						     *intf,
@@ -270,6 +300,12 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
 	if (IS_ERR(intf->chipset_entry))
 		goto exit;
 
+	intf->dev_flags = debugfs_create_file("dev_flags", S_IRUGO,
+					      intf->driver_folder, intf,
+					      &rt2x00debug_fop_dev_flags);
+	if (IS_ERR(intf->dev_flags))
+		goto exit;
+
 #define RT2X00DEBUGFS_CREATE_ENTRY(__intf, __name)		\
 ({								\
 	(__intf)->__name##_off_entry =				\
@@ -320,6 +356,7 @@ void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
 	debugfs_remove(intf->eeprom_off_entry);
 	debugfs_remove(intf->csr_val_entry);
 	debugfs_remove(intf->csr_off_entry);
+	debugfs_remove(intf->dev_flags);
 	debugfs_remove(intf->chipset_entry);
 	debugfs_remove(intf->driver_entry);
 	debugfs_remove(intf->driver_folder);
-- 
1.5.3.2


  parent reply	other threads:[~2007-09-25 18:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-25 18:52 Please pull 'upstream' branch of rt2x00 Ivo van Doorn
2007-09-25 18:53 ` [PATCH 1/12] rt2x00: Correct error in calculating rssi for link tuner Ivo van Doorn
2007-09-25 18:53 ` [PATCH 2/12] rt2x00: Make *_beacon_update static Ivo van Doorn
2007-09-25 18:54 ` [PATCH 3/12] rt2x00: Increase rt2x00usb_vendor_request timeout Ivo van Doorn
2007-09-25 18:54 ` [PATCH 4/12] rt2x00: Correctly identify rt2561turbo Ivo van Doorn
2007-09-25 18:55 ` [PATCH 5/12] rt2x00: adapt to filter configuration API Ivo van Doorn
2007-09-25 18:55 ` [PATCH 6/12] rt2x00: Reorganize rt2x00dev->flags Ivo van Doorn
2007-09-25 18:56 ` Ivo van Doorn [this message]
2007-09-25 18:56 ` [PATCH 8/12] rt2x00: make rt2x00lib_stop_link_tuner() reentrant with link_tuner work Ivo van Doorn
2007-09-25 18:57 ` [PATCH 9/12] rt2x00: Stop link tuning when radio is down Ivo van Doorn
2007-09-25 18:57 ` [PATCH 10/12] rt2x00: Fix obvious typo in comment Ivo van Doorn
2007-09-25 18:57 ` [PATCH 11/12] rt2x00: Fix panic on rmmod with rfkill enabled Ivo van Doorn
2007-09-25 18:58 ` [PATCH 12/12] rt2x00: Release rt2x00 2.0.9 Ivo van Doorn

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=200709252056.13525.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=rt2400-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).