mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
066cb637b1
commit
643b252123
1 changed files with 37 additions and 0 deletions
|
@ -57,6 +57,7 @@ struct rt2x00debug_intf {
|
||||||
* - driver folder
|
* - driver folder
|
||||||
* - driver file
|
* - driver file
|
||||||
* - chipset file
|
* - chipset file
|
||||||
|
* - device flags file
|
||||||
* - register offset/value files
|
* - register offset/value files
|
||||||
* - eeprom offset/value files
|
* - eeprom offset/value files
|
||||||
* - bbp offset/value files
|
* - bbp offset/value files
|
||||||
|
@ -65,6 +66,7 @@ struct rt2x00debug_intf {
|
||||||
struct dentry *driver_folder;
|
struct dentry *driver_folder;
|
||||||
struct dentry *driver_entry;
|
struct dentry *driver_entry;
|
||||||
struct dentry *chipset_entry;
|
struct dentry *chipset_entry;
|
||||||
|
struct dentry *dev_flags;
|
||||||
struct dentry *csr_off_entry;
|
struct dentry *csr_off_entry;
|
||||||
struct dentry *csr_val_entry;
|
struct dentry *csr_val_entry;
|
||||||
struct dentry *eeprom_off_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(bbp, "0x%.2x\n", u8);
|
||||||
RT2X00DEBUGFS_OPS(rf, "0x%.8x\n", u32);
|
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,
|
static struct dentry *rt2x00debug_create_file_driver(const char *name,
|
||||||
struct rt2x00debug_intf
|
struct rt2x00debug_intf
|
||||||
*intf,
|
*intf,
|
||||||
|
@ -270,6 +300,12 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
|
||||||
if (IS_ERR(intf->chipset_entry))
|
if (IS_ERR(intf->chipset_entry))
|
||||||
goto exit;
|
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) \
|
#define RT2X00DEBUGFS_CREATE_ENTRY(__intf, __name) \
|
||||||
({ \
|
({ \
|
||||||
(__intf)->__name##_off_entry = \
|
(__intf)->__name##_off_entry = \
|
||||||
|
@ -320,6 +356,7 @@ void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
|
||||||
debugfs_remove(intf->eeprom_off_entry);
|
debugfs_remove(intf->eeprom_off_entry);
|
||||||
debugfs_remove(intf->csr_val_entry);
|
debugfs_remove(intf->csr_val_entry);
|
||||||
debugfs_remove(intf->csr_off_entry);
|
debugfs_remove(intf->csr_off_entry);
|
||||||
|
debugfs_remove(intf->dev_flags);
|
||||||
debugfs_remove(intf->chipset_entry);
|
debugfs_remove(intf->chipset_entry);
|
||||||
debugfs_remove(intf->driver_entry);
|
debugfs_remove(intf->driver_entry);
|
||||||
debugfs_remove(intf->driver_folder);
|
debugfs_remove(intf->driver_folder);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue