]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
iwlegacy: convert hex_dump_to_buffer() to %*ph
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 16 Jul 2015 12:42:15 +0000 (15:42 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 21 Jul 2015 15:08:21 +0000 (18:08 +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 the 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: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/iwlegacy/3945-mac.c
drivers/net/wireless/iwlegacy/debug.c

index 7f4cb692cc57e97de9b6bd78ea717df97d03221f..af1b3e6839fa6db3e69e90bee7a50923f1d0230e 100644 (file)
@@ -3259,7 +3259,7 @@ il3945_show_measurement(struct device *d, struct device_attribute *attr,
 
        while (size && PAGE_SIZE - len) {
                hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len,
-                                  PAGE_SIZE - len, 1);
+                                  PAGE_SIZE - len, true);
                len = strlen(buf);
                if (PAGE_SIZE - len)
                        buf[len++] = '\n';
index 34401015319631bb21afda0f48f283f13f6a2343..908b9f4fef6f3b4e3522b8f2c5a03166ca0cf2b8 100644 (file)
@@ -515,12 +515,8 @@ il_dbgfs_nvm_read(struct file *file, char __user *user_buf, size_t count,
            scnprintf(buf + pos, buf_size - pos, "EEPROM " "version: 0x%x\n",
                      eeprom_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);