linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: clean up code a bit, use kernel native methods
@ 2010-07-22 13:24 Andy Shevchenko
  2010-07-22 15:15 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2010-07-22 13:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andy Shevchenko, Greg Kroah-Hartman, devel

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: devel@driverdev.osuosl.org
---
 drivers/staging/otus/apdbg.c             |   22 -----------------
 drivers/staging/panel/panel.c            |   19 +++++---------
 drivers/staging/rtl8192su/r8192S_Efuse.c |   27 ++-------------------
 drivers/staging/wlags49_h2/wl_util.c     |   37 +-----------------------------
 drivers/staging/wlags49_h2/wl_util.h     |    2 -
 drivers/staging/wlan-ng/prism2sta.c      |    6 +---
 6 files changed, 13 insertions(+), 100 deletions(-)

diff --git a/drivers/staging/otus/apdbg.c b/drivers/staging/otus/apdbg.c
index 32c26e5..09415a6 100644
--- a/drivers/staging/otus/apdbg.c
+++ b/drivers/staging/otus/apdbg.c
@@ -90,28 +90,6 @@ struct zdap_ioctl {
 
 #endif
 
-static char hex(char v)
-{
-	if (isdigit(v))
-		return v - '0';
-	else if (isxdigit(v))
-		return tolower(v) - 'a' + 10;
-	else
-		return 0;
-}
-
-static unsigned char asctohex(char *str)
-{
-	unsigned char value;
-
-	value = hex(*str) & 0x0f;
-	value = value << 4;
-	str++;
-	value |= hex(*str) & 0x0f;
-
-	return value;
-}
-
 char *prgname;
 
 int set_ioctl(int sock, struct ifreq *req)
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 8bd7182..3e07e41 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -48,6 +48,7 @@
 #include <linux/fcntl.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <linux/parport.h>
 #include <linux/version.h>
@@ -1179,22 +1180,16 @@ static inline int handle_lcd_special_code(void)
 			break;
 
 		while (*esc) {
+			char *endp;
+
 			if (*esc == 'x') {
 				esc++;
-				lcd_addr_x = 0;
-				while (isdigit(*esc)) {
-					lcd_addr_x = lcd_addr_x * 10 +
-						     (*esc - '0');
-					esc++;
-				}
+				lcd_addr_x = simple_strtoul(esc, &endp, 10);
+				esc = endp;
 			} else if (*esc == 'y') {
 				esc++;
-				lcd_addr_y = 0;
-				while (isdigit(*esc)) {
-					lcd_addr_y = lcd_addr_y * 10 +
-						     (*esc - '0');
-					esc++;
-				}
+				lcd_addr_y = simple_strtoul(esc, &endp, 10);
+				esc = endp;
 			} else
 				break;
 		}
diff --git a/drivers/staging/rtl8192su/r8192S_Efuse.c b/drivers/staging/rtl8192su/r8192S_Efuse.c
index 1e1d55e..c4bbe40 100644
--- a/drivers/staging/rtl8192su/r8192S_Efuse.c
+++ b/drivers/staging/rtl8192su/r8192S_Efuse.c
@@ -30,6 +30,7 @@
 #include "r8192S_Efuse.h"
 
 #include <linux/types.h>
+#include <linux/ctype.h>
 
 //typedef  int	INT32;
 //
@@ -1828,26 +1829,6 @@ EFUSE_ProgramMap(struct net_device* dev, char* pFileName,u8	TableType)
 
 #endif
 
-//
-//	Description:
-//		Return TRUE if chTmp is represent for hex digit and
-//		FALSE otherwise.
-//
-//
-bool IsHexDigit(	char chTmp)
-{
-	if( (chTmp >= '0' && chTmp <= '9') ||
-		(chTmp >= 'a' && chTmp <= 'f') ||
-		(chTmp >= 'A' && chTmp <= 'F') )
-	{
-		return TRUE;
-	}
-	else
-	{
-		return FALSE;
-	}
-}
-
 /*-----------------------------------------------------------------------------
  * Function:	efuse_ParsingMap
  *
@@ -1893,10 +1874,8 @@ efuse_ParsingMap(char* szStr,u32* pu4bVal,u32* pu4bMove)
 
 	// Check if szScan is now pointer to a character for hex digit,
 	// if not, it means this is not a valid hex number.
-	if(!IsHexDigit(*szScan))
-	{
+	if (!isxdigit(*szScan))
 		return FALSE;
-	}
 
 	// Parse each digit.
 	do
@@ -1905,7 +1884,7 @@ efuse_ParsingMap(char* szStr,u32* pu4bVal,u32* pu4bMove)
 
 		szScan++;
 		(*pu4bMove)++;
-	} while(IsHexDigit(*szScan));
+	} while (isxdigit(*szScan));
 
 	return TRUE;
 
diff --git a/drivers/staging/wlags49_h2/wl_util.c b/drivers/staging/wlags49_h2/wl_util.c
index bbdb997..ce8ed41 100644
--- a/drivers/staging/wlags49_h2/wl_util.c
+++ b/drivers/staging/wlags49_h2/wl_util.c
@@ -259,41 +259,6 @@ int is_valid_key_string( char *s )
 
 
 /*******************************************************************************
- *	hexdigit2int()
- *******************************************************************************
- *
- *  DESCRIPTION:
- *
- *      Converts a hexadecimal digit character to an integer
- *
- *  PARAMETERS:
- *
- *      c   - the hexadecimal digit character
- *
- *  RETURNS:
- *
- *      the converted integer
- *
- ******************************************************************************/
-int hexdigit2int( char c )
-{
-   if( c >= '0' && c <= '9' )
-       return c - '0';
-
-   if( c >= 'A' && c <= 'F' )
-       return c - 'A' + 10;
-
-   if( c >= 'a' && c <= 'f' )
-       return c - 'a' + 10;
-
-   return 0;
-} // hexdigit2int
-/*============================================================================*/
-
-
-
-
-/*******************************************************************************
  *	key_string2key()
  *******************************************************************************
  *
@@ -328,7 +293,7 @@ void key_string2key( char *ks, KEY_STRCT *key )
         p = (char *)key->key;
 
         for( i = 2; i < l; i+=2 ) {
-           *p++ = ( hexdigit2int( ks[i] ) << 4 ) + hexdigit2int (ks[i+1] );
+			*p++ = (hex_to_bin(ks[i]) << 4) + hex_to_bin(ks[i+1]);
            n++;
         }
 
diff --git a/drivers/staging/wlags49_h2/wl_util.h b/drivers/staging/wlags49_h2/wl_util.h
index 561e85b..ba537a6 100644
--- a/drivers/staging/wlags49_h2/wl_util.h
+++ b/drivers/staging/wlags49_h2/wl_util.h
@@ -71,8 +71,6 @@ int is_valid_key_string( char *s );
 
 void key_string2key( char *ks, KEY_STRCT *key );
 
-int hexdigit2int( char c );
-
 void wl_hcf_error( struct net_device *dev, int hcfStatus );
 
 void wl_endian_translate_event( ltv_t *pLtv );
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index 5ec5741..1a502bc 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -83,8 +83,6 @@
 #include "hfa384x.h"
 #include "prism2mgmt.h"
 
-#define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
-
 /* Create a string of printable chars from something that might not be */
 /* It's recommended that the str be 4*len + 1 bytes long */
 #define wlan_mkprintstr(buf, buflen, str, strlen) \
@@ -99,8 +97,8 @@
 		} else { \
 			(str)[j] = '\\'; \
 			(str)[j+1] = 'x'; \
-			(str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
-			(str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
+			(str)[j+2] = hex_asc_hi((buf)[i]); \
+			(str)[j+3] = hex_asc_lo((buf)[i]); \
 			j += 4; \
 		} \
 	} \
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] staging: clean up code a bit, use kernel native methods
  2010-07-22 13:24 [PATCH] staging: clean up code a bit, use kernel native methods Andy Shevchenko
