media/pci/cobalt: Use %*ph to print small buffers
Subsystems (2)
PATCH 1/1 media/pci/cobalt: Use %*ph to print small buffers
printk() supports %*ph format specifier for printing a small buffers, let's use it intead of %02x %02x...
--- drivers/media/pci/cobalt/cobalt-cpld.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/media/pci/cobalt/cobalt-cpld.c +3 -5
@@ -290,8 +290,8 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)0x01, 0xc7, 0xfc, 0x7f, 0x53, 0x62). */ -cobalt_dbg (1 ,"%u: %02x %02x %02x %02x %02x %02x\n" , f_out, - regs[0 ], regs[1 ], regs[2 ], regs[3 ], regs[4 ], regs[5 ]); +cobalt_dbg (1 ,"%u: %6ph\n" , f_out, regs); +while (retries--) {u8 read_regs[6 ];
@@ -330,9 +330,7 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)if (!memcmp (read_regs, regs,sizeof (read_regs)))break ; -cobalt_dbg (1 ,"retry: %02x %02x %02x %02x %02x %02x\n" , - read_regs[0 ], read_regs[1 ], read_regs[2 ], - read_regs[3 ], read_regs[4 ], read_regs[5 ]); +cobalt_dbg (1 ,"retry: %6ph\n" ); }if (2 - retries)cobalt_info ("Needed %d retries\n" ,2 - retries);
Signature · 1 line
2.5.0
Quoted 2 lines · Alexander Kuleshov
printk()supports %*ph format specifier for printing a small buffers, let's use it intead of %02x %02x...
Having just suffered this myself...
drivers/media/pci/cobalt/cobalt-cpld.c
Quoted 1 line
drivers/media/pci/cobalt/cobalt-cpld.c +0
-0
[]
drivers/media/pci/cobalt/cobalt-cpld.c bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out) · line 333
Quoted 8 lines
drivers/media/pci/cobalt/cobalt-cpld.c +1
-3@@ -330,9 +330,7 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)if (!memcmp (read_regs, regs,sizeof (read_regs)))break ; -cobalt_dbg (1 ,"retry: %02x %02x %02x %02x %02x %02x\n" , - read_regs[0 ], read_regs[1 ], read_regs[2 ], - read_regs[3 ], read_regs[4 ], read_regs[5 ]); +cobalt_dbg (1 ,"retry: %6ph\n" );
Aren't you missing something like compile testing?
Oh, nope, resent
2015-08-27 0:56 GMT+06:00 Joe Perches <[email protected]>:
Quoted 20 lines · Alexander Kuleshov
Quoted 2 lines
printk()supports %*ph format specifier for printing a small buffers, let's use it intead of %02x %02x...Having just suffered this myself...
drivers/media/pci/cobalt/cobalt-cpld.c
Quoted 1 line
drivers/media/pci/cobalt/cobalt-cpld.c +0
-0[]
drivers/media/pci/cobalt/cobalt-cpld.c bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out) · line 333
Quoted 8 lines
drivers/media/pci/cobalt/cobalt-cpld.c +1
-3@@ -330,9 +330,7 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)if (!memcmp (read_regs, regs,sizeof (read_regs)))break ; -cobalt_dbg (1 ,"retry: %02x %02x %02x %02x %02x %02x\n" , - read_regs[0 ], read_regs[1 ], read_regs[2 ], - read_regs[3 ], read_regs[4 ], read_regs[5 ]); +cobalt_dbg (1 ,"retry: %6ph\n" );Aren't you missing something like compile testing?