提交 91921a4e 编写于 作者: I Ivo van Doorn 提交者: David S. Miller

rt2x00: Move register value/offset files into new folder

Cleanup debugfs interface by moving the csr/bbp/rf/eeprom value/offset
entries into the "register" folder.
Signed-off-by: NIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 49da2605
......@@ -50,18 +50,20 @@ struct rt2x00debug_intf {
/*
* Debugfs entries for:
* - driver folder
* - driver file
* - chipset file
* - device flags file
* - register offset/value files
* - eeprom offset/value files
* - bbp offset/value files
* - rf offset/value files
* - driver file
* - chipset file
* - device flags file
* - register folder
* - csr offset/value files
* - eeprom offset/value files
* - bbp offset/value files
* - rf offset/value files
*/
struct dentry *driver_folder;
struct dentry *driver_entry;
struct dentry *chipset_entry;
struct dentry *dev_flags;
struct dentry *register_folder;
struct dentry *csr_off_entry;
struct dentry *csr_val_entry;
struct dentry *eeprom_off_entry;
......@@ -115,7 +117,7 @@ static ssize_t rt2x00debug_read_##__name(struct file *file, \
size_t length, \
loff_t *offset) \
{ \
struct rt2x00debug_intf *intf = file->private_data; \
struct rt2x00debug_intf *intf = file->private_data; \
const struct rt2x00debug *debug = intf->debug; \
char line[16]; \
size_t size; \
......@@ -145,7 +147,7 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \
size_t length, \
loff_t *offset) \
{ \
struct rt2x00debug_intf *intf = file->private_data; \
struct rt2x00debug_intf *intf = file->private_data; \
const struct rt2x00debug *debug = intf->debug; \
char line[16]; \
size_t size; \
......@@ -301,12 +303,17 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
if (IS_ERR(intf->dev_flags))
goto exit;
#define RT2X00DEBUGFS_CREATE_ENTRY(__intf, __name) \
intf->register_folder =
debugfs_create_dir("register", intf->driver_folder);
if (IS_ERR(intf->register_folder))
goto exit;
#define RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(__intf, __name) \
({ \
(__intf)->__name##_off_entry = \
debugfs_create_u32(__stringify(__name) "_offset", \
S_IRUGO | S_IWUSR, \
(__intf)->driver_folder, \
(__intf)->register_folder, \
&(__intf)->offset_##__name); \
if (IS_ERR((__intf)->__name##_off_entry)) \
goto exit; \
......@@ -314,18 +321,18 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
(__intf)->__name##_val_entry = \
debugfs_create_file(__stringify(__name) "_value", \
S_IRUGO | S_IWUSR, \
(__intf)->driver_folder, \
(__intf)->register_folder, \
(__intf), &rt2x00debug_fop_##__name);\
if (IS_ERR((__intf)->__name##_val_entry)) \
goto exit; \
})
RT2X00DEBUGFS_CREATE_ENTRY(intf, csr);
RT2X00DEBUGFS_CREATE_ENTRY(intf, eeprom);
RT2X00DEBUGFS_CREATE_ENTRY(intf, bbp);
RT2X00DEBUGFS_CREATE_ENTRY(intf, rf);
RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, csr);
RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, eeprom);
RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, bbp);
RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, rf);
#undef RT2X00DEBUGFS_CREATE_ENTRY
#undef RT2X00DEBUGFS_CREATE_REGISTER_ENTRY
return;
......@@ -351,6 +358,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->register_folder);
debugfs_remove(intf->dev_flags);
debugfs_remove(intf->chipset_entry);
debugfs_remove(intf->driver_entry);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册