@ 2010-07-22 15:15 ` Greg KH
  2010-07-22 16:57   ` [PATCH 0/5] " Andy Shevchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2010-07-22 15:15 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, devel

On Thu, Jul 22, 2010 at 04:24:02PM +0300, Andy Shevchenko wrote:
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: devel@driverdev.osuosl.org
> ---
>  drivers/staging/otus/apdbg.c             |   22 -----------------
>  drivers/staging/panel/panel.c            |   19 +++++---------
>  drivers/staging/rtl8192su/r8192S_Efuse.c |   27 ++-------------------
>  drivers/staging/wlags49_h2/wl_util.c     |   37 +-----------------------------
>  drivers/staging/wlags49_h2/wl_util.h     |    2 -
>  drivers/staging/wlan-ng/prism2sta.c      |    6 +---

Can you break this up into 5 different patches, one per driver, and use
a better description of exactly what you did in each driver?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 0/5] staging: clean up code a bit, use kernel native methods
  2010-07-22 15:15 ` Greg KH
@ 2010-07-22 16:57   ` Andy Shevchenko
  2010-07-22 16:57     ` [PATCH 1/5] staging: remove unused methods Andy Shevchenko
                       ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Andy Shevchenko @ 2010-07-22 16:57 UTC (permalink / raw)
  To: linux-kernel, Greg Kroah-Hartman, devel; +Cc: Andy Shevchenko

Andy Shevchenko (5):
  staging: remove unused methods
  staging: panel: change own pieces of code by strtoul()
  staging: rtl8192su: don't use own isxdigit() method
  staging: wlags49_h2: remove custom hex_to_bin() method
  staging: wlan-ng: remove own bin2hex converter

 drivers/staging/otus/apdbg.c             |   22 -----------------
 drivers/staging/panel/panel.c            |   19 +++++---------
 drivers/staging/rtl8192su/r8192S_Efuse.c |   27 ++-------------------
 drivers/staging/wlags49_h2/wl_util.c     |   37 +-----------------------------
 drivers/staging/wlags49_h2/wl_util.h     |    2 -
 drivers/staging/wlan-ng/prism2sta.c      |    6 +---
 6 files changed, 13 insertions(+), 100 deletions(-)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/5] staging: remove unused methods
  2010-07-22 16:57   ` [PATCH 0/5] " Andy Shevchenko
@ 2010-07-22 16:57     ` Andy Shevchenko
  2010-07-22 16:57     ` [PATCH 2/5] staging: panel: change own pieces of code by strtoul() Andy Shevchenko
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2010-07-22 16:57 UTC (permalink / raw)
  To: linux-kernel, Greg Kroah-Hartman, devel; +Cc: Andy Shevchenko

This is rebased version of the patch [1] which was mysteriously not
pushed anywhere but acked.

Here are two methods to convert hex value to binary format. These
certain methods aren't used anywhere in kernel.

[1] http://lkml.org/lkml/2010/2/18/267

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/staging/otus/apdbg.c |   22 ----------------------
 1 files changed, 0 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/otus/apdbg.c b/drivers/staging/otus/apdbg.c
index 32c26e5..09415a6 100644
--- a/drivers/staging/otus/apdbg.c
+++ b/drivers/staging/otus/apdbg.c
@@ -90,28 +90,6 @@ struct zdap_ioctl {
 
 #endif
 
-static char hex(char v)
-{
-	if (isdigit(v))
-		return v - '0';
-	else if (isxdigit(v))
-		return tolower(v) - 'a' + 10;
-	else
-		return 0;
-}
-
-static unsigned char asctohex(char *str)
-{
-	unsigned char value;
-
-	value = hex(*str) & 0x0f;
-	value = value << 4;
-	str++;
-	value |= hex(*str) & 0x0f;
-
-	return value;
-}
-
 char *prgname;
 
 int set_ioctl(int sock, struct ifreq *req)
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/5] staging: panel: change own pieces of code by strtoul()
  2010-07-22 16:57   ` [PATCH 0/5] " Andy Shevchenko
  2010-07-22 16:57     ` [PATCH 1/5] staging: remove unused methods Andy Shevchenko
@ 2010-07-22 16:57     ` Andy Shevchenko
  2010-07-22 16:57     ` [PATCH 3/5] staging: rtl8192su: don't use own isxdigit() method Andy Shevchenko
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2010-07-22 16:57 UTC (permalink / raw)
  To: linux-kernel, Greg Kroah-Hartman, devel; +Cc: Andy Shevchenko

We have nice method simple_strtoul() to convert string to numbers which
could be used here.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/staging/panel/panel.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 8bd7182..3e07e41 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -48,6 +48,7 @@
 #include <linux/fcntl.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <linux/parport.h>
 #include <linux/version.h>
