public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/12] staging: rtl8188eu: refactor cckrates_included()
@ 2018-12-05 17:02 Michael Straube
  2018-12-05 17:02 ` [PATCH 02/12] staging: rtl8188eu: refactor cckratesonly_included() Michael Straube
                   ` (10 more replies)
  0 siblings, 11 replies; 14+ messages in thread
From: Michael Straube @ 2018-12-05 17:02 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Michael Straube

Refactor cckrates_included() to improve readability and slightly
reduce object file size. Also change the return type to bool.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c   | 9 +++++----
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

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);
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-12-05 18:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-05 17:02 [PATCH 01/12] staging: rtl8188eu: refactor cckrates_included() Michael Straube
2018-12-05 17:02 ` [PATCH 02/12] staging: rtl8188eu: refactor cckratesonly_included() Michael Straube
2018-12-05 17:02 ` [PATCH 03/12] staging: rtl8188eu: simplify array initializations Michael Straube
2018-12-05 17:02 ` [PATCH 04/12] staging: rtl8188eu: remove unnecessary parentheses in rtw_wlan_util.c Michael Straube
2018-12-05 17:02 ` [PATCH 05/12] staging: rtl8188eu: cleanup declarations " Michael Straube
2018-12-05 17:02 ` [PATCH 06/12] staging: rtl8188eu: cleanup block comment " Michael Straube
2018-12-05 17:02 ` [PATCH 07/12] staging: rtl8188eu: cleanup long lines " Michael Straube
2018-12-05 17:02 ` [PATCH 08/12] staging: rtl8188eu: add spaces around operators " Michael Straube
2018-12-05 17:02 ` [PATCH 09/12] staging: rtl8188eu: write out multiplying in wifirate2_ratetbl_inx() Michael Straube
2018-12-05 17:02 ` [PATCH 10/12] staging: rtl8188eu: correct indentation in update_wireless_mode() Michael Straube
2018-12-05 17:37   ` Joe Perches
2018-12-05 18:36     ` Michael Straube
2018-12-05 17:02 ` [PATCH 11/12] staging: rtl8188eu: rename struct field Wifi_Error_Status Michael Straube
2018-12-05 17:02 ` [PATCH 12/12] staging: rtl8188eu: remove unused code in rtw_cmd.c Michael Straube

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox