From: Takashi Iwai <tiwai@suse.de>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] alsa: 6fire: don't use custom hex_to_bin()
Date: Fri, 23 Sep 2011 15:22:51 +0200 [thread overview]
Message-ID: <s5hipojtmtw.wl%tiwai@suse.de> (raw)
In-Reply-To: <e23268a9c837d75a24c2d209f1623c505371eb1d.1316777507.git.andriy.shevchenko@linux.intel.com>
At Fri, 23 Sep 2011 14:32:11 +0300,
Andy Shevchenko wrote:
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: alsa-devel@alsa-project.org
Applied now. Thanks.
Takashi
> ---
> sound/usb/6fire/firmware.c | 25 ++++++++++++-------------
> 1 files changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c
> index 3ebbdec..3b5f517 100644
> --- a/sound/usb/6fire/firmware.c
> +++ b/sound/usb/6fire/firmware.c
> @@ -17,6 +17,7 @@
> #include <linux/firmware.h>
> #include <linux/module.h>
> #include <linux/bitrev.h>
> +#include <linux/kernel.h>
>
> #include "firmware.h"
> #include "chip.h"
> @@ -60,21 +61,19 @@ struct ihex_record {
> unsigned int txt_offset; /* current position in txt_data */
> };
>
> -static u8 usb6fire_fw_ihex_nibble(const u8 n)
> -{
> - if (n >= '0' && n <= '9')
> - return n - '0';
> - else if (n >= 'A' && n <= 'F')
> - return n - ('A' - 10);
> - else if (n >= 'a' && n <= 'f')
> - return n - ('a' - 10);
> - return 0;
> -}
> -
> static u8 usb6fire_fw_ihex_hex(const u8 *data, u8 *crc)
> {
> - u8 val = (usb6fire_fw_ihex_nibble(data[0]) << 4) |
> - usb6fire_fw_ihex_nibble(data[1]);
> + u8 val = 0;
> + int hval;
> +
> + hval = hex_to_bin(data[0]);
> + if (hval >= 0)
> + val |= (hval << 4);
> +
> + hval = hex_to_bin(data[1]);
> + if (hval >= 0)
> + val |= hval;
> +
> *crc += val;
> return val;
> }
> --
> 1.7.6.3
>
WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH] alsa: 6fire: don't use custom hex_to_bin()
Date: Fri, 23 Sep 2011 15:22:51 +0200 [thread overview]
Message-ID: <s5hipojtmtw.wl%tiwai@suse.de> (raw)
In-Reply-To: <e23268a9c837d75a24c2d209f1623c505371eb1d.1316777507.git.andriy.shevchenko@linux.intel.com>
At Fri, 23 Sep 2011 14:32:11 +0300,
Andy Shevchenko wrote:
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: alsa-devel@alsa-project.org
Applied now. Thanks.
Takashi
> ---
> sound/usb/6fire/firmware.c | 25 ++++++++++++-------------
> 1 files changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c
> index 3ebbdec..3b5f517 100644
> --- a/sound/usb/6fire/firmware.c
> +++ b/sound/usb/6fire/firmware.c
> @@ -17,6 +17,7 @@
> #include <linux/firmware.h>
> #include <linux/module.h>
> #include <linux/bitrev.h>
> +#include <linux/kernel.h>
>
> #include "firmware.h"
> #include "chip.h"
> @@ -60,21 +61,19 @@ struct ihex_record {
> unsigned int txt_offset; /* current position in txt_data */
> };
>
> -static u8 usb6fire_fw_ihex_nibble(const u8 n)
> -{
> - if (n >= '0' && n <= '9')
> - return n - '0';
> - else if (n >= 'A' && n <= 'F')
> - return n - ('A' - 10);
> - else if (n >= 'a' && n <= 'f')
> - return n - ('a' - 10);
> - return 0;
> -}
> -
> static u8 usb6fire_fw_ihex_hex(const u8 *data, u8 *crc)
> {
> - u8 val = (usb6fire_fw_ihex_nibble(data[0]) << 4) |
> - usb6fire_fw_ihex_nibble(data[1]);
> + u8 val = 0;
> + int hval;
> +
> + hval = hex_to_bin(data[0]);
> + if (hval >= 0)
> + val |= (hval << 4);
> +
> + hval = hex_to_bin(data[1]);
> + if (hval >= 0)
> + val |= hval;
> +
> *crc += val;
> return val;
> }
> --
> 1.7.6.3
>
next prev parent reply other threads:[~2011-09-23 13:22 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-23 11:32 [PATCH] alsa: 6fire: don't use custom hex_to_bin() Andy Shevchenko
2011-09-23 11:32 ` [PATCH] fat: " Andy Shevchenko
2011-09-23 12:05 ` Denys Vlasenko
2011-09-23 12:11 ` Andy Shevchenko
2011-09-27 11:48 ` [PATCHv2] " Andy Shevchenko
2011-09-27 17:19 ` OGAWA Hirofumi
2011-09-27 17:52 ` Andy Shevchenko
2011-09-27 18:06 ` Andy Shevchenko
2011-09-27 23:15 ` OGAWA Hirofumi
2011-09-29 13:07 ` Andy Shevchenko
2011-09-29 14:43 ` OGAWA Hirofumi
2011-09-29 14:54 ` Andy Shevchenko
2011-09-29 15:19 ` OGAWA Hirofumi
2011-09-29 15:10 ` [PATCHv4] " Andy Shevchenko
2011-09-29 15:37 ` Joe Perches
2011-09-29 18:27 ` OGAWA Hirofumi
2011-09-29 18:41 ` Joe Perches
2011-09-29 19:35 ` OGAWA Hirofumi
2011-09-29 13:15 ` [PATCHv3] " Andy Shevchenko
2011-09-29 14:51 ` OGAWA Hirofumi
2011-09-23 13:22 ` Takashi Iwai [this message]
2011-09-23 13:22 ` [PATCH] alsa: 6fire: " Takashi Iwai
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=s5hipojtmtw.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.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.