@@ -156,6 +156,12 @@ static const struct file_operations fops_vring = {
156
156
.llseek = seq_lseek ,
157
157
};
158
158
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
+
159
165
static void wil_print_ring (struct seq_file * s , const char * prefix ,
160
166
void __iomem * off )
161
167
{
@@ -212,8 +218,6 @@ static void wil_print_ring(struct seq_file *s, const char *prefix,
212
218
le16_to_cpu (hdr .seq ), len ,
213
219
le16_to_cpu (hdr .type ), hdr .flags );
214
220
if (len <= MAX_MBOXITEM_SIZE ) {
215
- int n = 0 ;
216
- char printbuf [16 * 3 + 2 ];
217
221
unsigned char databuf [MAX_MBOXITEM_SIZE ];
218
222
void __iomem * src = wmi_buffer (wil , d .addr ) +
219
223
sizeof (struct wil6210_mbox_hdr );
@@ -223,16 +227,7 @@ static void wil_print_ring(struct seq_file *s, const char *prefix,
223
227
* reading header
224
228
*/
225
229
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 , " : " );
236
231
}
237
232
} else {
238
233
seq_puts (s , "\n" );
@@ -867,22 +862,6 @@ static const struct file_operations fops_wmi = {
867
862
.open = simple_open ,
868
863
};
869
864
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
-
886
865
static void wil_seq_print_skb (struct seq_file * s , struct sk_buff * skb )
887
866
{
888
867
int i = 0 ;
0 commit comments