Skip to content

Commit a202fbb

Browse files
andy-shevtorvalds
authored andcommitted
drivers/net/wireless/ath/wil6210: use seq_hex_dump() to dump buffers
Instead of custom approach let's use recently introduced seq_hex_dump() helper. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Joe Perches <joe@perches.com> Cc: Tadeusz Struk <tadeusz.struk@intel.com> Cc: Helge Deller <deller@gmx.de> Cc: Ingo Tuchscherer <ingo.tuchscherer@de.ibm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6fc37c4 commit a202fbb

File tree

1 file changed

+7
-28
lines changed

1 file changed

+7
-28
lines changed

drivers/net/wireless/ath/wil6210/debugfs.c

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ static const struct file_operations fops_vring = {
156156
.llseek = seq_lseek,
157157
};
158158

159+
static void wil_seq_hexdump(struct seq_file *s, void *p, int len,
160+
const char *prefix)
161+
{
162+
seq_hex_dump(s, prefix, DUMP_PREFIX_NONE, 16, 1, p, len, false);
163+
}
164+
159165
static void wil_print_ring(struct seq_file *s, const char *prefix,
160166
void __iomem *off)
161167
{
@@ -212,8 +218,6 @@ static void wil_print_ring(struct seq_file *s, const char *prefix,
212218
le16_to_cpu(hdr.seq), len,
213219
le16_to_cpu(hdr.type), hdr.flags);
214220
if (len <= MAX_MBOXITEM_SIZE) {
215-
int n = 0;
216-
char printbuf[16 * 3 + 2];
217221
unsigned char databuf[MAX_MBOXITEM_SIZE];
218222
void __iomem *src = wmi_buffer(wil, d.addr) +
219223
sizeof(struct wil6210_mbox_hdr);
@@ -223,16 +227,7 @@ static void wil_print_ring(struct seq_file *s, const char *prefix,
223227
* reading header
224228
*/
225229
wil_memcpy_fromio_32(databuf, src, len);
226-
while (n < len) {
227-
int l = min(len - n, 16);
228-
229-
hex_dump_to_buffer(databuf + n, l,
230-
16, 1, printbuf,
231-
sizeof(printbuf),
232-
false);
233-
seq_printf(s, " : %s\n", printbuf);
234-
n += l;
235-
}
230+
wil_seq_hexdump(s, databuf, len, " : ");
236231
}
237232
} else {
238233
seq_puts(s, "\n");
@@ -867,22 +862,6 @@ static const struct file_operations fops_wmi = {
867862
.open = simple_open,
868863
};
869864

870-
static void wil_seq_hexdump(struct seq_file *s, void *p, int len,
871-
const char *prefix)
872-
{
873-
char printbuf[16 * 3 + 2];
874-
int i = 0;
875-
876-
while (i < len) {
877-
int l = min(len - i, 16);
878-
879-
hex_dump_to_buffer(p + i, l, 16, 1, printbuf,
880-
sizeof(printbuf), false);
881-
seq_printf(s, "%s%s\n", prefix, printbuf);
882-
i += l;
883-
}
884-
}
885-
886865
static void wil_seq_print_skb(struct seq_file *s, struct sk_buff *skb)
887866
{
888867
int i = 0;

0 commit comments

Comments
 (0)