Commit f2efd20f authored by Anisse Astier's avatar Anisse Astier Committed by John W. Linville

rt2x00: debugfs support - allow a register to be empty

Allow a register to be unspecified, therefore not creating its debugfs
file entry.
Signed-off-by: default avatarAnisse Astier <anisse@astier.eu>
Acked-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 7ed85b65
...@@ -624,22 +624,21 @@ static struct dentry *rt2x00debug_create_file_chipset(const char *name, ...@@ -624,22 +624,21 @@ static struct dentry *rt2x00debug_create_file_chipset(const char *name,
data += sprintf(data, "revision:\t%04x\n", intf->rt2x00dev->chip.rev); data += sprintf(data, "revision:\t%04x\n", intf->rt2x00dev->chip.rev);
data += sprintf(data, "\n"); data += sprintf(data, "\n");
data += sprintf(data, "register\tbase\twords\twordsize\n"); data += sprintf(data, "register\tbase\twords\twordsize\n");
data += sprintf(data, "csr\t%d\t%d\t%d\n", #define RT2X00DEBUGFS_SPRINTF_REGISTER(__name) \
debug->csr.word_base, { \
debug->csr.word_count, if(debug->__name.read) \
debug->csr.word_size); data += sprintf(data, __stringify(__name) \
data += sprintf(data, "eeprom\t%d\t%d\t%d\n", "\t%d\t%d\t%d\n", \
debug->eeprom.word_base, debug->__name.word_base, \
debug->eeprom.word_count, debug->__name.word_count, \
debug->eeprom.word_size); debug->__name.word_size); \
data += sprintf(data, "bbp\t%d\t%d\t%d\n", }
debug->bbp.word_base, RT2X00DEBUGFS_SPRINTF_REGISTER(csr);
debug->bbp.word_count, RT2X00DEBUGFS_SPRINTF_REGISTER(eeprom);
debug->bbp.word_size); RT2X00DEBUGFS_SPRINTF_REGISTER(bbp);
data += sprintf(data, "rf\t%d\t%d\t%d\n", RT2X00DEBUGFS_SPRINTF_REGISTER(rf);
debug->rf.word_base, #undef RT2X00DEBUGFS_SPRINTF_REGISTER
debug->rf.word_count,
debug->rf.word_size);
blob->size = strlen(blob->data); blob->size = strlen(blob->data);
return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob); return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob);
...@@ -694,25 +693,27 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) ...@@ -694,25 +693,27 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
if (IS_ERR(intf->register_folder) || !intf->register_folder) if (IS_ERR(intf->register_folder) || !intf->register_folder)
goto exit; goto exit;
#define RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(__intf, __name) \ #define RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(__intf, __name) \
({ \ ({ \
(__intf)->__name##_off_entry = \ if(debug->__name.read) { \
debugfs_create_u32(__stringify(__name) "_offset", \ (__intf)->__name##_off_entry = \
S_IRUSR | S_IWUSR, \ debugfs_create_u32(__stringify(__name) "_offset", \
(__intf)->register_folder, \ S_IRUSR | S_IWUSR, \
&(__intf)->offset_##__name); \ (__intf)->register_folder, \
if (IS_ERR((__intf)->__name##_off_entry) \ &(__intf)->offset_##__name); \
|| !(__intf)->__name##_off_entry) \ if (IS_ERR((__intf)->__name##_off_entry) \
goto exit; \ || !(__intf)->__name##_off_entry) \
\ goto exit; \
(__intf)->__name##_val_entry = \ \
debugfs_create_file(__stringify(__name) "_value", \ (__intf)->__name##_val_entry = \
S_IRUSR | S_IWUSR, \ debugfs_create_file(__stringify(__name) "_value", \
(__intf)->register_folder, \ S_IRUSR | S_IWUSR, \
(__intf), &rt2x00debug_fop_##__name);\ (__intf)->register_folder, \
if (IS_ERR((__intf)->__name##_val_entry) \ (__intf), &rt2x00debug_fop_##__name); \
|| !(__intf)->__name##_val_entry) \ if (IS_ERR((__intf)->__name##_val_entry) \
goto exit; \ || !(__intf)->__name##_val_entry) \
goto exit; \
} \
}) })
RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, csr); RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, csr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment