public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation•org>
To: Thiago Farina <tfransosi@gmail•com>
Cc: Andre Naujoks <nautsch2@gmail•com>,
	"David S. Miller" <davem@davemloft•net>,
	Steven Rostedt <rostedt@goodmis•org>,
	Rusty Russell <rusty@rustcorp•com.au>,
	Arnd Bergmann <arnd@arndb•de>,
	"Michael S. Tsirkin" <mst@redhat•com>,
	Vladimir Kondratiev <qca_vkondrat@qca•qualcomm.com>,
	Jason Baron <jbaron@redhat•com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
	linux list <linux-kernel@vger•kernel.org>,
	linux-can@vger•kernel.org, netdev@vger•kernel.org
Subject: Re: [PATCH net 2/3] lib: introduce upper case hex ascii helpers
Date: Sat, 14 Sep 2013 21:35:46 -0700	[thread overview]
Message-ID: <20130914213546.ae435cdd.akpm@linux-foundation.org> (raw)
In-Reply-To: <CACnwZYdBocYEjASpKCNZ6cfLNpzxeLxaVjLCHwxwsYO+P14tAQ@mail.gmail.com>

On Sun, 15 Sep 2013 01:27:03 -0300 Thiago Farina <tfransosi@gmail•com> wrote:

> On Fri, Sep 13, 2013 at 2:37 PM, Andre Naujoks <nautsch2@gmail•com> wrote:
> > To be able to use the hex ascii functions in case sensitive environments
> > the array hex_asc_upper[] and the needed functions for hex_byte_pack_upper()
> > are introduced.
> >
> > Signed-off-by: Andre Naujoks <nautsch2@gmail•com>
> > ---
> >  include/linux/kernel.h | 11 +++++++++++
> >  lib/hexdump.c          |  2 ++
> >  2 files changed, 13 insertions(+)
> >
> > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > index 482ad2d..672ddc4 100644
> > --- a/include/linux/kernel.h
> > +++ b/include/linux/kernel.h
> > @@ -439,6 +439,17 @@ static inline char *hex_byte_pack(char *buf, u8 byte)
> >         return buf;
> >  }
> >
> > +extern const char hex_asc_upper[];
> > +#define hex_asc_upper_lo(x)    hex_asc_upper[((x) & 0x0f)]
> > +#define hex_asc_upper_hi(x)    hex_asc_upper[((x) & 0xf0) >> 4]
> Does using a macro instead of a real function (static inline)
> generates a better code?

Yes, a static inline would be nicer, but these are derived from
hex_asc_lo/hex_asc_hi.  If we change one we should change the other
and that becomes a separate cleanup.  So I think this patch is
OK as-is.

Also, it would make sense to get all the *hex* stuff out of kernel.h
and into a new header file (hexchar.h?).  They're a clean
self-contained thing and kernel.h is rather a dumping ground.


  reply	other threads:[~2013-09-15  4:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 17:37 [PATCH net 0/3] SLCAN/SLIP fixes and performance Andre Naujoks
2013-09-13 17:37 ` [PATCH net 1/3] slip/slcan: added locking in wakeup function Andre Naujoks
2013-09-13 18:45   ` Oliver Hartkopp
2013-09-19  9:36   ` Marc Kleine-Budde
2013-09-19 10:29     ` Andre Naujoks
2013-09-19 10:35       ` Marc Kleine-Budde
2013-09-19 10:43         ` Peter Hurley
2013-09-13 17:37 ` [PATCH net 2/3] lib: introduce upper case hex ascii helpers Andre Naujoks
2013-09-15  4:27   ` Thiago Farina
2013-09-15  4:35     ` Andrew Morton [this message]
2013-09-19  9:38       ` Marc Kleine-Budde
2013-09-19  9:57         ` Oliver Hartkopp
2013-09-13 17:37 ` [PATCH net 3/3] slcan: rewrite of slc_bump and slc_encaps Andre Naujoks
2013-09-13 18:43   ` Oliver Hartkopp
2013-09-19  9:47   ` Marc Kleine-Budde
2013-09-14 10:45 ` [PATCH net 0/3] SLCAN/SLIP fixes and performance Marc Kleine-Budde
2013-09-14 11:22   ` Andre Naujoks
2013-09-20 19:39 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130914213546.ae435cdd.akpm@linux-foundation.org \
    --to=akpm@linux-foundation$(echo .)org \
    --cc=arnd@arndb$(echo .)de \
    --cc=davem@davemloft$(echo .)net \
    --cc=gregkh@linuxfoundation$(echo .)org \
    --cc=jbaron@redhat$(echo .)com \
    --cc=linux-can@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=mst@redhat$(echo .)com \
    --cc=nautsch2@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=qca_vkondrat@qca$(echo .)qualcomm.com \
    --cc=rostedt@goodmis$(echo .)org \
    --cc=rusty@rustcorp$(echo .)com.au \
    --cc=tfransosi@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox