From: Michael Straube Date: Wed, 5 Dec 2018 18:30:49 +0000 (+0100) Subject: staging: rtl8188eu: refactor cckrates_included() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3101957f4a108a4abdce99c3ccb4f54b84605f49;p=openwrt%2Fstaging%2Fblogic.git staging: rtl8188eu: refactor cckrates_included() Refactor cckrates_included() to improve readability and slightly reduce object file size. Also change the return type to bool. Signed-off-by: Michael Straube Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 24918223499b..90160d5fc292 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -56,13 +56,14 @@ static u8 rtw_basic_rate_mix[7] = { IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK }; -int cckrates_included(unsigned char *rate, int ratelen) +bool cckrates_included(unsigned char *rate, int ratelen) { - int i; + int i; for (i = 0; i < ratelen; i++) { - if ((((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || - (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22)) + u8 r = rate[i] & 0x7f; + + if (r == 2 || r == 4 || r == 11 || r == 22) return true; } return false; diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h index 9526da3efcc4..c86dec12dec2 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h @@ -580,7 +580,7 @@ void addba_timer_hdl(struct timer_list *t); mod_timer(&mlmeext->link_timer, jiffies + \ msecs_to_jiffies(ms)) -int cckrates_included(unsigned char *rate, int ratelen); +bool cckrates_included(unsigned char *rate, int ratelen); int cckratesonly_included(unsigned char *rate, int ratelen); void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);