diff options
author | Andy Shevchenko <ext-andriy.shevchenko@nokia.com> | 2010-01-14 15:07:23 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-03 16:42:44 -0800 |
commit | 9f64859208f3a56f33f2e893e11df585768f1705 (patch) | |
tree | 2a9e1e35340b713fde86db211ab1829bb26026cf /drivers/staging/wlags49_h2/wl_util.c | |
parent | e4c3a24dc5c318e57e5295a54f03eb8ae54d9ffa (diff) |
staging: wlags49: don't use custom implementation of atoi()
Kernel has its own method called simple_strtoul() to do such things.
Here we are using simple_strtoul(value, NULL, 0) because in original function
the recognized base is 10 or 16 and input data is assumed to be unsigned.
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/wlags49_h2/wl_util.c')
-rw-r--r-- | drivers/staging/wlags49_h2/wl_util.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/drivers/staging/wlags49_h2/wl_util.c b/drivers/staging/wlags49_h2/wl_util.c index ac1e7f38f98..bbdb9973d1e 100644 --- a/drivers/staging/wlags49_h2/wl_util.c +++ b/drivers/staging/wlags49_h2/wl_util.c @@ -1536,52 +1536,3 @@ int wl_get_tallies(struct wl_private *lp, return ret; } -/******************************************************************************* - * wl_atoi() - ******************************************************************************* - * - * DESCRIPTION: - * - * Believe it or not, we need our own implementation of atoi in the kernel. - * - * PARAMETERS: - * - * string - the ASCII string to convert to an integer - * - * RETURNS: - * - * unsigned integer - * - ******************************************************************************/ -unsigned int wl_atoi( char *string ) -{ -unsigned int base = 10; //default to decimal -unsigned int value = 0; -unsigned int c; -int i = strlen( string ); - - if ( i > 2 && string[0] == '0' && ( string[1] | ('X'^'x') ) == 'x' ) { - base = 16; - string +=2; - } - while ( ( c = *string++ ) != '\0' ) { - if ( value > UINT_MAX / base ) { //test for overrun - DBG_FUNC( "wl_atoi" ); //don't overload the log file with good messages - DBG_ENTER( DbgInfo ); - DBG_ERROR( DbgInfo, "string \"%s\", lenght exceeds expectations\n", string ); - printk( "<1>string \"%s\", lenght exceeds expectations\n", string ); - DBG_LEAVE( DbgInfo ); - break; - } - c -= '0'; - if ( 0 <= c && c <= 9 ) value = base * value + c; - else if ( base == 16 ) { - c += '0'; - c |= 'A'^'a'; - c = c - 'a'+ 10; - if ( 10 <= c && c <= 15 ) value = base * value + c; - } - } - return value; -} // wl_atoi - |