[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1166c97d5f0ff750e5871937eb1d7e3c0423bbdd.camel@d-silva.org>
Date: Wed, 26 Jun 2019 11:27:48 +1000
From: "Alastair D'Silva" <alastair@...ilva.org>
To: Joe Perches <joe@...ches.com>
Cc: Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Dan Carpenter <dan.carpenter@...cle.com>,
Karsten Keil <isdn@...ux-pingi.de>,
Jassi Brar <jassisinghbrar@...il.com>,
Tom Lendacky <thomas.lendacky@....com>,
"David S. Miller" <davem@...emloft.net>,
Jose Abreu <Jose.Abreu@...opsys.com>,
Kalle Valo <kvalo@...eaurora.org>,
Stanislaw Gruszka <sgruszka@...hat.com>,
Benson Leung <bleung@...omium.org>,
Enric Balletbo i Serra <enric.balletbo@...labora.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
David Laight <David.Laight@...LAB.COM>,
Andrew Morton <akpm@...ux-foundation.org>,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
ath10k@...ts.infradead.org, linux-wireless@...r.kernel.org,
linux-scsi@...r.kernel.org, linux-fbdev@...r.kernel.org,
devel@...verdev.osuosl.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v4 4/7] lib/hexdump.c: Replace ascii bool in
hex_dump_to_buffer with flags
On Mon, 2019-06-24 at 22:01 -0700, Joe Perches wrote:
> On Tue, 2019-06-25 at 13:17 +1000, Alastair D'Silva wrote:
> > From: Alastair D'Silva <alastair@...ilva.org>
> >
> > In order to support additional features, rename hex_dump_to_buffer
> > to
> > hex_dump_to_buffer_ext, and replace the ascii bool parameter with
> > flags.
> []
> > diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c
> > b/drivers/gpu/drm/i915/intel_engine_cs.c
> []
> > @@ -1338,9 +1338,8 @@ 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));
> > + rowsize, sizeof(u32),
> > line,
> > + sizeof(line)) >=
> > sizeof(line));
>
> Huh? Why do this?
The ascii parameter was removed from the simple API as per Jani's
suggestion. The remainder was reformatted to avoid exceeding the line
length limits.
>
> > diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c
> > b/drivers/isdn/hardware/mISDN/mISDNisar.c
> []
> > @@ -70,8 +70,9 @@ send_mbox(struct isar_hw *isar, u8 his, u8 creg,
> > u8 len, u8 *msg)
> > int l = 0;
> >
> > while (l < (int)len) {
> > - hex_dump_to_buffer(msg + l, len - l,
> > 32, 1,
> > - isar->log, 256, 1);
> > + hex_dump_to_buffer_ext(msg + l, len -
> > l, 32, 1,
> > + isar->log, 256,
> > + HEXDUMP_ASCII);
>
> Again, why do any of these?
>
> The point of the wrapper is to avoid changing these.
Jani made a pretty good point that about half the callers didn't want
an ASCII dump, and presenting a simplified API makes sense.
I would actually put forward that we consider dropping rowsize from the
simplified API too, as most callers use 32, and those that use 16 would
probably be OK with 32.
Your proposal, on the other hand, only makes sense if there were many
callers, and even so, not in the form that you presented, since that
result in a mix of booleans & bitfields that you were critical of.
--
Alastair D'Silva mob: 0423 762 819
skype: alastair_dsilva
Twitter: @EvilDeece
blog: http://alastair.d-silva.org
Powered by blists - more mailing lists