lkml.org 
[lkml]   [2010]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/11] drivers: net: optimize hex2bin()
Hi Andy,

Sorry for the delay, I was working away from my test equipment
and wanted to test this change before commenting.

On 02/22/2010 10:09 AM, Andy Shevchenko wrote:
> From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
>
> Optimize hex2bin() function used in ps3_gelic_wireless.c. It requires to have
> hex_to_bin() implementation introduced by starter patch in series.
>
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> Cc: Geoff Levand <geoffrey.levand@am.sony.com>
> ---
> drivers/net/ps3_gelic_wireless.c | 12 ++++--------
> 1 files changed, 4 insertions(+), 8 deletions(-)
>
> --- a/drivers/net/ps3_gelic_wireless.c
> +++ b/drivers/net/ps3_gelic_wireless.c
> @@ -1394,23 +1394,19 @@ static int gelic_wl_get_mode(struct net_device *netdev,
> static int hex2bin(u8 *str, u8 *bin, unsigned int len)
> {
> unsigned int i;
> - static unsigned char *hex = "0123456789ABCDEF";
> - unsigned char *p, *q;
> - u8 tmp;
>
> if (len != WPA_PSK_LEN * 2)
> return -EINVAL;
>
> for (i = 0; i < WPA_PSK_LEN * 2; i += 2) {
> - p = strchr(hex, toupper(str[i]));
> - q = strchr(hex, toupper(str[i + 1]));
> - if (!p || !q) {
> + int h = hex_to_bin(str[i]);
> + int l = hex_to_bin(str[i+1]);
> + if ((h == -1) || (l == -1)) {

We should have a blank line between the two variable declarations
and the if statement here.

Please make an updated patch, otherwise this patch looks OK,
and seems to work correctly on PS3.

-Geoff




\
 
 \ /
  Last update: 2010-03-02 00:23    [W:0.160 / U:0.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site