Skip to content

Commit

Permalink
staging: rtl8188eu: re-use hex_to_bin() instead of custom code
Browse files Browse the repository at this point in the history
hex_to_bin could be used to convert hexdecimal digit to its binary
representation.

Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: navin patidar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
andy-shev authored and gregkh committed Jul 10, 2014
1 parent 529a929 commit 5737369
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
17 changes: 0 additions & 17 deletions drivers/staging/rtl8188eu/core/rtw_ieee80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1067,23 +1067,6 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len,
return unknown ? ParseUnknown : ParseOK;
}

u8 key_char2num(u8 ch)
{
if ((ch >= '0') && (ch <= '9'))
return ch - '0';
else if ((ch >= 'a') && (ch <= 'f'))
return ch - 'a' + 10;
else if ((ch >= 'A') && (ch <= 'F'))
return ch - 'A' + 10;
else
return 0xff;
}

u8 str_2char2num(u8 hch, u8 lch)
{
return (key_char2num(hch) * 10) + key_char2num(lch);
}

void rtw_macaddr_cfg(u8 *mac_addr)
{
u8 mac[ETH_ALEN];
Expand Down
3 changes: 0 additions & 3 deletions drivers/staging/rtl8188eu/include/wlan_bssdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,4 @@ struct ndis_802_11_cap {
struct ndis_802_11_auth_encrypt AuthenticationEncryptionSupported[1];
};

u8 key_char2num(u8 ch);
u8 str_2char2num(u8 hch, u8 lch);

#endif /* ifndef WLAN_BSSDEF_H_ */
6 changes: 3 additions & 3 deletions drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -2697,7 +2697,7 @@ static int rtw_p2p_set_intent(struct net_device *dev,
intent = extra[0] - '0';
break;
case 2:
intent = str_2char2num(extra[0], extra[1]);
intent = hex_to_bin(extra[0]) * 10 + hex_to_bin(extra[1]);
break;
}
if (intent <= 15)
Expand All @@ -2722,7 +2722,7 @@ static int rtw_p2p_set_listen_ch(struct net_device *dev,
listen_ch = extra[0] - '0';
break;
case 2:
listen_ch = str_2char2num(extra[0], extra[1]);
listen_ch = hex_to_bin(extra[0]) * 10 + hex_to_bin(extra[1]);
break;
}

Expand Down Expand Up @@ -2755,7 +2755,7 @@ static int rtw_p2p_set_op_ch(struct net_device *dev,
op_ch = extra[0] - '0';
break;
case 2:
op_ch = str_2char2num(extra[0], extra[1]);
op_ch = hex_to_bin(extra[0]) * 10 + hex_to_bin(extra[1]);
break;
}

Expand Down

0 comments on commit 5737369

Please sign in to comment.