Re: [PATCH 2/2] media: video: pvrusb2: remove custom hex_to_bin()

2010-07-27 Thread Mike Isely

Andy:

Acked-By: Mike Isely 

  -Mike


On Tue, 27 Jul 2010, Andy Shevchenko wrote:

> Signed-off-by: Andy Shevchenko 
> Cc: Mike Isely 
> ---
>  drivers/media/video/pvrusb2/pvrusb2-debugifc.c |   14 ++
>  1 files changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c 
> b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
> index e9b11e1..4279ebb 100644
> --- a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
> +++ b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
> @@ -94,8 +94,6 @@ static int debugifc_parse_unsigned_number(const char 
> *buf,unsigned int count,
> u32 *num_ptr)
>  {
>   u32 result = 0;
> - u32 val;
> - int ch;
>   int radix = 10;
>   if ((count >= 2) && (buf[0] == '0') &&
>   ((buf[1] == 'x') || (buf[1] == 'X'))) {
> @@ -107,17 +105,9 @@ static int debugifc_parse_unsigned_number(const char 
> *buf,unsigned int count,
>   }
>  
>   while (count--) {
> - ch = *buf++;
> - if ((ch >= '0') && (ch <= '9')) {
> - val = ch - '0';
> - } else if ((ch >= 'a') && (ch <= 'f')) {
> - val = ch - 'a' + 10;
> - } else if ((ch >= 'A') && (ch <= 'F')) {
> - val = ch - 'A' + 10;
> - } else {
> + int val = hex_to_bin(*buf++);
> + if (val < 0 || val >= radix)
>   return -EINVAL;
> - }
> - if (val >= radix) return -EINVAL;
>   result *= radix;
>   result += val;
>   }
> 

-- 

Mike Isely
isely @ isely (dot) net
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] media: video: pvrusb2: remove custom hex_to_bin()

2010-07-27 Thread Andy Shevchenko
Signed-off-by: Andy Shevchenko 
Cc: Mike Isely 
---
 drivers/media/video/pvrusb2/pvrusb2-debugifc.c |   14 ++
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c 
b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
index e9b11e1..4279ebb 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
@@ -94,8 +94,6 @@ static int debugifc_parse_unsigned_number(const char 
*buf,unsigned int count,
  u32 *num_ptr)
 {
u32 result = 0;
-   u32 val;
-   int ch;
int radix = 10;
if ((count >= 2) && (buf[0] == '0') &&
((buf[1] == 'x') || (buf[1] == 'X'))) {
@@ -107,17 +105,9 @@ static int debugifc_parse_unsigned_number(const char 
*buf,unsigned int count,
}
 
while (count--) {
-   ch = *buf++;
-   if ((ch >= '0') && (ch <= '9')) {
-   val = ch - '0';
-   } else if ((ch >= 'a') && (ch <= 'f')) {
-   val = ch - 'a' + 10;
-   } else if ((ch >= 'A') && (ch <= 'F')) {
-   val = ch - 'A' + 10;
-   } else {
+   int val = hex_to_bin(*buf++);
+   if (val < 0 || val >= radix)
return -EINVAL;
-   }
-   if (val >= radix) return -EINVAL;
result *= radix;
result += val;
}
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html