staging: rtl8188eu: refactor cckratesonly_included()
authorMichael Straube <straube.linux@gmail.com>
Wed, 5 Dec 2018 18:30:50 +0000 (19:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Dec 2018 15:12:18 +0000 (16:12 +0100)
Refactor cckratesonly_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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_wlan_util.c
drivers/staging/rtl8188eu/include/rtw_mlme_ext.h

index 90160d5..fac1c1c 100644 (file)
@@ -69,16 +69,16 @@ bool cckrates_included(unsigned char *rate, int ratelen)
        return false;
 }
 
-int cckratesonly_included(unsigned char *rate, int ratelen)
+bool 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;
        }
-
        return true;
 }
 
index c86dec1..0ade33d 100644 (file)
@@ -581,7 +581,7 @@ void addba_timer_hdl(struct timer_list *t);
                  msecs_to_jiffies(ms))
 
 bool cckrates_included(unsigned char *rate, int ratelen);
-int cckratesonly_included(unsigned char *rate, int ratelen);
+bool cckratesonly_included(unsigned char *rate, int ratelen);
 
 void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);