staging: rtl8723bs: remove unused code
PATCH 1/5 staging: rtl8723bs: remove unused code
Remove commented rtw_is_cckrates_included() and rtw_is_cckratesonly_included() from os_dep/ioctl_linux.c. Both are defined in core/rtw_ieee80211.c.
--- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 32 ------------------- 1 file changed, 32 deletions(-)
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -32
@@ -79,38 +79,6 @@ void rtw_indicate_wx_disassoc_event(struct adapter *padapter)eth_zero_addr (wrqu.ap_addr.sa_data); } -/* -uint rtw_is_cckrates_included(u8 *rate) -{ -u32 i = 0; - -while (rate[i]!= 0) -{ -if ((((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || -(((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22)) -return true; -i++; -} - -return false; -} - -uint rtw_is_cckratesonly_included(u8 *rate) -{ -u32 i = 0; - -while (rate[i]!= 0) -{ -if ((((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) && -(((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22)) -return false; -i++; -} - -return true; -} -*/ -static char *translate_scan (struct adapter *padapter,struct iw_request_info * info,struct wlan_network *pnetwork,char *start,char *stop)
Signature · 1 line
2.18.0
PATCH 2/5 staging: rtl8723bs: refactor rtw_is_cckrates_included()
Refactor rtw_is_cckrates_included() to improve readability and slightly reduce object file size.
--- drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +4 -5
@@ -68,13 +68,12 @@ int rtw_get_bit_value_from_ieee_value(u8 val)uint rtw_is_cckrates_included (u8 *rate) { -u32 i =0 ; +while (*rate) { +u8 r = *rate &0x7f ; -while (rate[i] !=0 ) { -if ((((rate[i]) &0x7f ) ==2 ) || (((rate[i]) &0x7f ) ==4 ) || - (((rate[i]) &0x7f ) ==11 ) || (((rate[i]) &0x7f ) ==22 )) +if (r ==2 || r ==4 || r ==11 || r ==22 )return true; - i++; + rate++; }return false;
Signature · 1 line
2.18.0
PATCH 3/5 staging: rtl8723bs: refactor rtw_is_cckratesonly_included
In reply to Michael StraubeRefactor rtw_is_cckratesonly_included() to improve readability and slightly reduce object file size.
--- drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +4 -5
@@ -81,13 +81,12 @@ uint rtw_is_cckrates_included(u8 *rate)uint rtw_is_cckratesonly_included (u8 *rate) { -u32 i =0 ; +while (*rate) { +u8 r = *rate &0x7f ; -while (rate[i] !=0 ) { -if ((((rate[i]) &0x7f ) !=2 ) && (((rate[i]) &0x7f ) !=4 ) && - (((rate[i]) &0x7f ) !=11 ) && (((rate[i]) &0x7f ) !=22 )) +if (r !=2 && r !=4 && r !=11 && r !=22 )return false; - i++; + rate++; }return true;
Signature · 1 line
2.18.0
PATCH 4/5 staging: rtl8723bs: change return type to bool
In reply to Michael StraubeBoth rtw_is_cckrates_included() and rtw_is_cckratesonly_included() return true or false. Change the return type from uint to bool.
--- drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++-- drivers/staging/rtl8723bs/include/ieee80211.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +2 -2
@@ -66,7 +66,7 @@ int rtw_get_bit_value_from_ieee_value(u8 val)return 0 ; } -uint rtw_is_cckrates_included (u8 *rate) +bool rtw_is_cckrates_included (u8 *rate) {while (*rate) {u8 r = *rate &0x7f ;
@@ -79,7 +79,7 @@ uint rtw_is_cckrates_included(u8 *rate)return false; } -uint rtw_is_cckratesonly_included (u8 *rate) +bool rtw_is_cckratesonly_included (u8 *rate) {while (*rate) {u8 r = *rate &0x7f ;
drivers/staging/rtl8723bs/include/ieee80211.h +2 -2
@@ -1169,9 +1169,9 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv);int rtw_get_bit_value_from_ieee_value (u8 val); -uint rtw_is_cckrates_included (u8 *rate); +bool rtw_is_cckrates_included (u8 *rate); -uint rtw_is_cckratesonly_included (u8 *rate); +bool rtw_is_cckratesonly_included (u8 *rate);int rtw_check_network_type (unsigned char *rate,int ratelen,int channel);
Signature · 1 line
2.18.0
PATCH 5/5 staging: rtl8723bs: fix comparsions to true
In reply to Michael StraubeUse if(x) instead of if(x == true).
--- .../staging/rtl8723bs/core/rtw_ieee80211.c | 6 ++-- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 28 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +3 -3
@@ -95,14 +95,14 @@ bool rtw_is_cckratesonly_included(u8 *rate)int rtw_check_network_type (unsigned char *rate,int ratelen,int channel) {if (channel >14 ) { -if ((rtw_is_cckrates_included (rate)) == true) +if (rtw_is_cckrates_included (rate))return WIRELESS_INVALID ;else return WIRELESS_11A ; }else {/* could be pure B, pure G, or B/G */ -if ((rtw_is_cckratesonly_included (rate)) == true) +if (rtw_is_cckratesonly_included (rate))return WIRELESS_11B ; -else if ((rtw_is_cckrates_included (rate)) == true) +else if (rtw_is_cckrates_included (rate))return WIRELESS_11BG ;else return WIRELESS_11G ;
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +14 -14
@@ -126,26 +126,26 @@ static char *translate_scan(struct adapter *padapter,/* Add the protocol name */ iwe.cmd =SIOCGIWNAME ; -if ((rtw_is_cckratesonly_included ((u8 *)&pnetwork->network.SupportedRates)) == true) { -if (ht_cap == true) +if (rtw_is_cckratesonly_included ((u8 *)&pnetwork->network.SupportedRates)) { +if (ht_cap)snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11bn" );else snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11b" ); - }else if ((rtw_is_cckrates_included ((u8 *)&pnetwork->network.SupportedRates)) == true) { -if (ht_cap == true) + }else if (rtw_is_cckrates_included ((u8 *)&pnetwork->network.SupportedRates)) { +if (ht_cap)snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11bgn" );else snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11bg" ); }else {if (pnetwork->network.Configuration.DSConfig >14 ) { -if (vht_cap == true) +if (vht_cap)snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11AC" ); -else if (ht_cap == true) +else if (ht_cap)snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11an" );else snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11a" ); }else { -if (ht_cap == true) +if (ht_cap)snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11gn" );else snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11g" );
@@ -785,26 +785,26 @@ static int rtw_wx_get_name(struct net_device *dev, prates = &pcur_bss->SupportedRates; -if (rtw_is_cckratesonly_included ((u8 *)prates) == true) { -if (ht_cap == true) +if (rtw_is_cckratesonly_included ((u8 *)prates)) { +if (ht_cap)snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11bn" );else snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11b" ); - }else if ((rtw_is_cckrates_included ((u8 *)prates)) == true) { -if (ht_cap == true) + }else if (rtw_is_cckrates_included ((u8 *)prates)) { +if (ht_cap)snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11bgn" );else snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11bg" ); }else {if (pcur_bss->Configuration.DSConfig >14 ) { -if (vht_cap == true) +if (vht_cap)snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11AC" ); -else if (ht_cap == true) +else if (ht_cap)snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11an" );else snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11a" ); }else { -if (ht_cap == true) +if (ht_cap)snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11gn" );else snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11g" );
Signature · 1 line
2.18.0