@@ -1179,22 +1180,16 @@ static inline int handle_lcd_special_code(void)
 			break;
 
 		while (*esc) {
+			char *endp;
+
 			if (*esc == 'x') {
 				esc++;
-				lcd_addr_x = 0;
-				while (isdigit(*esc)) {
-					lcd_addr_x = lcd_addr_x * 10 +
-						     (*esc - '0');
-					esc++;
-				}
+				lcd_addr_x = simple_strtoul(esc, &endp, 10);
+				esc = endp;
 			} else if (*esc == 'y') {
 				esc++;
-				lcd_addr_y = 0;
-				while (isdigit(*esc)) {
-					lcd_addr_y = lcd_addr_y * 10 +
-						     (*esc - '0');
-					esc++;
-				}
+				lcd_addr_y = simple_strtoul(esc, &endp, 10);
+				esc = endp;
 			} else
 				break;
 		}
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/5] staging: rtl8192su: don't use own isxdigit() method
  2010-07-22 16:57   ` [PATCH 0/5] " Andy Shevchenko
  2010-07-22 16:57     ` [PATCH 1/5] staging: remove unused methods Andy Shevchenko
  2010-07-22 16:57     ` [PATCH 2/5] staging: panel: change own pieces of code by strtoul() Andy Shevchenko
@ 2010-07-22 16:57     ` Andy Shevchenko
  2010-07-22 16:57     ` [PATCH 4/5] staging: wlags49_h2: remove custom hex_to_bin() method Andy Shevchenko
  2010-07-22 16:57     ` [PATCH 5/5] staging: wlan-ng: remove own bin2hex converter Andy Shevchenko
  4 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2010-07-22 16:57 UTC (permalink / raw)
  To: linux-kernel, Greg Kroah-Hartman, devel; +Cc: Andy Shevchenko

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/staging/rtl8192su/r8192S_Efuse.c |   27 +++------------------------
 1 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8192su/r8192S_Efuse.c b/drivers/staging/rtl8192su/r8192S_Efuse.c
index 1e1d55e..c4bbe40 100644
--- a/drivers/staging/rtl8192su/r8192S_Efuse.c
+++ b/drivers/staging/rtl8192su/r8192S_Efuse.c
@@ -30,6 +30,7 @@
 #include "r8192S_Efuse.h"
 
 #include <linux/types.h>
+#include <linux/ctype.h>
 
 //typedef  int	INT32;
 //
@@ -1828,26 +1829,6 @@ EFUSE_ProgramMap(struct net_device* dev, char* pFileName,u8	TableType)
 
 #endif
 
