linux-mips
[Top] [All Lists]

Re: [PATCH] arch: mips: use newly introduced hex_to_bin()

To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arch: mips: use newly introduced hex_to_bin()
From: Andy Shevchenko <andy.shevchenko@gmail.com>
Date: Mon, 11 Oct 2010 19:34:16 +0300
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>, Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=stngk5WakoFPnjn8y3X/00TDAa05/13i7lHJBD6VKr0=; b=fKDLh0E3wJZDWaXvi/7CZlapk3igQQwTPYPRuuvh1ggmBA9jfnKIfedSpzmfOif/lF VXQ1KDsdoClGH2kQP+caYwbPckvVT6IfQXjT8v1Dg7JCZVWslJynPZaKivA3gcwydJNH Zsb6Z8AsR9EqDmm8MR/457oeTMVTgJ28n0zUA=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=iPwsTJa0HDv4XGuo93PYYKDHZyKSew6PjjfJdiD6ZwajUzJvIR3Wk/YnfTYiRItOVO e/2tkYFsp7m0h3yeA1oWpkWRQSgJOKFlmEEwLDzQrl0dJtIWlMM8LLk3zJPk97Y1dund BQbU+51MxLkzWCcD4nS8yKfWWXUowyeySir5s=
In-reply-to: <1284212009-25708-1-git-send-email-andy.shevchenko@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1284212009-25708-1-git-send-email-andy.shevchenko@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
Any comments here?

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
>
>



-- 
With Best Regards,
Andy Shevchenko
<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH] arch: mips: use newly introduced hex_to_bin(), Andy Shevchenko <=