Search Linux Wireless

RE: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in hex_dump_to_buffer with flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Petr Mladek <pmladek@xxxxxxxx>
> Sent: Saturday, 13 April 2019 12:12 AM
> To: Alastair D'Silva <alastair@xxxxxxxxxxx>
> Cc: alastair@xxxxxxxxxxx; Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>;
Joonas
> Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>; Rodrigo Vivi
> <rodrigo.vivi@xxxxxxxxx>; David Airlie <airlied@xxxxxxxx>; Daniel Vetter
> <daniel@xxxxxxxx>; Karsten Keil <isdn@xxxxxxxxxxxxxx>; Jassi Brar
> <jassisinghbrar@xxxxxxxxx>; Tom Lendacky <thomas.lendacky@xxxxxxx>;
> David S. Miller <davem@xxxxxxxxxxxxx>; Jose Abreu
> <Jose.Abreu@xxxxxxxxxxxx>; Kalle Valo <kvalo@xxxxxxxxxxxxxx>;
> Stanislaw Gruszka <sgruszka@xxxxxxxxxx>; Benson Leung
> <bleung@xxxxxxxxxxxx>; Enric Balletbo i Serra
> <enric.balletbo@xxxxxxxxxxxxx>; James E.J. Bottomley
> <jejb@xxxxxxxxxxxxx>; Martin K. Petersen <martin.petersen@xxxxxxxxxx>;
> Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; Alexander Viro
> <viro@xxxxxxxxxxxxxxxxxx>; Sergey Senozhatsky
> <sergey.senozhatsky@xxxxxxxxx>; Steven Rostedt <rostedt@xxxxxxxxxxx>;
> Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>; intel-
> gfx@xxxxxxxxxxxxxxxxxxxxx; dri-devel@xxxxxxxxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx;
> ath10k@xxxxxxxxxxxxxxxxxxx; linux-wireless@xxxxxxxxxxxxxxx; linux-
> scsi@xxxxxxxxxxxxxxx; linux-fbdev@xxxxxxxxxxxxxxx;
> devel@xxxxxxxxxxxxxxxxxxxx; linux-fsdevel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in
> hex_dump_to_buffer with flags
> 
> On Wed 2019-04-10 13:17:19, Alastair D'Silva wrote:
> > From: Alastair D'Silva <alastair@xxxxxxxxxxx>
> >
> > In order to support additional features in hex_dump_to_buffer, replace
> > the ascii bool parameter with flags.
> >
> > Signed-off-by: Alastair D'Silva <alastair@xxxxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/intel_engine_cs.c            |  2 +-
> >  drivers/isdn/hardware/mISDN/mISDNisar.c           |  6 ++++--
> >  drivers/mailbox/mailbox-test.c                    |  2 +-
> >  drivers/net/ethernet/amd/xgbe/xgbe-drv.c          |  2 +-
> >  drivers/net/ethernet/synopsys/dwc-xlgmac-common.c |  2 +-
> >  drivers/net/wireless/ath/ath10k/debug.c           |  3 ++-
> >  drivers/net/wireless/intel/iwlegacy/3945-mac.c    |  2 +-
> >  drivers/platform/chrome/wilco_ec/debugfs.c        |  3 ++-
> >  drivers/scsi/scsi_logging.c                       |  8 +++-----
> >  drivers/staging/fbtft/fbtft-core.c                |  2 +-
> >  fs/seq_file.c                                     |  3 ++-
> >  include/linux/printk.h                            |  2 +-
> >  lib/hexdump.c                                     | 15 ++++++++-------
> >  lib/test_hexdump.c                                |  5 +++--
> >  14 files changed, 31 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c
> > b/drivers/gpu/drm/i915/intel_engine_cs.c
> > index 49fa43ff02ba..fb133e729f9a 100644
> > --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> > +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> > @@ -1318,7 +1318,7 @@ static void hexdump(struct drm_printer *m, const
> void *buf, size_t len)
> >  		WARN_ON_ONCE(hex_dump_to_buffer(buf + pos, len -
> pos,
> >  						rowsize, sizeof(u32),
> >  						line, sizeof(line),
> > -						false) >= sizeof(line));
> > +						0) >= sizeof(line));
> 
> It might be more clear when we define:
> 
> #define HEXDUMP_BINARY 0

This feels unnecessary, and weird. Omitting the flag won't disable the hex
output (as expected), and if you don't want hex output, why call hexdump in
the first place?

> >  		drm_printf(m, "[%04zx] %s\n", pos, line);
> >
> >  		prev = buf + pos;
> > diff --git a/include/linux/printk.h b/include/linux/printk.h index
> > c014e5573665..82975853c400 100644
> > --- a/include/linux/printk.h
> > +++ b/include/linux/printk.h
> > @@ -493,7 +493,7 @@ enum {
> >
> >  extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
> >  			      int groupsize, char *linebuf, size_t
linebuflen,
> > -			      bool ascii);
> > +			      u64 flags);
> 
> I wonder how fancy hex_dump could be. IMHO, u32 should be enough.
> The last famous words ;-)
> 
> Best Regards,
> Petr
> 
> 
> ---
> This email has been checked for viruses by AVG.
> https://www.avg.com





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux