All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <florian@openwrt.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-kernel@vger.kernel.org, Ralf Baechle <ralf@linux-mips.org>,
	linux-mips@linux-mips.org
Subject: Re: [PATCH] arch: mips: use newly introduced hex_to_bin()
Date: Mon, 8 Nov 2010 08:26:23 +0100	[thread overview]
Message-ID: <201011080826.25676.florian@openwrt.org> (raw)
In-Reply-To: <AANLkTimRVNYMh923+5qS5mifDKgJRwCxeWGMXWYaJXr9@mail.gmail.com>

Le Monday 11 October 2010 18:34:16, Andy Shevchenko a écrit :
> Any comments here?

Acked-by: Florian Fainelli <florian@openwrt.org>

> 
> On Sat, Sep 11, 2010 at 4:33 PM, Andy Shevchenko
> 
> <andy.shevchenko@gmail.com> wrote:
> > Remove custom implementation of hex_to_bin().
> > 
> > Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Cc: Ralf Baechle <ralf@linux-mips.org>
> > Cc: linux-mips@linux-mips.org
> > ---
> >  arch/mips/rb532/devices.c |   24 +++++++++---------------
> >  1 files changed, 9 insertions(+), 15 deletions(-)
> > 
> > diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
> > index 041fc1a..a969eb8 100644
> > --- a/arch/mips/rb532/devices.c
> > +++ b/arch/mips/rb532/devices.c
> > @@ -251,28 +251,22 @@ static struct platform_device *rb532_devs[] = {
> > 
> >  static void __init parse_mac_addr(char *macstr)
> >  {
> > -       int i, j;
> > -       unsigned char result, value;
> > +       int i, h, l;
> > 
> >        for (i = 0; i < 6; i++) {
> > -               result = 0;
> > -
> >                if (i != 5 && *(macstr + 2) != ':')
> >                        return;
> > 
> > -               for (j = 0; j < 2; j++) {
> > -                       if (isxdigit(*macstr)
> > -                           && (value =
> > -                               isdigit(*macstr) ? *macstr -
> > -                               '0' : toupper(*macstr) - 'A' + 10) < 16)
> > { -                               result = result * 16 + value;
> > -                               macstr++;
> > -                       } else
> > -                               return;
> > -               }
> > +               h = hex_to_bin(*macstr++);
> > +               if (h == -1)
> > +                       return;
> > +
> > +               l = hex_to_bin(*macstr++);
> > +               if (l == -1)
> > +                       return;
> > 
> >                macstr++;
> > -               korina_dev0_data.mac[i] = result;
> > +               korina_dev0_data.mac[i] = (h << 4) + l;
> >        }
> >  }
> > 
> > --
> > 1.7.2.2

  reply	other threads:[~2010-11-08  7:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-11 13:33 [PATCH] arch: mips: use newly introduced hex_to_bin() Andy Shevchenko
2010-10-11 16:34 ` Andy Shevchenko
2010-10-11 16:34   ` Andy Shevchenko
2010-11-08  7:26   ` Florian Fainelli [this message]
2011-05-19 16:12     ` Ralf Baechle

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=201011080826.25676.florian@openwrt.org \
    --to=florian@openwrt.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.