iwlwifi: convert hex_dump_to_buffer() to %*ph
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 16 Jul 2015 12:42:14 +0000 (15:42 +0300)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 16 Aug 2015 07:22:10 +0000 (10:22 +0300)
There is no need to use hex_dump_to_buffer() in the cases like this:

hexdump_to_buffer(buf, len, 16, 1, outbuf, outlen, false); /* len <= 16 */
sprintf("%s\n", outbuf);

since it maybe easily converted to simple:

sprintf("%*ph\n", len, buf);

Note: it seems in one case the output is groupped by 2 bytes and looks like a
typo. Thus, patch changes that to plain byte stream.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/dvm/debugfs.c
drivers/net/wireless/iwlwifi/mvm/debugfs.c

index 0ffb6ff1a255f8ac609ba3799c02489ab853eea1..b15e44f8d1bd7858939cd4379374dfd2aa37cd9c 100644 (file)
@@ -310,12 +310,8 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
        pos += scnprintf(buf + pos, buf_size - pos,
                         "NVM version: 0x%x\n", nvm_ver);
        for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
-               pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
-               hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos,
-                                  buf_size - pos, 0);
-               pos += strlen(buf + pos);
-               if (buf_size - pos > 0)
-                       buf[pos++] = '\n';
+               pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x %16ph\n",
+                                ofs, ptr + ofs);
        }
 
        ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
index 17d7a05006fa287058401b4f03a1dd23a4c18977..ca4a1f8f82a5d6456a5729f3f960d1c838dc75f2 100644 (file)
@@ -1200,12 +1200,7 @@ static ssize_t iwl_dbgfs_d3_sram_read(struct file *file, char __user *user_buf,
        if (ptr) {
                for (ofs = 0; ofs < len; ofs += 16) {
                        pos += scnprintf(buf + pos, bufsz - pos,
-                                        "0x%.4x ", ofs);
-                       hex_dump_to_buffer(ptr + ofs, 16, 16, 1, buf + pos,
-                                          bufsz - pos, false);
-                       pos += strlen(buf + pos);
-                       if (bufsz - pos > 0)
-                               buf[pos++] = '\n';
+                                        "0x%.4x %16ph\n", ofs, ptr + ofs);
                }
        } else {
                pos += scnprintf(buf + pos, bufsz - pos,