All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] staging: rtl8723bs: refactor cckrates{only}_included
@ 2020-09-12  8:45 ` Michael Straube
  0 siblings, 0 replies; 16+ messages in thread
From: Michael Straube @ 2020-09-12  8:45 UTC (permalink / raw)
  To: gregkh; +Cc: hdegoede, Larry.Finger, devel, linux-kernel, Michael Straube

Refactor cckrates_included() and cckratesonly_included() to simplify
the code and improve readability.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index a5790a648a5b..4e0d86b2e2e0 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -56,11 +56,12 @@ static u8 rtw_basic_rate_ofdm[3] = {
 
 int 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;
 	}
 
@@ -69,11 +70,12 @@ int cckrates_included(unsigned char *rate, int ratelen)
 
 int cckratesonly_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 false;
 	}
 
-- 
2.28.0


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

end of thread, other threads:[~2020-09-13  8:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-12  8:45 [PATCH 1/5] staging: rtl8723bs: refactor cckrates{only}_included Michael Straube
2020-09-12  8:45 ` Michael Straube
2020-09-12  8:45 ` [PATCH 2/5] staging: rtl8723bs: make cckrates{only}_included static Michael Straube
2020-09-12  8:45   ` Michael Straube
2020-09-12  8:45 ` [PATCH 3/5] staging: rtl8723bs: convert cckrates{only}_included to bool Michael Straube
2020-09-12  8:45   ` Michael Straube
2020-09-12  8:45 ` [PATCH 4/5] staging: rtl8723bs: remove comparsions to true Michael Straube
2020-09-12  8:45   ` Michael Straube
2020-09-12  8:45 ` [PATCH 5/5] staging: rtl8723bs: remove 5 GHz code Michael Straube
2020-09-12  8:45   ` Michael Straube
2020-09-12 18:22 ` [PATCH 1/5] staging: rtl8723bs: refactor cckrates{only}_included Joe Perches
2020-09-12 18:22   ` Joe Perches
2020-09-12 18:43   ` Joe Perches
2020-09-12 18:43     ` Joe Perches
2020-09-13  8:16   ` Michael Straube
2020-09-13  8:16     ` Michael Straube

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.