diff options
author | Ivo van Doorn <IvDoorn@gmail.com> | 2007-09-25 14:13:51 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:53:04 -0400 |
commit | 643b252123fab1a524449be3b79937f17e06a5ac (patch) | |
tree | 21ecae78aa9e3eba28e9490bce858fa93820f3cc /drivers/net/wireless/rt2x00/rt2x00debug.c | |
parent | 066cb637b1b562bebd09d237bfaaca6724f247e5 (diff) |
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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00debug.c')
-rw-r--r-- | 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 4d2aaecd9dfe..9275d6f9517e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c | |||
@@ -57,6 +57,7 @@ struct rt2x00debug_intf { | |||
57 | * - driver folder | 57 | * - driver folder |
58 | * - driver file | 58 | * - driver file |
59 | * - chipset file | 59 | * - chipset file |
60 | * - device flags file | ||
60 | * - register offset/value files | 61 | * - register offset/value files |
61 | * - eeprom offset/value files | 62 | * - eeprom offset/value files |
62 | * - bbp offset/value files | 63 | * - bbp offset/value files |
@@ -65,6 +66,7 @@ struct rt2x00debug_intf { | |||
65 | struct dentry *driver_folder; | 66 | struct dentry *driver_folder; |
66 | struct dentry *driver_entry; | 67 | struct dentry *driver_entry; |
67 | struct dentry *chipset_entry; | 68 | struct dentry *chipset_entry; |
69 | struct dentry *dev_flags; | ||
68 | struct dentry *csr_off_entry; | 70 | struct dentry *csr_off_entry; |
69 | struct dentry *csr_val_entry; | 71 | struct dentry *csr_val_entry; |
70 | struct dentry *eeprom_off_entry; | 72 | struct dentry *eeprom_off_entry; |
@@ -193,6 +195,34 @@ RT2X00DEBUGFS_OPS(eeprom, "0x%.4x\n", u16); | |||
193 | RT2X00DEBUGFS_OPS(bbp, "0x%.2x\n", u8); | 195 | RT2X00DEBUGFS_OPS(bbp, "0x%.2x\n", u8); |
194 | RT2X00DEBUGFS_OPS(rf, "0x%.8x\n", u32); | 196 | RT2X00DEBUGFS_OPS(rf, "0x%.8x\n", u32); |
195 | 197 | ||
198 | static ssize_t rt2x00debug_read_dev_flags(struct file *file, | ||
199 | char __user *buf, | ||
200 | size_t length, | ||
201 | loff_t *offset) | ||
202 | { | ||
203 | struct rt2x00debug_intf *intf = file->private_data; | ||
204 | char line[16]; | ||
205 | size_t size; | ||
206 | |||
207 | if (*offset) | ||
208 | return 0; | ||
209 | |||
210 | size = sprintf(line, "0x%.8x\n", (unsigned int)intf->rt2x00dev->flags); | ||
211 | |||
212 | if (copy_to_user(buf, line, size)) | ||
213 | return -EFAULT; | ||
214 | |||
215 | *offset += size; | ||
216 | return size; | ||
217 | } | ||
218 | |||
219 | static const struct file_operations rt2x00debug_fop_dev_flags = { | ||
220 | .owner = THIS_MODULE, | ||
221 | .read = rt2x00debug_read_dev_flags, | ||
222 | .open = rt2x00debug_file_open, | ||
223 | .release = rt2x00debug_file_release, | ||
224 | }; | ||
225 | |||
196 | static struct dentry *rt2x00debug_create_file_driver(const char *name, | 226 | static struct dentry *rt2x00debug_create_file_driver(const char *name, |
197 | struct rt2x00debug_intf | 227 | struct rt2x00debug_intf |
198 | *intf, | 228 | *intf, |
@@ -270,6 +300,12 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
270 | if (IS_ERR(intf->chipset_entry)) | 300 | if (IS_ERR(intf->chipset_entry)) |
271 | goto exit; | 301 | goto exit; |
272 | 302 | ||
303 | intf->dev_flags = debugfs_create_file("dev_flags", S_IRUGO, | ||
304 | intf->driver_folder, intf, | ||
305 | &rt2x00debug_fop_dev_flags); | ||
306 | if (IS_ERR(intf->dev_flags)) | ||
307 | goto exit; | ||
308 | |||
273 | #define RT2X00DEBUGFS_CREATE_ENTRY(__intf, __name) \ | 309 | #define RT2X00DEBUGFS_CREATE_ENTRY(__intf, __name) \ |
274 | ({ \ | 310 | ({ \ |
275 | (__intf)->__name##_off_entry = \ | 311 | (__intf)->__name##_off_entry = \ |
@@ -320,6 +356,7 @@ void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev) | |||
320 | debugfs_remove(intf->eeprom_off_entry); | 356 | debugfs_remove(intf->eeprom_off_entry); |
321 | debugfs_remove(intf->csr_val_entry); | 357 | debugfs_remove(intf->csr_val_entry); |
322 | debugfs_remove(intf->csr_off_entry); | 358 | debugfs_remove(intf->csr_off_entry); |
359 | debugfs_remove(intf->dev_flags); | ||
323 | debugfs_remove(intf->chipset_entry); | 360 | debugfs_remove(intf->chipset_entry); |
324 | debugfs_remove(intf->driver_entry); | 361 | debugfs_remove(intf->driver_entry); |
325 | debugfs_remove(intf->driver_folder); | 362 | debugfs_remove(intf->driver_folder); |