diff options
author | Bjørn Mork <bjorn@mork.no> | 2015-10-29 14:15:39 +0100 |
---|---|---|
committer | Bjørn Mork <bjorn@mork.no> | 2015-11-01 00:15:04 +0100 |
commit | e5d5f7f7400d87ef2d3aee99ecbbfb82c7164d40 (patch) | |
tree | 32e27d355363bdb82a6155188e2e5fef71e63937 | |
parent | 4ce4a792fbc5848821ce2f0a49b490ea5821751e (diff) |
mwlwifi: use hex_dump_to_buffer()
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rw-r--r-- | debugfs.c | 23 |
1 files changed, 6 insertions, 17 deletions
@@ -50,27 +50,16 @@ static const struct file_operations mwl_debugfs_##name##_fops = { \ static int dump_data(char *p, u8 *data, int len, char *title) { - char *str = p; + char *str = p, *end = (char *)PAGE_ALIGN((unsigned long)p); int cur_byte = 0; - int i; str += sprintf(str, "%s\n", title); - for (cur_byte = 0; cur_byte < len; cur_byte += 8) { - if ((cur_byte + 8) < len) { - for (i = 0; i < 8; i++) - str += sprintf(str, "0x%02x ", - *(data+cur_byte+i)); - str += sprintf(str, "\n"); - } else { - for (i = 0; i < (len - cur_byte); i++) - str += sprintf(str, "0x%02x ", - *(data+cur_byte+i)); - str += sprintf(str, "\n"); - break; - } + for (cur_byte = 0; cur_byte < len; cur_byte += 16) { + hex_dump_to_buffer(data + cur_byte, len - cur_byte, 16, 1, str, end - str, false); + str += strlen(str); + str += sprintf(str, "\n"); } - - return str-p; + return str - p; } static ssize_t mwl_debugfs_info_read(struct file *file, char __user *ubuf, |