-//
-//	Description:
-//		Return TRUE if chTmp is represent for hex digit and
-//		FALSE otherwise.
-//
-//
-bool IsHexDigit(	char chTmp)
-{
-	if( (chTmp >= '0' && chTmp <= '9') ||
-		(chTmp >= 'a' && chTmp <= 'f') ||
-		(chTmp >= 'A' && chTmp <= 'F') )
-	{
-		return TRUE;
-	}
-	else
-	{
-		return FALSE;
-	}
-}
-
 /*-----------------------------------------------------------------------------
  * Function:	efuse_ParsingMap
  *
@@ -1893,10 +1874,8 @@ efuse_ParsingMap(char* szStr,u32* pu4bVal,u32* pu4bMove)
 
 	// Check if szScan is now pointer to a character for hex digit,
 	// if not, it means this is not a valid hex number.
-	if(!IsHexDigit(*szScan))
-	{
+	if (!isxdigit(*szScan))
 		return FALSE;
-	}
 
 	// Parse each digit.
 	do
@@ -1905,7 +1884,7 @@ efuse_ParsingMap(char* szStr,u32* pu4bVal,u32* pu4bMove)
 
 		szScan++;
 		(*pu4bMove)++;
-	} while(IsHexDigit(*szScan));
+	} while (isxdigit(*szScan));
 
 	return TRUE;
 
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/5] staging: wlags49_h2: remove custom hex_to_bin() method
  2010-07-22 16:57   ` [PATCH 0/5] " Andy Shevchenko
                       ` (2 preceding siblings ...)
  2010-07-22 16:57     ` [PATCH 3/5] staging: rtl8192su: don't use own isxdigit() method Andy Shevchenko
@ 2010-07-22 16:57     ` Andy Shevchenko
  2010-07-22 16:57     ` [PATCH 5/5] staging: wlan-ng: remove own bin2hex converter Andy Shevchenko
  4 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2010-07-22 16:57 UTC (permalink / raw)
  To: linux-kernel, Greg Kroah-Hartman, devel; +Cc: Andy Shevchenko

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/staging/wlags49_h2/wl_util.c |   37 +---------------------------------
 drivers/staging/wlags49_h2/wl_util.h |    2 -
 2 files changed, 1 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/wlags49_h2/wl_util.c b/drivers/staging/wlags49_h2/wl_util.c
index bbdb997..ce8ed41 100644
--- a/drivers/staging/wlags49_h2/wl_util.c
+++ b/drivers/staging/wlags49_h2/wl_util.c
@@ -259,41 +259,6 @@ int is_valid_key_string( char *s )
 
 
 /*******************************************************************************
- *	hexdigit2int()
- *******************************************************************************
- *
- *  DESCRIPTION:
- *
- *      Converts a hexadecimal digit character to an integer
- *
- *  PARAMETERS:
- *
- *      c   - the hexadecimal digit character
- *
- *  RETURNS:
- *
- *      the converted integer
- *
- ******************************************************************************/
-int hexdigit2int( char c )
-{
-   if( c >= '0' && c <= '9' )
-       return c - '0';
-
-   if( c >= 'A' && c <= 'F' )
-       return c - 'A' + 10;
-
-   if( c >= 'a' && c <= 'f' )
-       return c - 'a' + 10;
-
-   return 0;
-} // hexdigit2int
-/*============================================================================*/
-
-
-
-
-/*******************************************************************************
  *	key_string2key()
  *******************************************************************************
  *
@@ -328,7 +293,7 @@ void key_string2key( char *ks, KEY_STRCT *key )
         p = (char *)key->key;
 
         for( i = 2; i < l; i+=2 ) {
-           *p++ = ( hexdigit2int( ks[i] ) << 4 ) + hexdigit2int (ks[i+1] );
+			*p++ = (hex_to_bin(ks[i]) << 4) + hex_to_bin(ks[i+1]);
            n++;
         }
 
diff --git a/drivers/staging/wlags49_h2/wl_util.h b/drivers/staging/wlags49_h2/wl_util.h
index 561e85b..ba537a6 100644
--- a/drivers/staging/wlags49_h2/wl_util.h
+++ b/drivers/staging/wlags49_h2/wl_util.h
@@ -71,8 +71,6 @@ int is_valid_key_string( char *s );
 
 void key_string2key( char *ks, KEY_STRCT *key );
 
-int hexdigit2int( char c );
-
 void wl_hcf_error( struct net_device *dev, int hcfStatus );
 
 void wl_endian_translate_event( ltv_t *pLtv );
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/5] staging: wlan-ng: remove own bin2hex converter
  2010-07-22 16:57   ` [PATCH 0/5] " Andy Shevchenko
                       ` (3 preceding siblings ...)
  2010-07-22 16:57     ` [PATCH 4/5] staging: wlags49_h2: remove custom hex_to_bin() method Andy Shevchenko
@ 2010-07-22 16:57     ` Andy Shevchenko
  4 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2010-07-22 16:57 UTC (permalink / raw)
  To: linux-kernel, Greg Kroah-Hartman, devel; +Cc: Andy Shevchenko

In kernel we have hex_asc_hi and hex_asc_lo macroses to do the job.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/staging/wlan-ng/prism2sta.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index 5ec5741..1a502bc 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -83,8 +83,6 @@
 #include "hfa384x.h"
 #include "prism2mgmt.h"
 
-#define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
-
 /* Create a string of printable chars from something that might not be */
 /* It's recommended that the str be 4*len + 1 bytes long */
 #define wlan_mkprintstr(buf, buflen, str, strlen) \
@@ -99,8 +97,8 @@
 		} else { \
 			(str)[j] = '\\'; \
 			(str)[j+1] = 'x'; \
-			(str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
-			(str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
+			(str)[j+2] = hex_asc_hi((buf)[i]); \
+			(str)[j+3] = hex_asc_lo((buf)[i]); \
 			j += 4; \
 		} \
 	} \
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-07-22 16:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-22 13:24 [PATCH] staging: clean up code a bit, use kernel native methods Andy Shevchenko
2010-07-22 15:15 ` Greg KH
2010-07-22 16:57   ` [PATCH 0/5] " Andy Shevchenko
2010-07-22 16:57     ` [PATCH 1/5] staging: remove unused methods Andy Shevchenko
2010-07-22 16:57     ` [PATCH 2/5] staging: panel: change own pieces of code by strtoul() Andy Shevchenko
2010-07-22 16:57     ` [PATCH 3/5] staging: rtl8192su: don't use own isxdigit() method Andy Shevchenko
2010-07-22 16:57     ` [PATCH 4/5] staging: wlags49_h2: remove custom hex_to_bin() method Andy Shevchenko
2010-07-22 16:57     ` [PATCH 5/5] staging: wlan-ng: remove own bin2hex converter Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).