[PATCH 2/2] staging: rtl8188eu: rename parameters of odm_phy_status_query()

2021-03-06 Thread Michael Straube
Rename parameters of odm_phy_status_query() to avoid camel case.

pDM_Odm -> dm_odm
pPhyInfo -> phy_info
pPhyStatus -> phy_status
pPktinfo -> pkt_info

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/odm_hwconfig.c | 9 -
 drivers/staging/rtl8188eu/include/odm_hwconfig.h | 8 
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/odm_hwconfig.c 
b/drivers/staging/rtl8188eu/hal/odm_hwconfig.c
index c5af0c559cba..684b6cec0f09 100644
--- a/drivers/staging/rtl8188eu/hal/odm_hwconfig.c
+++ b/drivers/staging/rtl8188eu/hal/odm_hwconfig.c
@@ -386,13 +386,12 @@ static void odm_Process_RSSIForDM(struct odm_dm_struct 
*dm_odm,
 
 /*  Endianness before calling this API */
 void odm_phy_status_query(struct odm_dm_struct *dm_odm,
- struct odm_phy_status_info *pPhyInfo,
- u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo)
+ struct odm_phy_status_info *phy_info,
+ u8 *phy_status, struct odm_per_pkt_info *pkt_info)
 {
-   odm_RxPhyStatus92CSeries_Parsing(dm_odm, pPhyInfo, pPhyStatus,
-pPktinfo);
+   odm_RxPhyStatus92CSeries_Parsing(dm_odm, phy_info, phy_status, 
pkt_info);
if (dm_odm->RSSI_test)
;/*  Select the packets to do RSSI checking for antenna 
switching. */
else
-   odm_Process_RSSIForDM(dm_odm, pPhyInfo, pPktinfo);
+   odm_Process_RSSIForDM(dm_odm, phy_info, pkt_info);
 }
diff --git a/drivers/staging/rtl8188eu/include/odm_hwconfig.h 
b/drivers/staging/rtl8188eu/include/odm_hwconfig.h
index dc86e4058eff..4f4d3cfb6c77 100644
--- a/drivers/staging/rtl8188eu/include/odm_hwconfig.h
+++ b/drivers/staging/rtl8188eu/include/odm_hwconfig.h
@@ -93,9 +93,9 @@ struct phy_status_rpt {
 #endif
 };
 
-void odm_phy_status_query(struct odm_dm_struct *pDM_Odm,
- struct odm_phy_status_info *pPhyInfo,
- u8 *pPhyStatus,
- struct odm_per_pkt_info *pPktinfo);
+void odm_phy_status_query(struct odm_dm_struct *dm_odm,
+ struct odm_phy_status_info *phy_info,
+ u8 *phy_status,
+ struct odm_per_pkt_info *pkt_info);
 
 #endif
-- 
2.30.1



[PATCH 1/2] staging: rtl8188eu: rename ODM_PhyStatusQuery()

2021-03-06 Thread Michael Straube
Rename ODM_PhyStatusQuery() to odm_phy_status_query() to avoid camel
case.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/odm_hwconfig.c | 6 +++---
 drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c  | 4 ++--
 drivers/staging/rtl8188eu/include/odm_hwconfig.h | 8 
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/odm_hwconfig.c 
b/drivers/staging/rtl8188eu/hal/odm_hwconfig.c
index 65a346ae3cb0..c5af0c559cba 100644
--- a/drivers/staging/rtl8188eu/hal/odm_hwconfig.c
+++ b/drivers/staging/rtl8188eu/hal/odm_hwconfig.c
@@ -385,9 +385,9 @@ static void odm_Process_RSSIForDM(struct odm_dm_struct 
*dm_odm,
 }
 
 /*  Endianness before calling this API */
-void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,
-   struct odm_phy_status_info *pPhyInfo,
-   u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo)
+void odm_phy_status_query(struct odm_dm_struct *dm_odm,
+ struct odm_phy_status_info *pPhyInfo,
+ u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo)
 {
odm_RxPhyStatus92CSeries_Parsing(dm_odm, pPhyInfo, pPhyStatus,
 pPktinfo);
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c
index 7d0135fde795..0d06cb54b1ad 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c
@@ -171,8 +171,8 @@ void update_recvframe_phyinfo_88e(struct recv_frame 
*precvframe,
pkt_info.StationID = psta->mac_id;
pkt_info.Rate = pattrib->mcs_rate;
 
-   ODM_PhyStatusQuery(>HalData->odmpriv, pPHYInfo,
-  (u8 *)pphy_status, &(pkt_info));
+   odm_phy_status_query(>HalData->odmpriv, pPHYInfo,
+(u8 *)pphy_status, &(pkt_info));
 
precvframe->psta = NULL;
if (pkt_info.bPacketMatchBSSID &&
diff --git a/drivers/staging/rtl8188eu/include/odm_hwconfig.h 
b/drivers/staging/rtl8188eu/include/odm_hwconfig.h
index 2cd8a47a3673..dc86e4058eff 100644
--- a/drivers/staging/rtl8188eu/include/odm_hwconfig.h
+++ b/drivers/staging/rtl8188eu/include/odm_hwconfig.h
@@ -93,9 +93,9 @@ struct phy_status_rpt {
 #endif
 };
 
-void ODM_PhyStatusQuery(struct odm_dm_struct *pDM_Odm,
-   struct odm_phy_status_info *pPhyInfo,
-   u8 *pPhyStatus,
-   struct odm_per_pkt_info *pPktinfo);
+void odm_phy_status_query(struct odm_dm_struct *pDM_Odm,
+ struct odm_phy_status_info *pPhyInfo,
+ u8 *pPhyStatus,
+ struct odm_per_pkt_info *pPktinfo);
 
 #endif
-- 
2.30.1



[PATCH] staging: rtl8723bs: clean up brace coding style issues

2020-12-22 Thread Michael Straube
Add missing braces around else arm of if else statement to clear
style issues reported by checkpatch.

CHECK: braces {} should be used on all arms of this statement
CHECK: Unbalanced braces around else statement

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_efuse.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c 
b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index 32ca10f01413..a6c43bc4f62a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -245,8 +245,9 @@ u16 Address)
break;
}
return rtw_read8(Adapter, EFUSE_CTRL);
-   } else
+   } else {
return 0xFF;
+   }
 
 } /* EFUSE_Read1Byte */
 
-- 
2.29.2



[PATCH] staging: rtl8188eu: remove commented defines

2020-10-27 Thread Michael Straube
Remove commented defines from ioctl_linux.c. They are included from
include/uapi/linux/wireless.h. Also clears a checkpatch warning.

WARNING: Block comments use * on subsequent lines

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 6ac904ceb95e..6f42f13a71fa 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -906,17 +906,6 @@ static int rtw_wx_get_range(struct net_device *dev,
 /*  If the driver doesn't provide this capability to network manager, */
 /*  the WPA/WPA2 routers can't be chosen in the network manager. */
 
-/*
-#define IW_SCAN_CAPA_NONE  0x00
-#define IW_SCAN_CAPA_ESSID 0x01
-#define IW_SCAN_CAPA_BSSID 0x02
-#define IW_SCAN_CAPA_CHANNEL   0x04
-#define IW_SCAN_CAPA_MODE  0x08
-#define IW_SCAN_CAPA_RATE  0x10
-#define IW_SCAN_CAPA_TYPE  0x20
-#define IW_SCAN_CAPA_TIME  0x40
-*/
-
range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
  IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
 
-- 
2.29.0



[PATCH 5/8] staging: rtl8188eu: rename struct field bUsed -> used

2020-09-29 Thread Michael Straube
Rename field of struct rt_pmkid_list to avoid camel case.

bUsed -> used

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c| 2 +-
 drivers/staging/rtl8188eu/include/rtw_security.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c   | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index d34d46506b50..668a24f25fce 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1672,7 +1672,7 @@ static int SecIsInPMKIDList(struct adapter *Adapter, u8 
*bssid)
int i = 0;
 
do {
-   if ((psecuritypriv->PMKIDList[i].bUsed) &&
+   if ((psecuritypriv->PMKIDList[i].used) &&
(!memcmp(psecuritypriv->PMKIDList[i].bssid, bssid, 
ETH_ALEN)))
break;
} while (++i < NUM_PMKID_CACHE);
diff --git a/drivers/staging/rtl8188eu/include/rtw_security.h 
b/drivers/staging/rtl8188eu/include/rtw_security.h
index 737f1da81f6b..d08a8d8adccf 100644
--- a/drivers/staging/rtl8188eu/include/rtw_security.h
+++ b/drivers/staging/rtl8188eu/include/rtw_security.h
@@ -81,7 +81,7 @@ union Keytype {
 };
 
 struct rt_pmkid_list {
-   u8  bUsed;
+   u8  used;
u8  bssid[ETH_ALEN];
u8  PMKID[16];
u8  SsidBuf[33];
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 9919413b6f7e..8e10462f1fbe 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -782,7 +782,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
/*  BSSID is matched, the same AP => rewrite 
with new PMKID. */
DBG_88E("[%s] BSSID exists in the PMKList.\n", 
__func__);
memcpy(psecuritypriv->PMKIDList[j].PMKID, 
pPMK->pmkid, IW_PMKID_LEN);
-   psecuritypriv->PMKIDList[j].bUsed = true;
+   psecuritypriv->PMKIDList[j].used = true;
psecuritypriv->PMKIDIndex = j + 1;
blInserted = true;
break;
@@ -797,7 +797,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,

memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bssid, 
strIssueBssid, ETH_ALEN);

memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pPMK->pmkid, 
IW_PMKID_LEN);
 
-   
psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = true;
+   
psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].used = true;
psecuritypriv->PMKIDIndex++;
if (psecuritypriv->PMKIDIndex == 16)
psecuritypriv->PMKIDIndex = 0;
@@ -809,7 +809,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
if (!memcmp(psecuritypriv->PMKIDList[j].bssid, 
strIssueBssid, ETH_ALEN)) {
/*  BSSID is matched, the same AP => Remove 
this PMKID information and reset it. */

eth_zero_addr(psecuritypriv->PMKIDList[j].bssid);
-   psecuritypriv->PMKIDList[j].bUsed = false;
+   psecuritypriv->PMKIDList[j].used = false;
break;
}
}
-- 
2.28.0



[PATCH 3/8] staging: rtl8188eu: rename struct field Bssid -> bssid

2020-09-29 Thread Michael Straube
Rename field of struct rt_pmkid_list to avoid camel case.

Bssid -> bssid

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c| 2 +-
 drivers/staging/rtl8188eu/include/rtw_security.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c   | 8 
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 5256817ee12a..d34d46506b50 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1673,7 +1673,7 @@ static int SecIsInPMKIDList(struct adapter *Adapter, u8 
*bssid)
 
do {
if ((psecuritypriv->PMKIDList[i].bUsed) &&
-   (!memcmp(psecuritypriv->PMKIDList[i].Bssid, bssid, 
ETH_ALEN)))
+   (!memcmp(psecuritypriv->PMKIDList[i].bssid, bssid, 
ETH_ALEN)))
break;
} while (++i < NUM_PMKID_CACHE);
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_security.h 
b/drivers/staging/rtl8188eu/include/rtw_security.h
index 5f418003647b..bfa080d6a1a9 100644
--- a/drivers/staging/rtl8188eu/include/rtw_security.h
+++ b/drivers/staging/rtl8188eu/include/rtw_security.h
@@ -82,7 +82,7 @@ union Keytype {
 
 struct rt_pmkid_list {
u8  bUsed;
-   u8  Bssid[6];
+   u8  bssid[6];
u8  PMKID[16];
u8  SsidBuf[33];
u8  *ssid_octet;
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 7fd8582ba353..9919413b6f7e 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -778,7 +778,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
 
/* overwrite PMKID */
for (j = 0; j < NUM_PMKID_CACHE; j++) {
-   if (!memcmp(psecuritypriv->PMKIDList[j].Bssid, 
strIssueBssid, ETH_ALEN)) {
+   if (!memcmp(psecuritypriv->PMKIDList[j].bssid, 
strIssueBssid, ETH_ALEN)) {
/*  BSSID is matched, the same AP => rewrite 
with new PMKID. */
DBG_88E("[%s] BSSID exists in the PMKList.\n", 
__func__);
memcpy(psecuritypriv->PMKIDList[j].PMKID, 
pPMK->pmkid, IW_PMKID_LEN);
@@ -794,7 +794,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
DBG_88E("[%s] Use the new entry index = %d for this 
PMKID.\n",
__func__, psecuritypriv->PMKIDIndex);
 
-   
memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, 
strIssueBssid, ETH_ALEN);
+   
memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bssid, 
strIssueBssid, ETH_ALEN);

memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pPMK->pmkid, 
IW_PMKID_LEN);
 

psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = true;
@@ -806,9 +806,9 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
DBG_88E("[%s] IW_PMKSA_REMOVE!\n", __func__);
ret = true;
for (j = 0; j < NUM_PMKID_CACHE; j++) {
-   if (!memcmp(psecuritypriv->PMKIDList[j].Bssid, 
strIssueBssid, ETH_ALEN)) {
+   if (!memcmp(psecuritypriv->PMKIDList[j].bssid, 
strIssueBssid, ETH_ALEN)) {
/*  BSSID is matched, the same AP => Remove 
this PMKID information and reset it. */
-   
eth_zero_addr(psecuritypriv->PMKIDList[j].Bssid);
+   
eth_zero_addr(psecuritypriv->PMKIDList[j].bssid);
psecuritypriv->PMKIDList[j].bUsed = false;
break;
}
-- 
2.28.0



[PATCH 8/8] staging: rtl8188eu: clean up indent style issue

2020-09-29 Thread Michael Straube
Replace spaces with tab to clear checkpatch error.

ERROR: code indent should use tabs where possible

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 668a24f25fce..14be5a703615 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1730,7 +1730,7 @@ int rtw_restruct_sec_ie(struct adapter *adapter, u8 
*in_ie, u8 *out_ie, uint in_
(ndisauthmode == Ndis802_11AuthModeWPAPSK))
authmode = _WPA_IE_ID_;
else if ((ndisauthmode == Ndis802_11AuthModeWPA2) ||
-(ndisauthmode == Ndis802_11AuthModeWPA2PSK))
+(ndisauthmode == Ndis802_11AuthModeWPA2PSK))
authmode = _WPA2_IE_ID_;
else
authmode = 0x0;
-- 
2.28.0



[PATCH 4/8] staging: rtl8188eu: use ETH_ALEN

2020-09-29 Thread Michael Straube
Use ETH_ALEN instead of hard coded array size.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/include/rtw_security.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_security.h 
b/drivers/staging/rtl8188eu/include/rtw_security.h
index bfa080d6a1a9..737f1da81f6b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_security.h
+++ b/drivers/staging/rtl8188eu/include/rtw_security.h
@@ -82,7 +82,7 @@ union Keytype {
 
 struct rt_pmkid_list {
u8  bUsed;
-   u8  bssid[6];
+   u8  bssid[ETH_ALEN];
u8  PMKID[16];
u8  SsidBuf[33];
u8  *ssid_octet;
-- 
2.28.0



[PATCH 7/8] staging: rtl8188eu: remove unused variable ratelen

2020-09-29 Thread Michael Straube
After the removal of cckrates_included() and cckrates_only_included()
from rtw_wlan_util.c the variable/parameter 'ratelen' is unused now.
Remove it from update_wireless_mode() and judge_network_type().

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c   | 6 ++
 drivers/staging/rtl8188eu/hal/usb_halinit.c  | 4 ++--
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index bf7dd13dde03..8e8f1721b1a2 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -76,7 +76,7 @@ unsigned char networktype_to_raid(unsigned char network_type)
}
 }
 
-u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int 
ratelen)
+u8 judge_network_type(struct adapter *padapter, unsigned char *rate)
 {
u8 network_type = 0;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
@@ -1321,15 +1321,13 @@ void update_capinfo(struct adapter *Adapter, u16 
updateCap)
 
 void update_wireless_mode(struct adapter *padapter)
 {
-   int ratelen, network_type = 0;
+   int network_type = 0;
u32 SIFS_Timer;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = >mlmext_info;
struct wlan_bssid_ex *cur_network = >network;
unsigned char *rate = cur_network->SupportedRates;
 
-   ratelen = rtw_get_rateset_len(cur_network->SupportedRates);
-
if (pmlmeinfo->HT_info_enable && pmlmeinfo->HT_caps_enable)
pmlmeinfo->HT_enable = 1;
 
diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 5e7bb22d7d01..abe58cf2de16 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -1893,7 +1893,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 
mac_id, u8 rssi_level)
switch (mac_id) {
case 0:/*  for infra mode */
supportRateNum = 
rtw_get_rateset_len(cur_network->SupportedRates);
-   networkType = judge_network_type(adapt, 
cur_network->SupportedRates, supportRateNum) & 0xf;
+   networkType = judge_network_type(adapt, 
cur_network->SupportedRates) & 0xf;
raid = networktype_to_raid(networkType);
mask = update_supported_rate(cur_network->SupportedRates, 
supportRateNum);
mask |= (pmlmeinfo->HT_enable) ? 
update_MSC_rate(>HT_caps) : 0;
@@ -1911,7 +1911,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 
mac_id, u8 rssi_level)
break;
default: /* for each sta in IBSS */
supportRateNum = 
rtw_get_rateset_len(pmlmeinfo->FW_sta_info[mac_id].SupportedRates);
-   networkType = judge_network_type(adapt, 
pmlmeinfo->FW_sta_info[mac_id].SupportedRates, supportRateNum) & 0xf;
+   networkType = judge_network_type(adapt, 
pmlmeinfo->FW_sta_info[mac_id].SupportedRates) & 0xf;
raid = networktype_to_raid(networkType);
mask = update_supported_rate(cur_network->SupportedRates, 
supportRateNum);
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 713e23229ef5..b11a6886a083 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -448,7 +448,7 @@ void init_addba_retry_timer(struct adapter *adapt, struct 
sta_info *sta);
 struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv);
 
 unsigned char networktype_to_raid(unsigned char network_type);
-u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int len);
+u8 judge_network_type(struct adapter *padapter, unsigned char *rate);
 void get_rate_set(struct adapter *padapter, unsigned char *pbssrate, int *len);
 void UpdateBrateTbl(struct adapter *padapter, u8 *mBratesOS);
 void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen);
-- 
2.28.0



[PATCH 6/8] staging: rtl8188eu: remove cckrates{only}_included()

2020-09-29 Thread Michael Straube
In rtw_ieee80211.c there are rtw_is_cckrates_included() and
rtw_is_cckratesonly_included() which have the same functionality as
cckrates_included() and cckrates_only_included() defined in
rtw_wlan_util.c. Remove the functions from rtw_wlan_util.c and use
those from rtw_ieee80211.c.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 34 +++
 .../staging/rtl8188eu/include/rtw_mlme_ext.h  |  3 --
 2 files changed, 4 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index efe1f1ba7acf..bf7dd13dde03 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -53,32 +53,6 @@ static const u8 rtw_basic_rate_mix[7] = {
IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
 };
 
-bool cckrates_included(unsigned char *rate, int ratelen)
-{
-   int i;
-
-   for (i = 0; i < ratelen; i++) {
-   u8 r = rate[i] & 0x7f;
-
-   if (r == 2 || r == 4 || r == 11 || r == 22)
-   return true;
-   }
-   return false;
-}
-
-bool cckratesonly_included(unsigned char *rate, int ratelen)
-{
-   int i;
-
-   for (i = 0; i < ratelen; i++) {
-   u8 r = rate[i] & 0x7f;
-
-   if (r != 2 && r != 4 && r != 11 && r != 22)
-   return false;
-   }
-   return true;
-}
-
 unsigned char networktype_to_raid(unsigned char network_type)
 {
switch (network_type) {
@@ -111,9 +85,9 @@ u8 judge_network_type(struct adapter *padapter, unsigned 
char *rate, int ratelen
if (pmlmeinfo->HT_enable)
network_type = WIRELESS_11_24N;
 
-   if (cckratesonly_included(rate, ratelen))
+   if (rtw_is_cckratesonly_included(rate))
network_type |= WIRELESS_11B;
-   else if (cckrates_included(rate, ratelen))
+   else if (rtw_is_cckrates_included(rate))
network_type |= WIRELESS_11BG;
else
network_type |= WIRELESS_11G;
@@ -1362,9 +1336,9 @@ void update_wireless_mode(struct adapter *padapter)
if (pmlmeinfo->HT_enable)
network_type = WIRELESS_11_24N;
 
-   if (cckratesonly_included(rate, ratelen))
+   if (rtw_is_cckratesonly_included(rate))
network_type |= WIRELESS_11B;
-   else if (cckrates_included(rate, ratelen))
+   else if (rtw_is_cckrates_included(rate))
network_type |= WIRELESS_11BG;
else
network_type |= WIRELESS_11G;
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 565bfe46256c..713e23229ef5 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -568,9 +568,6 @@ void addba_timer_hdl(struct timer_list *t);
mod_timer(>link_timer, jiffies +   \
  msecs_to_jiffies(ms))
 
-bool cckrates_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);
 
 void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len);
-- 
2.28.0



[PATCH 2/8] staging: rtl8188eu: clean up comparsions to NULL

2020-09-29 Thread Michael Straube
Clean up remaining comparsions to NULL reported by checkpatch.
x == NULL -> !x
x != NULL -> x

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_security.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c 
b/drivers/staging/rtl8188eu/core/rtw_security.c
index b7a8c199de54..46ba55a8952a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_security.c
+++ b/drivers/staging/rtl8188eu/core/rtw_security.c
@@ -142,7 +142,7 @@ void rtw_wep_encrypt(struct adapter *padapter, struct 
xmit_frame *pxmitframe)
struct sk_buff *skb;
struct lib80211_crypto_ops *crypto_ops;
 
-   if (pxmitframe->buf_addr == NULL)
+   if (!pxmitframe->buf_addr)
return;
 
if ((pattrib->encrypt != _WEP40_) && (pattrib->encrypt != _WEP104_))
@@ -589,7 +589,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, struct 
xmit_frame *pxmitframe)
struct  xmit_priv   *pxmitpriv = >xmitpriv;
u32 res = _SUCCESS;
 
-   if (pxmitframe->buf_addr == NULL)
+   if (!pxmitframe->buf_addr)
return _FAIL;
 
hw_hdr_offset = TXDESC_SIZE +
@@ -602,7 +602,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, struct 
xmit_frame *pxmitframe)
else
stainfo = rtw_get_stainfo(>stapriv, 
>ra[0]);
 
-   if (stainfo != NULL) {
+   if (stainfo) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: 
stainfo!= NULL!!!\n", __func__));
 
if (is_multicast_ether_addr(pattrib->ra))
@@ -834,7 +834,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, struct 
recv_frame *precvframe)
if (prxattrib->encrypt == _AES_) {
struct sta_info *stainfo = rtw_get_stainfo(>stapriv, 
>ta[0]);
 
-   if (stainfo != NULL) {
+   if (stainfo) {
int key_idx;
const int key_length = 16, iv_len = 8, icv_len = 8;
struct sk_buff *skb = precvframe->pkt;
-- 
2.28.0



[PATCH 1/8] staging: rtl8188eu: remove unused macros and definitions

2020-09-29 Thread Michael Straube
Removep unused macros and definitions from rtw_security.h leftover
from previous cleanup patches.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/include/rtw_security.h  | 58 ---
 1 file changed, 58 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_security.h 
b/drivers/staging/rtl8188eu/include/rtw_security.h
index 8ba02a7cea60..5f418003647b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_security.h
+++ b/drivers/staging/rtl8188eu/include/rtw_security.h
@@ -228,64 +228,6 @@ struct mic_data {
u32  nBytesInM;  /*  # bytes in M */
 };
 
-extern const u32 Te0[256];
-extern const u32 Td0[256];
-extern const u32 Td1[256];
-extern const u32 Td2[256];
-extern const u32 Td3[256];
-extern const u32 Td4[256];
-extern const u32 rcon[10];
-extern const u8 Td4s[256];
-extern const u8 rcons[10];
-
-#define RCON(i) (rcons[(i)] << 24)
-
-static inline u32 rotr(u32 val, int bits)
-{
-   return (val >> bits) | (val << (32 - bits));
-}
-
-#define TE0(i) Te0[((i) >> 24) & 0xff]
-#define TE1(i) rotr(Te0[((i) >> 16) & 0xff], 8)
-#define TE2(i) rotr(Te0[((i) >> 8) & 0xff], 16)
-#define TE3(i) rotr(Te0[(i) & 0xff], 24)
-
-/* = start - public domain SHA256 implementation = */
-
-/* This is based on SHA256 implementation in LibTomCrypt that was released into
- * public domain by Tom St Denis.
- */
-
-/* the K array */
-static const unsigned long K[64] = {
-   0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL,
-   0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL,
-   0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL,
-   0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
-   0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL,
-   0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL,
-   0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL,
-   0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
-   0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL,
-   0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL,
-   0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL,
-   0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
-   0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
-};
-
-/* Various logical functions */
-#define RORc(x, y) \
-   (unsigned long)(x) & 0xUL) >> (unsigned long)((y) & 31)) | \
-((unsigned long)(x) << (unsigned long)(32 - ((y) & 31 & 
0xUL)
-#define Ch(x, y, z)   (z ^ (x & (y ^ z)))
-#define Maj(x, y, z)  (((x | y) & z) | (x & y))
-#define S(x, n) RORc((x), (n))
-#define R(x, n) (((x) & 0xUL) >> (n))
-#define Sigma0(x)   (S(x, 2) ^ S(x, 13) ^ S(x, 22))
-#define Sigma1(x)   (S(x, 6) ^ S(x, 11) ^ S(x, 25))
-#define Gamma0(x)   (S(x, 7) ^ S(x, 18) ^ R(x, 3))
-#define Gamma1(x)   (S(x, 17) ^ S(x, 19) ^ R(x, 10))
-
 void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key);
 void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b);
 void rtw_secmicappend(struct mic_data *pmicdata, u8 *src, u32 nBytes);
-- 
2.28.0



[PATCH v2] staging: rtl8188eu: Reapply "staging:r8188eu: Use lib80211 to encrypt (CCMP) tx frames"

2020-09-27 Thread Michael Straube
Commit 515ce733e86e ("staging:r8188eu: Use lib80211 to encrypt (CCMP) tx 
frames")
was reverted because it caused scheduling while atomic bugs and hard
freezes. Experimentation showed that there were no freezes and no BUG
messages logged when lib80211_get_crypto_ops() was called directly
rather than indirectly through try_then_request_module().

Reapply "staging:r8188eu: Use lib80211 to encrypt (CCMP) tx frames"
with resolved revert conflicts and replace try_then_request_module()
with direct call to lib80211_get_crypto_ops().

Original commit message:
Put data to skb, decrypt with lib80211_crypt_ccmp, and place back to tx buffer.

Cc: Ivan Safonov 
Signed-off-by: Michael Straube 
---

v1 -> v2:
Added missing spaces around '+' and removed unnecessary parentheses.

if ((curfragnum+1) == pattrib->nr_frags)

if (curfragnum + 1 == pattrib->nr_frags)

 drivers/staging/rtl8188eu/core/rtw_security.c | 778 ++
 1 file changed, 72 insertions(+), 706 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c 
b/drivers/staging/rtl8188eu/core/rtw_security.c
index d2d562550eb7..b7a8c199de54 100644
--- a/drivers/staging/rtl8188eu/core/rtw_security.c
+++ b/drivers/staging/rtl8188eu/core/rtw_security.c
@@ -722,552 +722,106 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, struct 
recv_frame *precvframe)
return res;
 }
 
-/* 3   = AES related = */
-
-#define MAX_MSG_SIZE   2048
-/*/
-/ SBOX Table */
-/*/
-
-static const u8 sbox_table[256] = {
-   0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
-   0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
-   0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
-   0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
-   0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc,
-   0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
-   0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a,
-   0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
-   0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0,
-   0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
-   0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b,
-   0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
-   0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85,
-   0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
-   0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5,
-   0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
-   0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17,
-   0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
-   0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88,
-   0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
-   0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c,
-   0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
-   0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9,
-   0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
-   0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6,
-   0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
-   0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e,
-   0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
-   0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94,
-   0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
-   0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68,
-   0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
-};
-
-/*/
-/ Function Prototypes /
-/*/
-
-static void bitwise_xor(u8 *ina, u8 *inb, u8 *out);
-static void construct_mic_iv(u8 *mic_header1, int qc_exists, int a4_exists, u8 
*mpdu, uint payload_length, u8 *pn_vector);
-static void construct_mic_header1(u8 *mic_header1, int header_length, u8 
*mpdu);
-static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, 
int qc_exists);
-static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int 
qc_exists, u8 *mpdu, u8 *pn_vector, int c);
-static void xor_128(u8 *a, u8 *b, u8 *out);
-static void xor_32(u8 *a, u8 *b, u8 *out);
-static u8 sbox(u8 a);
-static void next_key(u8 *key, int round);
-static void byte_sub(u8 *in, u8 *out);
-static void shift_row(u8 *in, u8 *out);
-static void mix_column(u8 *in, u8 *out);
-static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext);
-
-//
-/* aes128k128d()   */
-/* Performs a 128 bit AES encrypt with  */
-/* 128 bit data.   */
-//
-static void xor_128(u8 *a, u8 *b, u8 *out)
-{
-   int i;
-
-   for (i = 0; i < 16; i++)
-   out[i] = a[i] ^ b[i];
-}
-
-static void xor_32(u8 *a, u8 *b, u8 *out)
-{
-   int i;
-
-   for (i = 0; i < 4; i++)
-   out[i] = a[i] ^ b[i];
-}
-
-static u8 sbox(u8 a)
-{
-   return sbox_table[(int)a];
-}
-
-static void next_key(u8 *key, int round)
-{
-   u8 rcon;
-   u8 sbox_key[4];
- 

[PATCH] staging: rtl8188eu: Reapply "staging:r8188eu: Use lib80211 to encrypt (CCMP) tx frames"

2020-09-26 Thread Michael Straube
Commit 515ce733e86e ("staging:r8188eu: Use lib80211 to encrypt (CCMP) tx 
frames")
was reverted because it caused scheduling while atomic bugs and hard
freezes. Experimentation showed that there were no freezes and no BUG
messages logged when lib80211_get_crypto_ops() was called directly
rather than indirectly through try_then_request_module().

Reapply "staging:r8188eu: Use lib80211 to encrypt (CCMP) tx frames"
with resolved revert conflicts and replace try_then_request_module()
with direct call to lib80211_get_crypto_ops().

Original commit message:
Put data to skb, decrypt with lib80211_crypt_ccmp, and place back to tx buffer.

Cc: Ivan Safonov 
Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_security.c | 778 ++
 1 file changed, 72 insertions(+), 706 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c 
b/drivers/staging/rtl8188eu/core/rtw_security.c
index d2d562550eb7..b3850efccaa0 100644
--- a/drivers/staging/rtl8188eu/core/rtw_security.c
+++ b/drivers/staging/rtl8188eu/core/rtw_security.c
@@ -722,552 +722,106 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, struct 
recv_frame *precvframe)
return res;
 }
 
-/* 3   = AES related = */
-
-#define MAX_MSG_SIZE   2048
-/*/
-/ SBOX Table */
-/*/
-
-static const u8 sbox_table[256] = {
-   0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
-   0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
-   0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
-   0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
-   0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc,
-   0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
-   0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a,
-   0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
-   0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0,
-   0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
-   0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b,
-   0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
-   0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85,
-   0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
-   0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5,
-   0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
-   0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17,
-   0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
-   0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88,
-   0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
-   0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c,
-   0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
-   0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9,
-   0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
-   0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6,
-   0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
-   0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e,
-   0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
-   0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94,
-   0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
-   0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68,
-   0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
-};
-
-/*/
-/ Function Prototypes /
-/*/
-
-static void bitwise_xor(u8 *ina, u8 *inb, u8 *out);
-static void construct_mic_iv(u8 *mic_header1, int qc_exists, int a4_exists, u8 
*mpdu, uint payload_length, u8 *pn_vector);
-static void construct_mic_header1(u8 *mic_header1, int header_length, u8 
*mpdu);
-static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, 
int qc_exists);
-static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int 
qc_exists, u8 *mpdu, u8 *pn_vector, int c);
-static void xor_128(u8 *a, u8 *b, u8 *out);
-static void xor_32(u8 *a, u8 *b, u8 *out);
-static u8 sbox(u8 a);
-static void next_key(u8 *key, int round);
-static void byte_sub(u8 *in, u8 *out);
-static void shift_row(u8 *in, u8 *out);
-static void mix_column(u8 *in, u8 *out);
-static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext);
-
-//
-/* aes128k128d()   */
-/* Performs a 128 bit AES encrypt with  */
-/* 128 bit data.   */
-//
-static void xor_128(u8 *a, u8 *b, u8 *out)
-{
-   int i;
-
-   for (i = 0; i < 16; i++)
-   out[i] = a[i] ^ b[i];
-}
-
-static void xor_32(u8 *a, u8 *b, u8 *out)
-{
-   int i;
-
-   for (i = 0; i < 4; i++)
-   out[i] = a[i] ^ b[i];
-}
-
-static u8 sbox(u8 a)
-{
-   return sbox_table[(int)a];
-}
-
-static void next_key(u8 *key, int round)
-{
-   u8 rcon;
-   u8 sbox_key[4];
-   static const u8 rcon_table[12] = {
-   0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
-   0x1b, 0x36, 0x36, 0x36
-   };
-
-   sbox_key[0] = sbox(key[13]);

[PATCH 3/3] staging: rtl8192u: clean up comparsions to NULL

2020-09-19 Thread Michael Straube
Clean up comparsions to NULL reported by checkpatch.
if (x == NULL) -> if (!x)
if (x != NULL) -> if (x)

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8192u/r8192U_wx.c | 6 +++---
 drivers/staging/rtl8192u/r819xU_cmdpkt.c | 4 ++--
 drivers/staging/rtl8192u/r819xU_phy.c| 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_wx.c 
b/drivers/staging/rtl8192u/r8192U_wx.c
index 1d1685d2e908..d853586705fc 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.c
+++ b/drivers/staging/rtl8192u/r8192U_wx.c
@@ -250,7 +250,7 @@ static int rtl8180_wx_get_range(struct net_device *dev,
/* range->old_num_channels; */
/* range->old_num_frequency; */
/* range->old_freq[6]; */ /* Filler to keep "version" at the same 
offset */
-   if (priv->rf_set_sens != NULL)
+   if (priv->rf_set_sens)
range->sensitivity = priv->max_sens;/* signal level 
threshold range */
 
range->max_qual.qual = 100;
@@ -666,7 +666,7 @@ static int r8192_wx_get_sens(struct net_device *dev,
 {
struct r8192_priv *priv = ieee80211_priv(dev);
 
-   if (priv->rf_set_sens == NULL)
+   if (!priv->rf_set_sens)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
@@ -680,7 +680,7 @@ static int r8192_wx_set_sens(struct net_device *dev,
short err = 0;
 
mutex_lock(>wx_mutex);
-   if (priv->rf_set_sens == NULL) {
+   if (!priv->rf_set_sens) {
err = -1; /* we have not this support for this radio */
goto exit;
}
diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c 
b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
index c58c9cac2599..4cece40a92f6 100644
--- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c
+++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
@@ -430,7 +430,7 @@ static void cmpk_handle_tx_rate_history(struct net_device 
*dev, u8 *pmsg)
 
ptxrate = (cmpk_tx_rahis_t *)pmsg;
 
-   if (ptxrate == NULL)
+   if (!ptxrate)
return;
 
for (i = 0; i < 16; i++) {
@@ -479,7 +479,7 @@ u32 cmpk_message_handle_rx(struct net_device *dev,
/* 0. Check inpt arguments. It is a command queue message or
 * pointer is null.
 */
-   if (pstats == NULL)
+   if (!pstats)
return 0;   /* This is not a command packet. */
 
/* 1. Read received command packet message length from RFD. */
diff --git a/drivers/staging/rtl8192u/r819xU_phy.c 
b/drivers/staging/rtl8192u/r819xU_phy.c
index aa71ea97a179..eef751d2b12e 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -1150,7 +1150,7 @@ static u8 rtl8192_phy_SetSwChnlCmdArray(struct 
sw_chnl_cmd *CmdTable, u32 CmdTab
 {
struct sw_chnl_cmd *pCmd;
 
-   if (CmdTable == NULL) {
+   if (!CmdTable) {
RT_TRACE(COMP_ERR, "%s(): CmdTable cannot be NULL\n", __func__);
return false;
}
-- 
2.28.0



[PATCH 1/3] staging: rtl8192u: clean up blank line style issues

2020-09-19 Thread Michael Straube
Add missing and remove unnecessary blank lines to clear checkpatch
issues.

CHECK: Please use a blank line after function/struct/union/enum declarations
CHECK: Blank lines aren't necessary before a close brace '}'
CHECK: Please don't use multiple blank lines
CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8192u/r8192U_dm.c  | 12 +--
 drivers/staging/rtl8192u/r8192U_hw.h  |  1 +
 drivers/staging/rtl8192u/r8192U_wx.c  | 31 ++-
 drivers/staging/rtl8192u/r819xU_cmdpkt.c  |  1 -
 drivers/staging/rtl8192u/r819xU_firmware.c|  6 
 .../staging/rtl8192u/r819xU_firmware_img.h|  3 --
 drivers/staging/rtl8192u/r819xU_phy.c | 28 -
 drivers/staging/rtl8192u/r819xU_phyreg.h  |  3 --
 8 files changed, 4 insertions(+), 81 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 6b301acb584e..bac402b40121 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -26,6 +26,7 @@ Major Change History:
 static u32 edca_setting_DL[HT_IOT_PEER_MAX] = {
0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0x00a44f, 0x5ea44f
 };
+
 static u32 edca_setting_UL[HT_IOT_PEER_MAX] = {
0x5e4322, 0x00a44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f
 };
@@ -599,7 +600,6 @@ static void dm_TXPowerTrackingCallback_TSSI(struct 
net_device *dev)
priv->rfa_txpowertrackingindex++;
priv->rfa_txpowertrackingindex_real++;
rtl8192_setBBreg(dev, 
rOFDM0_XATxIQImbalance, bMaskDWord, 
priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
-
}
}
priv->cck_present_attenuation_difference
@@ -1268,7 +1268,6 @@ static void dm_InitializeTXPowerTracking_TSSI(struct 
net_device *dev)
priv->btxpower_tracking = true;
priv->txpower_count   = 0;
priv->btxpower_trackingInit = false;
-
 }
 
 static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev)
@@ -1773,7 +1772,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
/* 1.5 Higher EDCCA. */
/*PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 
0x325);*/
return;
-
}
 
/* 2. When RSSI increase, We have to judge if it is larger than a 
threshold
@@ -1836,7 +1834,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
 
/* 2.5 DIG On. */
rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1);   /*  Only clear 
byte 1 and rewrite. */
-
}
 
dm_ctrl_initgain_byrssi_highpwr(dev);
@@ -2157,7 +2154,6 @@ static void dm_check_edca_turbo(
write_nic_dword(dev, EDCAPARA_BE, 
edca_setting_UL[pHTInfo->IOTPeer]);
priv->bis_cur_rdlstate = false;
}
-
}
 
priv->bcurrent_turbo_EDCA = true;
@@ -2191,7 +2187,6 @@ static void dm_check_edca_turbo(
 
write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
 
-
/* Check ACM bit.
 * If it is set, immediately set ACM control bit to 
downgrading AC for passing WMM testplan. Annie, 2005-12-13.
 */
@@ -2296,7 +2291,6 @@ staticvoiddm_check_pbc_gpio(struct net_device 
*dev)
RT_TRACE(COMP_IO, "CheckPbcGPIO - PBC is pressed\n");
priv->bpbc_pressed = true;
}
-
 }
 
 /*-
@@ -2495,7 +2489,6 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
cck_rx_ver2_min_index = i;
}
}
-
}
}
}
@@ -2715,7 +2708,6 @@ static void dm_EndSWFsync(struct net_device *dev)
 
priv->ContinueDiffCount = 0;
write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd);
-
 }
 
 static void dm_StartSWFsync(struct net_device *dev)
@@ -2751,7 +2743,6 @@ static void dm_StartSWFsync(struct net_device *dev)
add_timer(>fsync_timer);
 
write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cd);
-
 }
 
 static void dm_EndHWFsync(struct net_device *dev)
@@ -2759,7 +2750,6 @@ static void dm_EndHWFsync(struct net_device *dev)
RT_TRACE(COMP_HALDM, "%s\n", __func__);
write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd);
write_nic_byte(dev, 0xc3b, 0x49);
-
 }
 
 void dm_check_fsync(struct net_device *dev)
diff --git a/drivers/staging/rtl8192u/r8192U_hw.h 
b/drivers/staging/rtl8192u/r8192U_hw.h
index 95a2d2ee3c65..8d3a592f1c35 1

[PATCH 2/3] staging: rtl8192u: correct placement of else if

2020-09-19 Thread Michael Straube
Move 'else if' to the same line as the closing brace of the
corresponding 'if' to follow kernel coding style.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8192u/r8192U_wx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_wx.c 
b/drivers/staging/rtl8192u/r8192U_wx.c
index 4ac0baf8be83..1d1685d2e908 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.c
+++ b/drivers/staging/rtl8192u/r8192U_wx.c
@@ -561,9 +561,7 @@ static int r8192_wx_set_enc(struct net_device *dev,
zero_addr[key_idx],
0,  /* DefaultKey */
hwkey); /* KeyContent */
-   }
-
-   else if (wrqu->encoding.length == 0xd) {
+   } else if (wrqu->encoding.length == 0xd) {
ieee->pairwise_key_type = KEY_TYPE_WEP104;
EnableHWSecurityConfig8192(dev);
 
-- 
2.28.0



[PATCH 2/2] staging: rtl8188eu: clean up alignment style issues

2020-09-19 Thread Michael Straube
Clean up alignment style issues to follow kernel coding style
and clear checkpatch issues.

CHECK: Alignment should match open parenthesis

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c |   2 +-
 drivers/staging/rtl8188eu/hal/phy.c   |  21 ++--
 drivers/staging/rtl8188eu/hal/rf_cfg.c|   3 +-
 .../staging/rtl8188eu/hal/rtl8188e_hal_init.c |   2 +-
 drivers/staging/rtl8188eu/hal/usb_halinit.c   |   4 +-
 .../staging/rtl8188eu/os_dep/ioctl_linux.c| 114 +-
 .../staging/rtl8188eu/os_dep/rtw_android.c|   4 +-
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   |  27 +++--
 8 files changed, 87 insertions(+), 90 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 4e2b1ee59981..5256817ee12a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1730,7 +1730,7 @@ int rtw_restruct_sec_ie(struct adapter *adapter, u8 
*in_ie, u8 *out_ie, uint in_
(ndisauthmode == Ndis802_11AuthModeWPAPSK))
authmode = _WPA_IE_ID_;
else if ((ndisauthmode == Ndis802_11AuthModeWPA2) ||
-   (ndisauthmode == Ndis802_11AuthModeWPA2PSK))
+(ndisauthmode == Ndis802_11AuthModeWPA2PSK))
authmode = _WPA2_IE_ID_;
else
authmode = 0x0;
diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index 8d1267bf0848..a970189ba8c6 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -51,8 +51,7 @@ void phy_set_bb_reg(struct adapter *adapt, u32 regaddr, u32 
bitmask, u32 data)
usb_write32(adapt, regaddr, data);
 }
 
-static u32 rf_serial_read(struct adapter *adapt,
-   enum rf_radio_path rfpath, u32 offset)
+static u32 rf_serial_read(struct adapter *adapt, enum rf_radio_path rfpath, 
u32 offset)
 {
u32 ret = 0;
struct bb_reg_def *phyreg = >HalData->PHYRegDef[rfpath];
@@ -107,7 +106,7 @@ static void rf_serial_write(struct adapter *adapt,
 }
 
 u32 rtw_hal_read_rfreg(struct adapter *adapt, enum rf_radio_path rf_path,
-u32 reg_addr, u32 bit_mask)
+  u32 reg_addr, u32 bit_mask)
 {
u32 original_value, bit_shift;
 
@@ -117,7 +116,7 @@ u32 rtw_hal_read_rfreg(struct adapter *adapt, enum 
rf_radio_path rf_path,
 }
 
 void phy_set_rf_reg(struct adapter *adapt, enum rf_radio_path rf_path,
-u32 reg_addr, u32 bit_mask, u32 data)
+   u32 reg_addr, u32 bit_mask, u32 data)
 {
u32 original_value, bit_shift;
 
@@ -190,7 +189,7 @@ void phy_set_tx_power_level(struct adapter *adapt, u8 
channel)
 
rtl88eu_phy_rf6052_set_cck_txpower(adapt, _pwr[0]);
rtl88eu_phy_rf6052_set_ofdm_txpower(adapt, _pwr[0], _pwr[0],
- _pwr[0], channel);
+   _pwr[0], channel);
 }
 
 static void phy_set_bw_mode_callback(struct adapter *adapt)
@@ -236,11 +235,11 @@ static void phy_set_bw_mode_callback(struct adapter 
*adapt)
 * These settings are required only for 40MHz
 */
phy_set_bb_reg(adapt, rCCK0_System, bCCKSideBand,
-   (hal_data->nCur40MhzPrimeSC >> 1));
+  (hal_data->nCur40MhzPrimeSC >> 1));
phy_set_bb_reg(adapt, rOFDM1_LSTF, 0xC00,
   hal_data->nCur40MhzPrimeSC);
phy_set_bb_reg(adapt, 0x818, (BIT(26) | BIT(27)),
-  (hal_data->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) 
? 2 : 1);
+  (hal_data->nCur40MhzPrimeSC == 
HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1);
break;
default:
break;
@@ -251,7 +250,7 @@ static void phy_set_bw_mode_callback(struct adapter *adapt)
 }
 
 void rtw_hal_set_bwmode(struct adapter *adapt, enum ht_channel_width bandwidth,
-unsigned char offset)
+   unsigned char offset)
 {
struct hal_data_8188e *hal_data = adapt->HalData;
enum ht_channel_width tmp_bw = hal_data->CurrentChannelBW;
@@ -437,7 +436,7 @@ void 
rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
thermal_val = (u8)(thermal_avg / thermal_avg_count);
 
if (dm_odm->RFCalibrateInfo.bDoneTxpower &&
-   !dm_odm->RFCalibrateInfo.bReloadtxpowerindex) {
+   !dm_odm->RFCalibrateInfo.bReloadtxpowerindex) {
delta = abs(thermal_val - 
dm_odm->RFCalibrateInfo.ThermalValue);
} else {
delta = abs(thermal_val - hal_data->EEPROMThermalMeter);
@@ -1149,12 +1148,12 @@ static void phy_lc_calibrate(struct adapter *adapt, 
bool is2t)

[PATCH 1/2] staging: rtl8188eu: clean up block comment style issues

2020-09-19 Thread Michael Straube
Clean up block comment style issues to follow kernel coding style
and clear checkpatch warnings.

WARNING: Block comments should align the * on each line
WARNING: Block comments use a trailing */ on a separate line
WARNING: Block comments use * on subsequent lines

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c  |  6 +++---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c  | 12 +++-
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c   | 10 +-
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 10 --
 drivers/staging/rtl8188eu/os_dep/usb_intf.c| 11 ++-
 5 files changed, 21 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index d334dc335914..4e2b1ee59981 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1894,9 +1894,9 @@ unsigned int rtw_restructure_ht_ie(struct adapter 
*padapter, u8 *in_ie, u8 *out_
rtw_hal_get_def_var(padapter, HAL_DEF_MAX_RECVBUF_SZ, 
_recvbuf_sz);
 
/*
-   ampdu_params_info [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 
3:64k
-   ampdu_params_info [4:2]:Min MPDU Start Spacing
-   */
+* ampdu_params_info [1:0]:Max AMPDU Len => 0:8k , 1:16k, 
2:32k, 3:64k
+* ampdu_params_info [4:2]:Min MPDU Start Spacing
+*/
 
rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, 
_rx_ampdu_factor);
ht_cap.ampdu_params_info = max_rx_ampdu_factor & 0x03;
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 4df790c83d9f..1befd297f0b9 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -19,9 +19,7 @@
 
 static u8 null_addr[ETH_ALEN] = {};
 
-/**
-OUI definitions for the vendor specific IE
-***/
+/* OUI definitions for the vendor specific IE */
 const u8 RTW_WPA_OUI[] = {0x00, 0x50, 0xf2, 0x01};
 const u8 WPS_OUI[] = {0x00, 0x50, 0xf2, 0x04};
 static const u8 WMM_OUI[] = {0x00, 0x50, 0xf2, 0x02};
@@ -32,17 +30,13 @@ static const u8 WMM_PARA_OUI[] = {0x00, 0x50, 0xf2, 0x02, 
0x01, 0x01};
 const u8 WPA_TKIP_CIPHER[4] = {0x00, 0x50, 0xf2, 0x02};
 const u8 RSN_TKIP_CIPHER[4] = {0x00, 0x0f, 0xac, 0x02};
 
-/
-MCS rate definitions
-*/
+/* MCS rate definitions */
 const u8 MCS_rate_1R[16] = {
0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-/
-ChannelPlan definitions
-*/
+/* ChannelPlan definitions */
 static struct rt_channel_plan_2g RTW_ChannelPlan2G[RT_CHANNEL_DOMAIN_2G_MAX] = 
{
{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},  /*  
0x00, RT_CHANNEL_DOMAIN_2G_WORLD , Passive scan CH 12, 13 */
{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},  /*  
0x01, RT_CHANNEL_DOMAIN_2G_ETSI1 */
diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index f74753c37a29..3848e695ac84 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -530,11 +530,11 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 }
 
 /*
-* rtw_pwr_wakeup - Wake the NIC up from: 1)IPS. 2)USB autosuspend
-* @adapter: pointer to struct adapter structure
-* @ips_deffer_ms: the ms will prevent from falling into IPS after wakeup
-* Return _SUCCESS or _FAIL
-*/
+ * rtw_pwr_wakeup - Wake the NIC up from: 1)IPS. 2)USB autosuspend
+ * @adapter: pointer to struct adapter structure
+ * @ips_deffer_ms: the ms will prevent from falling into IPS after wakeup
+ * Return _SUCCESS or _FAIL
+ */
 
 int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char 
*caller)
 {
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index ba6356e0825a..152ac20918e2 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -1813,9 +1813,7 @@ static int rtw_wx_set_auth(struct net_device *dev,
 
break;
case IW_AUTH_80211_AUTH_ALG:
-   /*
-*  It's the starting point of a link layer connection using 
wpa_supplicant
-   */
+   /* It's the starting point of a link layer connection using 
wpa_supplicant */
if (check_fwstate(>mlmepriv, _FW_LINKED)) {
LeaveAllPowerSaveMode(padapter);
rtw_disassoc_cmd(padapte

[PATCH 1/2] staging: rtl8712: clean up comparsions to NULL

2020-09-19 Thread Michael Straube
Clean up comparsions to NULL Reported by checkpatch.
if (x == NULL) -> if (!x)
if (x != NULL) -> if (x)

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8712/rtl871x_cmd.c |  4 ++--
 drivers/staging/rtl8712/rtl871x_io.c  |  2 +-
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 16 ++---
 drivers/staging/rtl8712/rtl871x_mlme.c| 11 -
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c|  2 +-
 drivers/staging/rtl8712/rtl871x_recv.c| 20 
 drivers/staging/rtl8712/rtl871x_security.c|  8 +++
 drivers/staging/rtl8712/rtl871x_sta_mgt.c |  4 ++--
 drivers/staging/rtl8712/rtl871x_xmit.c| 24 +--
 drivers/staging/rtl8712/usb_intf.c|  2 +-
 10 files changed, 46 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
b/drivers/staging/rtl8712/rtl871x_cmd.c
index c7523072a660..18116469bd31 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -161,7 +161,7 @@ void r8712_free_cmd_obj(struct cmd_obj *pcmd)
if ((pcmd->cmdcode != _JoinBss_CMD_) &&
(pcmd->cmdcode != _CreateBss_CMD_))
kfree(pcmd->parmbuf);
-   if (pcmd->rsp != NULL) {
+   if (pcmd->rsp) {
if (pcmd->rspsz != 0)
kfree(pcmd->rsp);
}
@@ -191,7 +191,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,
psurveyPara->passive_mode = cpu_to_le32(pmlmepriv->passive_mode);
psurveyPara->ss_ssidlen = 0;
memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1);
-   if ((pssid != NULL) && (pssid->SsidLength)) {
+   if (pssid && pssid->SsidLength) {
memcpy(psurveyPara->ss_ssid, pssid->Ssid, pssid->SsidLength);
psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
}
diff --git a/drivers/staging/rtl8712/rtl871x_io.c 
b/drivers/staging/rtl8712/rtl871x_io.c
index 87024d6a465e..6789a4c98564 100644
--- a/drivers/staging/rtl8712/rtl871x_io.c
+++ b/drivers/staging/rtl8712/rtl871x_io.c
@@ -50,7 +50,7 @@ static uint _init_intf_hdl(struct _adapter *padapter,
init_intf_priv = _usb_init_intf_priv;
pintf_priv = pintf_hdl->pintfpriv = kmalloc(sizeof(struct intf_priv),
GFP_ATOMIC);
-   if (pintf_priv == NULL)
+   if (!pintf_priv)
goto _init_intf_hdl_fail;
pintf_hdl->adapter = (u8 *)padapter;
set_intf_option(_hdl->intf_option);
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index df6ae855f3c1..cbaa7a489748 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -481,11 +481,11 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, 
char *pie,
int group_cipher = 0, pairwise_cipher = 0;
int ret = 0;
 
-   if ((ielen > MAX_WPA_IE_LEN) || (pie == NULL))
+   if (ielen > MAX_WPA_IE_LEN || !pie)
return -EINVAL;
if (ielen) {
buf = kmemdup(pie, ielen, GFP_ATOMIC);
-   if (buf == NULL)
+   if (!buf)
return -ENOMEM;
if (ielen < RSN_HEADER_LEN) {
ret  = -EINVAL;
@@ -777,7 +777,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
  * If cmd is IW_PMKSA_REMOVE, it means the wpa_supplicant wants to
  * remove a PMKID/BSSID from driver.
  */
-   if (pPMK == NULL)
+   if (!pPMK)
return -EINVAL;
memcpy(strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN);
switch (pPMK->cmd) {
@@ -1099,7 +1099,7 @@ static int r871x_wx_set_mlme(struct net_device *dev,
struct _adapter *padapter = netdev_priv(dev);
struct iw_mlme *mlme = (struct iw_mlme *) extra;
 
-   if (mlme == NULL)
+   if (!mlme)
return -1;
switch (mlme->cmd) {
case IW_MLME_DEAUTH:
@@ -1950,7 +1950,7 @@ static int r871x_get_ap_info(struct net_device *dev,
u8 bssid[ETH_ALEN];
char data[33];
 
-   if (padapter->driver_stopped || (pdata == NULL))
+   if (padapter->driver_stopped || !pdata)
return -EINVAL;
while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY |
 _FW_UNDER_LINKING)) {
@@ -2014,7 +2014,7 @@ static int r871x_set_pid(struct net_device *dev,
struct _adapter *padapter = netdev_priv(dev);
struct iw_point *pdata = >data;
 
-   if ((padapter->driver_stopped) || (pdata == NULL))
+   if (padapter->driver_stopped || !pdata)
return -EINVAL;
if (copy_from_user(>pid, pdata->pointer, sizeof(int)))
return -EINVAL;
@@ -2030,7 +2030,7 @@ static int r871x_set_chplan(struct n

[PATCH 2/2] staging: rtl8712: use shorter array initializations

2020-09-19 Thread Michael Straube
Use empty brace syntax to initialize zero valued arrays.
Simplifies and shortens the code a little bit.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8712/rtl871x_xmit.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c 
b/drivers/staging/rtl8712/rtl871x_xmit.c
index 7093903b3af1..fd99782a400a 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -352,7 +352,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
struct  pkt_attrib  *pattrib = >attrib;
struct  security_priv *psecpriv = >securitypriv;
struct  xmit_priv *pxmitpriv = >xmitpriv;
-   u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
+   u8 priority[4] = {};
bool bmcst = is_multicast_ether_addr(pattrib->ra);
 
if (pattrib->psta)
@@ -363,9 +363,8 @@ static int xmitframe_addmic(struct _adapter *padapter,
if (pattrib->encrypt == _TKIP_) {
/*encode mic code*/
if (stainfo) {
-   u8 null_key[16] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-  0x0, 0x0};
+   u8 null_key[16] = {};
+
pframe = pxmitframe->buf_addr + TXDESC_OFFSET;
if (bmcst) {
if (!memcmp(psecpriv->XGrptxmickey
-- 
2.28.0



[PATCH 1/2] staging: rtl8188eu: use __func__ in hal directory

2020-09-17 Thread Michael Straube
Use __func__ instead of hardcoded function names to clear
checkpatch warnings.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/hal_intf.c  |  4 +-
 drivers/staging/rtl8188eu/hal/odm.c   | 60 +--
 drivers/staging/rtl8188eu/hal/phy.c   |  2 +-
 drivers/staging/rtl8188eu/hal/pwrseqcmd.c | 25 
 .../staging/rtl8188eu/hal/rtl8188e_hal_init.c |  2 +-
 .../staging/rtl8188eu/hal/rtl8188eu_xmit.c|  2 +-
 drivers/staging/rtl8188eu/hal/usb_halinit.c   |  5 +-
 7 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal_intf.c 
b/drivers/staging/rtl8188eu/hal/hal_intf.c
index b8fecc952cfc..9585dffc63a3 100644
--- a/drivers/staging/rtl8188eu/hal/hal_intf.c
+++ b/drivers/staging/rtl8188eu/hal/hal_intf.c
@@ -23,7 +23,7 @@ uint rtw_hal_init(struct adapter *adapt)
rtw_hal_notch_filter(adapt, 1);
} else {
adapt->hw_init_completed = false;
-   DBG_88E("rtw_hal_init: hal__init fail\n");
+   DBG_88E("%s: hal__init fail\n", __func__);
}
 
RT_TRACE(_module_hal_init_c_, _drv_err_,
@@ -41,7 +41,7 @@ uint rtw_hal_deinit(struct adapter *adapt)
if (status == _SUCCESS)
adapt->hw_init_completed = false;
else
-   DBG_88E("\n rtw_hal_deinit: hal_init fail\n");
+   DBG_88E("\n %s: hal_init fail\n", __func__);
 
return status;
 }
diff --git a/drivers/staging/rtl8188eu/hal/odm.c 
b/drivers/staging/rtl8188eu/hal/odm.c
index edc278e5744f..d6c4c7d023d1 100644
--- a/drivers/staging/rtl8188eu/hal/odm.c
+++ b/drivers/staging/rtl8188eu/hal/odm.c
@@ -249,7 +249,7 @@ void odm_CommonInfoSelfUpdate(struct odm_dm_struct *pDM_Odm)
 
 void odm_CmnInfoInit_Debug(struct odm_dm_struct *pDM_Odm)
 {
-   ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("odm_CmnInfoInit_Debug==>\n"));
+   ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("%s==>\n", 
__func__));
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("SupportPlatform=%d\n", pDM_Odm->SupportPlatform));
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("SupportAbility=0x%x\n", pDM_Odm->SupportAbility));
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("SupportInterface=%d\n", pDM_Odm->SupportInterface));
@@ -267,7 +267,7 @@ void odm_CmnInfoInit_Debug(struct odm_dm_struct *pDM_Odm)
 
 void odm_CmnInfoHook_Debug(struct odm_dm_struct *pDM_Odm)
 {
-   ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("odm_CmnInfoHook_Debug==>\n"));
+   ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("%s==>\n", 
__func__));
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("pNumTxBytesUnicast=%llu\n", *pDM_Odm->pNumTxBytesUnicast));
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("pNumRxBytesUnicast=%llu\n", *pDM_Odm->pNumRxBytesUnicast));
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("pWirelessMode=0x%x\n", *pDM_Odm->pWirelessMode));
@@ -282,7 +282,7 @@ void odm_CmnInfoHook_Debug(struct odm_dm_struct *pDM_Odm)
 
 void odm_CmnInfoUpdate_Debug(struct odm_dm_struct *pDM_Odm)
 {
-   ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("odm_CmnInfoUpdate_Debug==>\n"));
+   ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("%s==>\n", 
__func__));
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("bWIFI_Direct=%d\n", pDM_Odm->bWIFI_Direct));
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("bWIFI_Display=%d\n", pDM_Odm->bWIFI_Display));
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("bLinked=%d\n", 
pDM_Odm->bLinked));
@@ -339,21 +339,21 @@ void odm_DIG(struct odm_dm_struct *pDM_Odm)
u8 dm_dig_max, dm_dig_min;
u8 CurrentIGI = pDM_DigTable->CurIGValue;
 
-   ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG()==>\n"));
+   ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("%s()==>\n", 
__func__));
if ((!(pDM_Odm->SupportAbility & ODM_BB_DIG)) || 
(!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT))) {
ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD,
-("odm_DIG() Return: SupportAbility ODM_BB_DIG or 
ODM_BB_FA_CNT is disabled\n"));
+("%s() Return: SupportAbility ODM_BB_DIG or 
ODM_BB_FA_CNT is disabled\n", __func__));
return;
}
 
if (*pDM_Odm->pbScanInProcess) {
-   ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() 
Return: In Scan Progress\n"));
+   ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("%s()

[PATCH 2/2] staging: rtl8188eu: clean up comparsion style issues

2020-09-17 Thread Michael Straube
Move constants to the right side of comparsions to follow kernel
coding style and clear checkpatch warnings. In case of comparsion
to _FAIL we can use '!' since _FAIL is defined as '0'.

WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c |  6 +++---
 drivers/staging/rtl8188eu/hal/odm.c   |  4 ++--
 drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c |  2 +-
 drivers/staging/rtl8188eu/include/rtw_mlme.h  |  4 ++--
 drivers/staging/rtl8188eu/include/wifi.h  |  2 +-
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c| 10 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index dad007f78d8c..4df790c83d9f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -2981,7 +2981,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
status = _STATS_FAILURE_;
}
 
-   if (_STATS_SUCCESSFUL_ != status)
+   if (status != _STATS_SUCCESSFUL_)
goto OnAssocReqFail;
 
/*  check if the supported rate is ok */
@@ -3072,7 +3072,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
wpa_ie_len = 0;
}
 
-   if (_STATS_SUCCESSFUL_ != status)
+   if (status != _STATS_SUCCESSFUL_)
goto OnAssocReqFail;
 
pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS);
@@ -3282,7 +3282,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
spin_unlock_bh(>asoc_list_lock);
 
/*  now the station is qualified to join our BSS... */
-   if ((pstat->state & WIFI_FW_ASSOC_SUCCESS) && (_STATS_SUCCESSFUL_ == 
status)) {
+   if ((pstat->state & WIFI_FW_ASSOC_SUCCESS) && (status == 
_STATS_SUCCESSFUL_)) {
/* 1 bss_cap_update & sta_info_update */
bss_cap_update_on_sta_join(padapter, pstat);
sta_info_update(padapter, pstat);
diff --git a/drivers/staging/rtl8188eu/hal/odm.c 
b/drivers/staging/rtl8188eu/hal/odm.c
index d6c4c7d023d1..4d659a812aed 100644
--- a/drivers/staging/rtl8188eu/hal/odm.c
+++ b/drivers/staging/rtl8188eu/hal/odm.c
@@ -829,9 +829,9 @@ bool ODM_RAStateCheck(struct odm_dm_struct *pDM_Odm, s32 
RSSI, bool bForceUpdate
}
 
/*  Decide RATRState by RSSI. */
-   if (RSSI > HighRSSIThreshForRA)
+   if (HighRSSIThreshForRA < RSSI)
RATRState = DM_RATR_STA_HIGH;
-   else if (RSSI > LowRSSIThreshForRA)
+   else if (LowRSSIThreshForRA < RSSI)
RATRState = DM_RATR_STA_MIDDLE;
else
RATRState = DM_RATR_STA_LOW;
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
index e640c2256ab9..6e131202fde5 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
@@ -187,7 +187,7 @@ static s32 _LLTWrite(struct adapter *padapter, u32 address, 
u32 data)
/* polling */
do {
value = usb_read32(padapter, LLTReg);
-   if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value))
+   if (_LLT_OP_VALUE(value) == _LLT_NO_ACTIVE)
break;
 
if (count > POLLING_LLT_THRESHOLD) {
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme.h
index 010f0c42368a..1b74b32b8a81 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme.h
@@ -266,7 +266,7 @@ static inline void set_fwstate(struct mlme_priv *pmlmepriv, 
int state)
 {
pmlmepriv->fw_state |= state;
/* FOR HW integration */
-   if (_FW_UNDER_SURVEY == state)
+   if (state == _FW_UNDER_SURVEY)
pmlmepriv->bScanInProcess = true;
 }
 
@@ -274,7 +274,7 @@ static inline void _clr_fwstate_(struct mlme_priv 
*pmlmepriv, int state)
 {
pmlmepriv->fw_state &= ~state;
/* FOR HW integration */
-   if (_FW_UNDER_SURVEY == state)
+   if (state == _FW_UNDER_SURVEY)
pmlmepriv->bScanInProcess = false;
 }
 
diff --git a/drivers/staging/rtl8188eu/include/wifi.h 
b/drivers/staging/rtl8188eu/include/wifi.h
index 118e215dd6b1..a549b6d0159a 100644
--- a/drivers/staging/rtl8188eu/include/wifi.h
+++ b/drivers/staging/rtl8188eu/include/wifi.h
@@ -326,7 +326,7 @@ static inline unsigned char *get_hdr_bssid(unsigned char 
*pframe)
 
 static inline int IsFrameTypeCtrl(unsigned char *pframe)
 {
-   if (WIFI_CTRL_TYPE == GetFrameType(pframe))
+   if (GetFrameType(pframe) == WIFI_CTRL_TYPE)
return true;
else
return false;
diff --git a/drivers/staging/rtl8188eu/o

[PATCH] staging: rtl8188eu: clean up blank line style issues

2020-09-16 Thread Michael Straube
Add missing and remove unnecessary blank lines to clear the following
checkpatch issues.

WARNING: Missing a blank line after declarations
CHECK: Please use a blank line after function/struct/union/enum declarations
CHECK: Blank lines aren't necessary before a close brace '}'
CHECK: Please don't use multiple blank lines

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_security.c | 6 +-
 drivers/staging/rtl8188eu/hal/odm.c   | 1 -
 drivers/staging/rtl8188eu/hal/rf.c| 1 +
 drivers/staging/rtl8188eu/include/osdep_service.h | 1 +
 drivers/staging/rtl8188eu/include/rtl8188e_xmit.h | 1 +
 drivers/staging/rtl8188eu/include/rtw_recv.h  | 2 ++
 drivers/staging/rtl8188eu/include/wifi.h  | 1 +
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c| 1 +
 8 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c 
b/drivers/staging/rtl8188eu/core/rtw_security.c
index 78a8ac60bf3d..d2d562550eb7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_security.c
+++ b/drivers/staging/rtl8188eu/core/rtw_security.c
@@ -371,8 +371,6 @@ void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 
data_len, u8 *mic_cod
rtw_secgetmic(, mic_code);
 }
 
-
-
 /* macros for extraction/creation of unsigned char/unsigned short values  */
 #define RotR1(v16)   v16) >> 1) & 0x7FFF) ^ (((v16) & 1) << 15))
 #define   Lo8(v16)   ((u8)((v16)   & 0x00FF))
@@ -662,7 +660,6 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, struct 
recv_frame *precvframe)
u8  crc[4];
struct arc4context mycontext;
int length;
-
u8  *pframe, *payload, *iv, *prwskey;
union pn48 dot11txpn;
struct  sta_info*stainfo;
@@ -670,7 +667,6 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, struct 
recv_frame *precvframe)
struct  security_priv   *psecuritypriv = >securitypriv;
u32 res = _SUCCESS;
 
-
pframe = (unsigned char *)precvframe->pkt->data;
 
/* 4 start to decrypt recvframe */
@@ -728,7 +724,6 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, struct 
recv_frame *precvframe)
 
 /* 3   = AES related = */
 
-
 #define MAX_MSG_SIZE   2048
 /*/
 / SBOX Table */
@@ -1519,6 +1514,7 @@ const u8 Td4s[256] = {
0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U,
0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU,
 };
+
 const u8 rcons[] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36
/* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
diff --git a/drivers/staging/rtl8188eu/hal/odm.c 
b/drivers/staging/rtl8188eu/hal/odm.c
index 28974808839d..edc278e5744f 100644
--- a/drivers/staging/rtl8188eu/hal/odm.c
+++ b/drivers/staging/rtl8188eu/hal/odm.c
@@ -969,7 +969,6 @@ void ODM_TXPowerTrackingCheck(struct odm_dm_struct *pDM_Odm)
 
rtl88eu_dm_txpower_tracking_callback_thermalmeter(Adapter);
pDM_Odm->RFCalibrateInfo.TM_Trigger = 0;
-
 }
 
 /* 3 */
diff --git a/drivers/staging/rtl8188eu/hal/rf.c 
b/drivers/staging/rtl8188eu/hal/rf.c
index 6702f263c770..aab0f54a75fc 100644
--- a/drivers/staging/rtl8188eu/hal/rf.c
+++ b/drivers/staging/rtl8188eu/hal/rf.c
@@ -138,6 +138,7 @@ static void getpowerbase88e(struct adapter *adapt, u8 
*pwr_level_ofdm,
 (powerbase1 << 8) | powerbase1;
*mcs_base = powerbase1;
 }
+
 static void get_rx_power_val_by_reg(struct adapter *adapt, u8 channel,
u8 index, u32 *powerbase0, u32 *powerbase1,
u32 *out_val)
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index b44d602e954a..56e937b26407 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -69,6 +69,7 @@ void _rtw_init_queue(struct __queue *pqueue);
 struct rtw_netdev_priv_indicator {
void *priv;
 };
+
 struct net_device *rtw_alloc_etherdev_with_old_priv(void *old_priv);
 
 static inline struct adapter *rtw_netdev_priv(struct net_device *netdev)
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h
index 85efa41c8350..04efbc824fb1 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h
@@ -94,6 +94,7 @@ enum TXDESC_SC {
SC_LOWER = 0x02,
SC_DUPLICATE = 0x03
 };
+
 /* OFFSET 20 */
 #define SGIBIT(6)
 #define USB_TXAGG_NUM_SHT  24
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index b281b9e7fcea..e20bab41708a 100644
--- a/drivers/staging/

[PATCH] staging: rtl8188eu: remove extra indentations

2020-09-15 Thread Michael Straube
Remove extra indentations to follow kernel coding style and clear
checkpatch warnings.

WARNING: suspect code indent for conditional statements

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c |  6 +--
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 48 +--
 drivers/staging/rtl8188eu/hal/phy.c   | 26 +-
 drivers/staging/rtl8188eu/hal/rf_cfg.c|  4 +-
 4 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 0eaf81e83ddc..dad007f78d8c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -2599,9 +2599,9 @@ static unsigned int OnBeacon(struct adapter *padapter,
if (psta) {
ret = rtw_check_bcn_info(padapter, pframe, len);
if (!ret) {
-   DBG_88E_LEVEL(_drv_info_, "ap 
has changed, disconnect now\n ");
-   receive_disconnect(padapter, 
pmlmeinfo->network.MacAddress, 65535);
-   return _SUCCESS;
+   DBG_88E_LEVEL(_drv_info_, "ap has 
changed, disconnect now\n ");
+   receive_disconnect(padapter, 
pmlmeinfo->network.MacAddress, 65535);
+   return _SUCCESS;
}
/* update WMM, ERP in the beacon */
/* todo: the timer is used instead of the 
number of the beacon received */
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index be843fd2461a..efe1f1ba7acf 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -869,42 +869,42 @@ int rtw_check_bcn_info(struct adapter  *Adapter, u8 
*pframe, u32 packet_len)
/* parsing HT_INFO_IE */
p = rtw_get_ie(bssid->ies + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, , 
bssid->ie_length - _FIXED_IE_LENGTH_);
if (p && len > 0) {
-   pht_info = (struct HT_info_element *)(p + 2);
-   ht_info_infos_0 = pht_info->infos[0];
+   pht_info = (struct HT_info_element *)(p + 2);
+   ht_info_infos_0 = pht_info->infos[0];
} else {
-   ht_info_infos_0 = 0;
+   ht_info_infos_0 = 0;
}
if (ht_cap_info != cur_network->BcnInfo.ht_cap_info ||
((ht_info_infos_0 & 0x03) != (cur_network->BcnInfo.ht_info_infos_0 
& 0x03))) {
-   DBG_88E("%s bcn now: ht_cap_info:%x 
ht_info_infos_0:%x\n", __func__,
-   ht_cap_info, ht_info_infos_0);
-   DBG_88E("%s bcn link: ht_cap_info:%x 
ht_info_infos_0:%x\n", __func__,
-   cur_network->BcnInfo.ht_cap_info, 
cur_network->BcnInfo.ht_info_infos_0);
-   DBG_88E("%s bw mode change, disconnect\n", __func__);
-   /* bcn_info_update */
-   cur_network->BcnInfo.ht_cap_info = ht_cap_info;
-   cur_network->BcnInfo.ht_info_infos_0 = ht_info_infos_0;
-   /* to do : need to check that whether modify related 
register of BB or not */
-   /* goto _mismatch; */
+   DBG_88E("%s bcn now: ht_cap_info:%x ht_info_infos_0:%x\n", 
__func__,
+   ht_cap_info, ht_info_infos_0);
+   DBG_88E("%s bcn link: ht_cap_info:%x ht_info_infos_0:%x\n", 
__func__,
+   cur_network->BcnInfo.ht_cap_info, 
cur_network->BcnInfo.ht_info_infos_0);
+   DBG_88E("%s bw mode change, disconnect\n", __func__);
+   /* bcn_info_update */
+   cur_network->BcnInfo.ht_cap_info = ht_cap_info;
+   cur_network->BcnInfo.ht_info_infos_0 = ht_info_infos_0;
+   /* to do : need to check that whether modify related register 
of BB or not */
+   /* goto _mismatch; */
}
 
/* Checking for channel */
p = rtw_get_ie(bssid->ies + _FIXED_IE_LENGTH_, _DSSET_IE_, , 
bssid->ie_length - _FIXED_IE_LENGTH_);
if (p) {
-   bcn_channel = *(p + 2);
+   bcn_channel = *(p + 2);
} else {/* In 5G, some ap do not have DSSET IE checking HT info for 
channel */
-   p = rtw_get_ie(bssid->ies + _FIXED_IE_LENGTH_, 
_HT_ADD_INFO_IE_, , bssid->ie_length - _FIXED_IE_LENGTH_);
-   if (pht_info) 

[PATCH 1/2] staging: rtl8723bs: remove cckrates{only}_included()

2020-09-13 Thread Michael Straube
In rtw_ieee80211.c there are rtw_is_cckrates_included() and
rtw_is_cckratesonly_included() which have the same functionality as
cckrates_included() and cckrates_only_included() defined in
rtw_wlan_util.c. Remove the functions from rtw_wlan_util.c and use
those from rtw_ieee80211.c. Remove the now unused variable ratelen.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_wlan_util.c| 34 ++-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 --
 2 files changed, 3 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index a5790a648a5b..6cb779bc9410 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -54,32 +54,6 @@ static u8 rtw_basic_rate_ofdm[3] = {
IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
 };
 
-int cckrates_included(unsigned char *rate, int ratelen)
-{
-   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))
-   return true;
-   }
-
-   return false;
-}
-
-int cckratesonly_included(unsigned char *rate, int ratelen)
-{
-   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))
-   return false;
-   }
-
-   return true;
-}
-
 u8 networktype_to_raid_ex(struct adapter *adapter, struct sta_info *psta)
 {
u8 raid, cur_rf_type, rf_type = RF_1T1R;
@@ -1740,15 +1714,13 @@ void update_capinfo(struct adapter *Adapter, u16 
updateCap)
 
 void update_wireless_mode(struct adapter *padapter)
 {
-   int ratelen, network_type = 0;
+   int network_type = 0;
u32 SIFS_Timer;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct wlan_bssid_ex*cur_network = &(pmlmeinfo->network);
unsigned char   *rate = cur_network->SupportedRates;
 
-   ratelen = rtw_get_rateset_len(cur_network->SupportedRates);
-
if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable))
pmlmeinfo->HT_enable = 1;
 
@@ -1765,9 +1737,9 @@ void update_wireless_mode(struct adapter *padapter)
else if (pmlmeinfo->HT_enable)
network_type = WIRELESS_11_24N;
 
-   if ((cckratesonly_included(rate, ratelen)) == true)
+   if (rtw_is_cckratesonly_included(rate))
network_type |= WIRELESS_11B;
-   else if ((cckrates_included(rate, ratelen)) == true)
+   else if (rtw_is_cckrates_included(rate))
network_type |= WIRELESS_11BG;
else
network_type |= WIRELESS_11G;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 14583799039f..1567831caf91 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -716,8 +716,6 @@ void sa_query_timer_hdl(struct timer_list *t);
DBG_871X("%s set_sa_query_timer(%p, %d)\n", __func__, 
(mlmeext), (ms)); \
_set_timer(&(mlmeext)->sa_query_timer, (ms)); \
} while (0)
-extern int cckrates_included(unsigned char *rate, int ratelen);
-extern int cckratesonly_included(unsigned char *rate, int ratelen);
 
 extern void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 
*addr);
 
-- 
2.28.0



[PATCH 2/2] staging: rtl8723bs: remove 5 GHz code

2020-09-13 Thread Michael Straube
Acoording to the TODO code valid only for 5 GHz should be removed.

- find and remove remaining code valid only for 5 GHz. Most of the obvious
  ones have been removed, but things like channel > 14 still exist.

Remove code path only valid for channels > 14.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_wlan_util.c| 31 +++
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 6cb779bc9410..372ce17c3569 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1724,26 +1724,17 @@ void update_wireless_mode(struct adapter *padapter)
if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable))
pmlmeinfo->HT_enable = 1;
 
-   if (pmlmeext->cur_channel > 14) {
-   if (pmlmeinfo->VHT_enable)
-   network_type = WIRELESS_11AC;
-   else if (pmlmeinfo->HT_enable)
-   network_type = WIRELESS_11_5N;
-
-   network_type |= WIRELESS_11A;
-   } else {
-   if (pmlmeinfo->VHT_enable)
-   network_type = WIRELESS_11AC;
-   else if (pmlmeinfo->HT_enable)
-   network_type = WIRELESS_11_24N;
-
-   if (rtw_is_cckratesonly_included(rate))
-   network_type |= WIRELESS_11B;
-   else if (rtw_is_cckrates_included(rate))
-   network_type |= WIRELESS_11BG;
-   else
-   network_type |= WIRELESS_11G;
-   }
+   if (pmlmeinfo->VHT_enable)
+   network_type = WIRELESS_11AC;
+   else if (pmlmeinfo->HT_enable)
+   network_type = WIRELESS_11_24N;
+
+   if (rtw_is_cckratesonly_included(rate))
+   network_type |= WIRELESS_11B;
+   else if (rtw_is_cckrates_included(rate))
+   network_type |= WIRELESS_11BG;
+   else
+   network_type |= WIRELESS_11G;
 
pmlmeext->cur_wireless_mode = network_type & 
padapter->registrypriv.wireless_mode;
 
-- 
2.28.0



Re: [PATCH 1/5] staging: rtl8723bs: refactor cckrates{only}_included

2020-09-13 Thread Michael Straube




On 2020-09-12 20:22, Joe Perches wrote:

On Sat, 2020-09-12 at 10:45 +0200, Michael Straube wrote:

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

Signed-off-by: Michael Straube 
---
  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;


It would be simpler to add and use an inline like:

static bool is_cckrate(unsigned char rate)
{
rate &= 0x7f;
return rate == 2 || rate == 4 || rate == 11 || rate == 22;
}

so these could be

bool cckrates_included(unsigned char *rate, int ratelen)
{
int i;

for (i = 0; i < ratelen; i++) {
if (is_cckrate(rate[i])
return true;
}

return false;
}

bool cckratesonly_included(unsigned char *rate, int ratelen)
{
int i;

if (i <= 0)
return false;

for (i = 0; i < ratelen; i++) {
if (!is_cckrate(rate[i])
return false;
}

return true;
}




I've just seen that there are already rtw_is_cckrates_included and 
rtw_is_cckratesonly_included
in rtw_ieee80211.c that can be used here.

I will send another series removing the functions from rtw_wlan_util.c and use 
the ones from
rtw_ieee80211.c.

So please don't merge this series, thanks.

Michael



[PATCH 3/5] staging: rtl8723bs: convert cckrates{only}_included to bool

2020-09-12 Thread Michael Straube
Functions cckrates_included() and cckratesonly_included() return
boolean values. Convert the return type from int to bool.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 22e4305d70a2..7733d076af85 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -54,7 +54,7 @@ static u8 rtw_basic_rate_ofdm[3] = {
IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
 };
 
-static int cckrates_included(unsigned char *rate, int ratelen)
+static bool cckrates_included(unsigned char *rate, int ratelen)
 {
int i;
 
@@ -68,7 +68,7 @@ static int cckrates_included(unsigned char *rate, int ratelen)
return false;
 }
 
-static int cckratesonly_included(unsigned char *rate, int ratelen)
+static bool cckratesonly_included(unsigned char *rate, int ratelen)
 {
int i;
 
-- 
2.28.0



[PATCH 2/5] staging: rtl8723bs: make cckrates{only}_included static

2020-09-12 Thread Michael Straube
Functions cckrates_included() and cckratesonly_included() are used only
in the file core/rtw_wlan_util.c. Make them static and remove extern
declarations from include/rtw_mlme_ext.c.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c   | 4 ++--
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 4e0d86b2e2e0..22e4305d70a2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -54,7 +54,7 @@ static u8 rtw_basic_rate_ofdm[3] = {
IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
 };
 
-int cckrates_included(unsigned char *rate, int ratelen)
+static int cckrates_included(unsigned char *rate, int ratelen)
 {
int i;
 
@@ -68,7 +68,7 @@ int cckrates_included(unsigned char *rate, int ratelen)
return false;
 }
 
-int cckratesonly_included(unsigned char *rate, int ratelen)
+static int cckratesonly_included(unsigned char *rate, int ratelen)
 {
int i;
 
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 14583799039f..1567831caf91 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -716,8 +716,6 @@ void sa_query_timer_hdl(struct timer_list *t);
DBG_871X("%s set_sa_query_timer(%p, %d)\n", __func__, 
(mlmeext), (ms)); \
_set_timer(&(mlmeext)->sa_query_timer, (ms)); \
} while (0)
-extern int cckrates_included(unsigned char *rate, int ratelen);
-extern int cckratesonly_included(unsigned char *rate, int ratelen);
 
 extern void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 
*addr);
 
-- 
2.28.0



[PATCH 5/5] staging: rtl8723bs: remove 5 GHz code

2020-09-12 Thread Michael Straube
Acoording to the TODO code valid only for 5 GHz should be removed.

- find and remove remaining code valid only for 5 GHz. Most of the obvious
  ones have been removed, but things like channel > 14 still exist.

Remove code path only valid for channels > 14.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/core/rtw_wlan_util.c| 31 +++
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index cad35ce0c21a..fdb5a6b51c03 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1754,26 +1754,17 @@ void update_wireless_mode(struct adapter *padapter)
if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable))
pmlmeinfo->HT_enable = 1;
 
-   if (pmlmeext->cur_channel > 14) {
-   if (pmlmeinfo->VHT_enable)
-   network_type = WIRELESS_11AC;
-   else if (pmlmeinfo->HT_enable)
-   network_type = WIRELESS_11_5N;
-
-   network_type |= WIRELESS_11A;
-   } else {
-   if (pmlmeinfo->VHT_enable)
-   network_type = WIRELESS_11AC;
-   else if (pmlmeinfo->HT_enable)
-   network_type = WIRELESS_11_24N;
-
-   if (cckratesonly_included(rate, ratelen))
-   network_type |= WIRELESS_11B;
-   else if (cckrates_included(rate, ratelen))
-   network_type |= WIRELESS_11BG;
-   else
-   network_type |= WIRELESS_11G;
-   }
+   if (pmlmeinfo->VHT_enable)
+   network_type = WIRELESS_11AC;
+   else if (pmlmeinfo->HT_enable)
+   network_type = WIRELESS_11_24N;
+
+   if (cckratesonly_included(rate, ratelen))
+   network_type |= WIRELESS_11B;
+   else if (cckrates_included(rate, ratelen))
+   network_type |= WIRELESS_11BG;
+   else
+   network_type |= WIRELESS_11G;
 
pmlmeext->cur_wireless_mode = network_type & 
padapter->registrypriv.wireless_mode;
 
-- 
2.28.0



[PATCH 1/5] staging: rtl8723bs: refactor cckrates{only}_included

2020-09-12 Thread Michael Straube
Refactor cckrates_included() and cckratesonly_included() to simplify
the code and improve readability.

Signed-off-by: Michael Straube 
---
 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



[PATCH 4/5] staging: rtl8723bs: remove comparsions to true

2020-09-12 Thread Michael Straube
Remove unnecessary comparsions to boolean values.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 7733d076af85..cad35ce0c21a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1767,9 +1767,9 @@ void update_wireless_mode(struct adapter *padapter)
else if (pmlmeinfo->HT_enable)
network_type = WIRELESS_11_24N;
 
-   if ((cckratesonly_included(rate, ratelen)) == true)
+   if (cckratesonly_included(rate, ratelen))
network_type |= WIRELESS_11B;
-   else if ((cckrates_included(rate, ratelen)) == true)
+   else if (cckrates_included(rate, ratelen))
network_type |= WIRELESS_11BG;
else
network_type |= WIRELESS_11G;
-- 
2.28.0



[PATCH] staging: rtl8188eu: clean up whitespace in wpa_set_encryption()

2020-09-05 Thread Michael Straube
Clean up unnecessary whitespace in wpa_set_encryption() by removing
extra spaces and replacing tabs with spaces. Clears a checkpatch error.

ERROR: space prohibited before that close parenthesis ')'

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index dbcfdd7cae32..77ecf4fe8382 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -343,9 +343,9 @@ static int wpa_set_encryption(struct net_device *dev, 
struct ieee_param *param,
 {
int ret = 0;
u32 wep_key_idx, wep_key_len, wep_total_len;
-   struct ndis_802_11_wep   *pwep = NULL;
+   struct ndis_802_11_wep *pwep = NULL;
struct adapter *padapter = rtw_netdev_priv(dev);
-   struct mlme_priv*pmlmepriv = >mlmepriv;
+   struct mlme_priv *pmlmepriv = >mlmepriv;
struct security_priv *psecuritypriv = >securitypriv;
 
param->u.crypt.err = 0;
@@ -437,11 +437,11 @@ static int wpa_set_encryption(struct net_device *dev, 
struct ieee_param *param,
psta->ieee8021x_blocked = false;
 
if ((padapter->securitypriv.ndisencryptstatus 
== Ndis802_11Encryption2Enabled) ||
-   (padapter->securitypriv.ndisencryptstatus 
==  Ndis802_11Encryption3Enabled))
+   (padapter->securitypriv.ndisencryptstatus 
== Ndis802_11Encryption3Enabled))
psta->dot118021XPrivacy = 
padapter->securitypriv.dot11PrivacyAlgrthm;
 
if (param->u.crypt.set_tx == 1) { /* pairwise 
key */
-   memcpy(psta->dot118021x_UncstKey.skey,  
param->u.crypt.key, min_t(u16, param->u.crypt.key_len, 16));
+   memcpy(psta->dot118021x_UncstKey.skey, 
param->u.crypt.key, min_t(u16, param->u.crypt.key_len, 16));
 
if (strcmp(param->u.crypt.alg, "TKIP") 
== 0) { /* set mic key */

memcpy(psta->dot11tkiptxmickey.skey, >u.crypt.key[16], 8);
@@ -453,7 +453,7 @@ static int wpa_set_encryption(struct net_device *dev, 
struct ieee_param *param,
 
rtw_setstakey_cmd(padapter, (unsigned 
char *)psta, true);
} else { /* group key */
-   
memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey,  
param->u.crypt.key, min_t(u16, param->u.crypt.key_len, 16 ));
+   
memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, 
param->u.crypt.key, min_t(u16, param->u.crypt.key_len, 16));

memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, 
>u.crypt.key[16], 8);

memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, 
>u.crypt.key[24], 8);
padapter->securitypriv.binstallGrpkey = 
true;
@@ -473,7 +473,7 @@ static int wpa_set_encryption(struct net_device *dev, 
struct ieee_param *param,
pbcmc_sta->ieee8021x_blocked = false;
 
if ((padapter->securitypriv.ndisencryptstatus 
== Ndis802_11Encryption2Enabled) ||
-   (padapter->securitypriv.ndisencryptstatus 
==  Ndis802_11Encryption3Enabled))
+   (padapter->securitypriv.ndisencryptstatus 
== Ndis802_11Encryption3Enabled))
pbcmc_sta->dot118021XPrivacy = 
padapter->securitypriv.dot11PrivacyAlgrthm;
}
}
-- 
2.28.0



[PATCH] staging: rtl8188eu: use __func__ in os_dep

2020-08-30 Thread Michael Straube
Use __func__ instead of hardcoded function names to clear
checkpatch warnings.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/os_dep/ioctl_linux.c| 80 +--
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   | 36 -
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   | 14 ++--
 3 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 13f12edd81cd..dbcfdd7cae32 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -314,26 +314,26 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 
value)
int ret = 0;
 
if ((value & AUTH_ALG_SHARED_KEY) && (value & AUTH_ALG_OPEN_SYSTEM)) {
-   DBG_88E("wpa_set_auth_algs, AUTH_ALG_SHARED_KEY and  
AUTH_ALG_OPEN_SYSTEM [value:0x%x]\n", value);
+   DBG_88E("%s, AUTH_ALG_SHARED_KEY and  AUTH_ALG_OPEN_SYSTEM 
[value:0x%x]\n", __func__, value);
padapter->securitypriv.ndisencryptstatus = 
Ndis802_11Encryption1Enabled;
padapter->securitypriv.ndisauthtype = 
Ndis802_11AuthModeAutoSwitch;
padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Auto;
} else if (value & AUTH_ALG_SHARED_KEY) {
-   DBG_88E("wpa_set_auth_algs, AUTH_ALG_SHARED_KEY  
[value:0x%x]\n", value);
+   DBG_88E("%s, AUTH_ALG_SHARED_KEY  [value:0x%x]\n", __func__, 
value);
padapter->securitypriv.ndisencryptstatus = 
Ndis802_11Encryption1Enabled;
 
padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeShared;
padapter->securitypriv.dot11AuthAlgrthm = 
dot11AuthAlgrthm_Shared;
} else if (value & AUTH_ALG_OPEN_SYSTEM) {
-   DBG_88E("wpa_set_auth_algs, AUTH_ALG_OPEN_SYSTEM\n");
+   DBG_88E("%s, AUTH_ALG_OPEN_SYSTEM\n", __func__);
if (padapter->securitypriv.ndisauthtype < 
Ndis802_11AuthModeWPAPSK) {
padapter->securitypriv.ndisauthtype = 
Ndis802_11AuthModeOpen;
padapter->securitypriv.dot11AuthAlgrthm = 
dot11AuthAlgrthm_Open;
}
} else if (value & AUTH_ALG_LEAP) {
-   DBG_88E("wpa_set_auth_algs, AUTH_ALG_LEAP\n");
+   DBG_88E("%s, AUTH_ALG_LEAP\n", __func__);
} else {
-   DBG_88E("wpa_set_auth_algs, error!\n");
+   DBG_88E("%s, error!\n", __func__);
ret = -EINVAL;
}
return ret;
@@ -367,8 +367,8 @@ static int wpa_set_encryption(struct net_device *dev, 
struct ieee_param *param,
}
 
if (strcmp(param->u.crypt.alg, "WEP") == 0) {
-   RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, 
("wpa_set_encryption, crypt.alg = WEP\n"));
-   DBG_88E("wpa_set_encryption, crypt.alg = WEP\n");
+   RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, ("%s, crypt.alg 
= WEP\n", __func__));
+   DBG_88E("%s, crypt.alg = WEP\n", __func__);
 
padapter->securitypriv.ndisencryptstatus = 
Ndis802_11Encryption1Enabled;
padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_;
@@ -390,7 +390,7 @@ static int wpa_set_encryption(struct net_device *dev, 
struct ieee_param *param,
wep_total_len = wep_key_len + offsetof(struct 
ndis_802_11_wep, KeyMaterial);
pwep = (struct ndis_802_11_wep 
*)rtw_malloc(wep_total_len);
if (!pwep) {
-   RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, 
(" wpa_set_encryption: pwep allocate fail !!!\n"));
+   RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, 
("%s: pwep allocate fail !!!\n", __func__));
goto exit;
}
memset(pwep, 0, wep_total_len);
@@ -603,8 +603,8 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char 
*pie, unsigned short ie
}
 
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_,
-("rtw_set_wpa_ie: pairwise_cipher = 0x%08x 
padapter->securitypriv.ndisencryptstatus =%d 
padapter->securitypriv.ndisauthtype =%d\n",
-pairwise_cipher, padapter->securitypriv.ndisencryptstatus, 
padapter->securitypriv.ndisauthtype));
+("%s: pairwise_cipher = 0x%08x 
padapter->securitypriv.ndisencryptstatus =%d 
padapter->securitypriv.ndisauthtype =%d\n",
+ __func__, pairwise_cipher, 
padapter->securitypriv.ndisencryptstatus, padapter->securitypriv.ndisauthtype));
 exit:
kfree(buf);
return

[PATCH] staging: rtl8723bs: remove 5 GHz code

2020-08-13 Thread Michael Straube
According to the TODO 5 GHz code should be removed.

- find and remove remaining code valid only for 5 GHz. Most of the obvious
  ones have been removed, but things like channel > 14 still exist.

Remove code for channels > 14 from rtw_get_center_ch().

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 15 +--
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index a3ea7ce3e12e..a5790a648a5b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -374,20 +374,7 @@ u8 rtw_get_center_ch(u8 channel, u8 chnl_bw, u8 
chnl_offset)
u8 center_ch = channel;
 
if (chnl_bw == CHANNEL_WIDTH_80) {
-   if ((channel == 36) || (channel == 40) || (channel == 44) || 
(channel == 48))
-   center_ch = 42;
-   if ((channel == 52) || (channel == 56) || (channel == 60) || 
(channel == 64))
-   center_ch = 58;
-   if ((channel == 100) || (channel == 104) || (channel == 108) || 
(channel == 112))
-   center_ch = 106;
-   if ((channel == 116) || (channel == 120) || (channel == 124) || 
(channel == 128))
-   center_ch = 122;
-   if ((channel == 132) || (channel == 136) || (channel == 140) || 
(channel == 144))
-   center_ch = 138;
-   if ((channel == 149) || (channel == 153) || (channel == 157) || 
(channel == 161))
-   center_ch = 155;
-   else if (channel <= 14)
-   center_ch = 7;
+   center_ch = 7;
} else if (chnl_bw == CHANNEL_WIDTH_40) {
if (chnl_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
center_ch = channel + 2;
-- 
2.28.0



staging: most: Build error since commit "drivers: most: add USB adapter driver"

2020-08-02 Thread Michael Straube

Hi,

with commit 97a6f772f36b7f52bcfa56a581bbd2470cffe23d ("drivers: most: add USB 
adapter driver")
I get build errors.

$ LANG=C make clean drivers/staging/rtl8188eu/
scripts/Makefile.clean:15: drivers/staging/most/usb/Makefile: No such file or 
directory
make[5]: *** No rule to make target 'drivers/staging/most/usb/Makefile'.  Stop.
make[4]: *** [scripts/Makefile.clean:66: drivers/staging/most/usb] Error 2
make[3]: *** [scripts/Makefile.clean:66: drivers/staging/most] Error 2
make[2]: *** [scripts/Makefile.clean:66: drivers/staging] Error 2
make[1]: *** [Makefile:1763: _clean_drivers] Error 2
make: *** [Makefile:336: __build_one_by_one] Error 2

Did you forgot to remove the below line from drivers/staging/most/Makefile ?

obj-$(CONFIG_MOST_USB)  += usb/


Regards,
Michael


[PATCH 1/2] staging: rtl8188eu: clear alignment style issues

2020-07-23 Thread Michael Straube
Clear checkpatch alignment style issues in rtl8188eu_recv.c.
CHECK: Alignment should match open parenthesis

The file is now checkpatch clean.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
index 1cf8cff9a2a4..ab8313cf5bf0 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
@@ -33,7 +33,7 @@ int   rtw_hal_init_recv_priv(struct adapter *padapter)
if (!precvpriv->precv_buf) {
res = _FAIL;
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
-   ("alloc recv_buf fail!\n"));
+("alloc recv_buf fail!\n"));
goto exit;
}
precvbuf = precvpriv->precv_buf;
@@ -54,11 +54,11 @@ int rtw_hal_init_recv_priv(struct adapter *padapter)
 
for (i = 0; i < NR_PREALLOC_RECV_SKB; i++) {
pskb = __netdev_alloc_skb(padapter->pnetdev,
-   MAX_RECVBUF_SZ, GFP_KERNEL);
+ MAX_RECVBUF_SZ, GFP_KERNEL);
if (pskb) {
kmemleak_not_leak(pskb);
skb_queue_tail(>free_recv_skb_queue,
-   pskb);
+  pskb);
}
pskb = NULL;
}
@@ -88,7 +88,7 @@ void rtw_hal_free_recv_priv(struct adapter *padapter)
 
if (skb_queue_len(>free_recv_skb_queue))
DBG_88E(KERN_WARNING "free_recv_skb_queue not empty, %d\n",
-   skb_queue_len(>free_recv_skb_queue));
+   skb_queue_len(>free_recv_skb_queue));
 
skb_queue_purge(>free_recv_skb_queue);
 }
-- 
2.27.0



[PATCH 2/2] staging: rtl8188eu: cleanup whitespace in declarations

2020-07-23 Thread Michael Straube
Replace tabs with spaces in declarations to cleanup whitespace
in rtl8188eu_recv.c.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
index ab8313cf5bf0..7badfc2e45df 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
@@ -16,10 +16,10 @@
 
 #include 
 
-intrtw_hal_init_recv_priv(struct adapter *padapter)
+int rtw_hal_init_recv_priv(struct adapter *padapter)
 {
-   struct recv_priv*precvpriv = >recvpriv;
-   int i, res = _SUCCESS;
+   struct recv_priv *precvpriv = >recvpriv;
+   int i, res = _SUCCESS;
struct recv_buf *precvbuf;
 
tasklet_init(>recv_tasklet, rtl8188eu_recv_tasklet,
@@ -69,9 +69,9 @@ int   rtw_hal_init_recv_priv(struct adapter *padapter)
 
 void rtw_hal_free_recv_priv(struct adapter *padapter)
 {
-   int i;
-   struct recv_buf *precvbuf;
-   struct recv_priv*precvpriv = >recvpriv;
+   int i;
+   struct recv_buf *precvbuf;
+   struct recv_priv *precvpriv = >recvpriv;
 
precvbuf = precvpriv->precv_buf;
 
-- 
2.27.0



[PATCH] staging: rtl8188eu: add spaces around operators in header files

2020-07-19 Thread Michael Straube
Add spaces around operators in the header files to improve readability
and clear checkpatch issues.

Signed-off-by: Michael Straube 
---
 .../rtl8188eu/include/hal8188e_rate_adaptive.h   |  4 ++--
 drivers/staging/rtl8188eu/include/odm_types.h|  6 +++---
 drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 12 ++--
 drivers/staging/rtl8188eu/include/rtw_efuse.h|  2 +-
 drivers/staging/rtl8188eu/include/rtw_pwrctrl.h  |  2 +-
 drivers/staging/rtl8188eu/include/rtw_recv.h |  2 +-
 drivers/staging/rtl8188eu/include/rtw_security.h | 10 +-
 drivers/staging/rtl8188eu/include/rtw_xmit.h | 12 ++--
 drivers/staging/rtl8188eu/include/wifi.h |  2 +-
 drivers/staging/rtl8188eu/include/wlan_bssdef.h  |  2 +-
 10 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h 
b/drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h
index 79c0d2f9961e..646647feae85 100644
--- a/drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h
+++ b/drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h
@@ -28,9 +28,9 @@
 #define GET_TX_RPT2_DESC_PKT_LEN_88E(__pRxStatusDesc)  \
LE_BITS_TO_4BYTE(__pRxStatusDesc, 0, 9)
 #define GET_TX_RPT2_DESC_MACID_VALID_1_88E(__pRxStatusDesc)\
-   LE_BITS_TO_4BYTE(__pRxStatusDesc+16, 0, 32)
+   LE_BITS_TO_4BYTE(__pRxStatusDesc + 16, 0, 32)
 #define GET_TX_RPT2_DESC_MACID_VALID_2_88E(__pRxStatusDesc)\
-   LE_BITS_TO_4BYTE(__pRxStatusDesc+20, 0, 32)
+   LE_BITS_TO_4BYTE(__pRxStatusDesc + 20, 0, 32)
 
 #define GET_TX_REPORT_TYPE1_RERTY_0(__pAddr)   \
LE_BITS_TO_4BYTE(__pAddr, 0, 16)
diff --git a/drivers/staging/rtl8188eu/include/odm_types.h 
b/drivers/staging/rtl8188eu/include/odm_types.h
index 7255f7afff7a..2b207f09b56b 100644
--- a/drivers/staging/rtl8188eu/include/odm_types.h
+++ b/drivers/staging/rtl8188eu/include/odm_types.h
@@ -15,10 +15,10 @@ enum HAL_STATUS {
 };
 
 #define SET_TX_DESC_ANTSEL_A_88E(__pTxDesc, __Value)   \
-   SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 1, __Value)
+   SET_BITS_TO_LE_4BYTE(__pTxDesc + 8, 24, 1, __Value)
 #define SET_TX_DESC_ANTSEL_B_88E(__pTxDesc, __Value)   \
-   SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 25, 1, __Value)
+   SET_BITS_TO_LE_4BYTE(__pTxDesc + 8, 25, 1, __Value)
 #define SET_TX_DESC_ANTSEL_C_88E(__pTxDesc, __Value)   \
-   SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 29, 1, __Value)
+   SET_BITS_TO_LE_4BYTE(__pTxDesc + 28, 29, 1, __Value)
 
 #endif /*  __ODM_TYPES_H__ */
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
index b1e73503a2c2..6035c12ec578 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
@@ -45,7 +45,7 @@
 #define Rtl8188E_NIC_LPS_LEAVE_FLOWrtl8188E_leave_lps_flow
 
 #define DRVINFO_SZ 4 /*  unit is 8bytes */
-#define PageNum_128(_Len)  (u32)(((_Len)>>7) + ((_Len) & 0x7F ? 1 : 0))
+#define PageNum_128(_Len)  (u32)(((_Len) >> 7) + ((_Len) & 0x7F ? 1 : 0))
 
 /*  download firmware related data structure */
 #define FW_8188E_SIZE  0x4000 /* 16384,16k */
@@ -54,11 +54,11 @@
 
 #define MAX_PAGE_SIZE  4096/*  @ page : 4k bytes */
 
-#define IS_FW_HEADER_EXIST(_pFwHdr)\
-   ((le16_to_cpu(_pFwHdr->signature)&0xFFF0) == 0x92C0 ||  \
-   (le16_to_cpu(_pFwHdr->signature)&0xFFF0) == 0x88C0 ||   \
-   (le16_to_cpu(_pFwHdr->signature)&0xFFF0) == 0x2300 ||   \
-   (le16_to_cpu(_pFwHdr->signature)&0xFFF0) == 0x88E0)
+#define IS_FW_HEADER_EXIST(_pFwHdr) \
+   ((le16_to_cpu(_pFwHdr->signature) & 0xFFF0) == 0x92C0 || \
+   (le16_to_cpu(_pFwHdr->signature) & 0xFFF0) == 0x88C0 ||  \
+   (le16_to_cpu(_pFwHdr->signature) & 0xFFF0) == 0x2300 ||  \
+   (le16_to_cpu(_pFwHdr->signature) & 0xFFF0) == 0x88E0)
 
 #define DRIVER_EARLY_INT_TIME  0x05
 #define BCN_DMA_ATIME_INT_TIME 0x02
diff --git a/drivers/staging/rtl8188eu/include/rtw_efuse.h 
b/drivers/staging/rtl8188eu/include/rtw_efuse.h
index 7a9c8ff0daa9..5926fc9b5e6b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_efuse.h
+++ b/drivers/staging/rtl8188eu/include/rtw_efuse.h
@@ -44,7 +44,7 @@
 /* The following is for BT Efuse definition */
 #defineEFUSE_BT_MAX_MAP_LEN1024
 #defineEFUSE_MAX_BANK  4
-#defineEFUSE_MAX_BT_BANK   (EFUSE_MAX_BANK-1)
+#defineEFUSE_MAX_BT_BANK   (EFUSE_MAX_BANK - 1)
 /*--Define Parameters---*/
 #defineEFUSE_MAX_WORD_UNIT 4
 
diff --git a/drivers/

[PATCH] staging: rtl8188eu: clear tabstop style issues

2020-07-18 Thread Michael Straube
Clear tabstop style issues reported by checkpatch.
WARNING: Statements should start on a tabstop

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c| 2 +-
 drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 2 +-
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index fa88e8b2852d..26e5193cfd6c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -343,7 +343,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter 
*padapter,
*pold_state == Ndis802_11IBSS) {
if (check_fwstate(pmlmepriv, _FW_LINKED))
rtw_indicate_disconnect(padapter); /* will clr 
Linked_state; before this function, we must have checked whether  issue 
dis-assoc_cmd or not */
-  }
+   }
 
*pold_state = networktype;
 
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
index 740004d71a15..2baef9a285c0 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
@@ -145,7 +145,7 @@ void rtw_hal_set_odm_var(struct adapter *Adapter, enum 
hal_odm_variable eVariabl
} else {
DBG_88E("### Clean STA_(%d) info\n", 
psta->mac_id);
ODM_CmnInfoPtrArrayHook(podmpriv, 
ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL);
-  }
+   }
}
break;
case HAL_ODM_P2P_STATE:
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 5e6f7f0ed009..2e83d24fcb09 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -811,7 +811,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
psecuritypriv->PMKIDList[j].bUsed = false;
break;
}
-  }
+   }
} else if (pPMK->cmd == IW_PMKSA_FLUSH) {
DBG_88E("[rtw_wx_set_pmkid] IW_PMKSA_FLUSH!\n");
memset(>PMKIDList[0], 0x00, sizeof(struct 
rt_pmkid_list) * NUM_PMKID_CACHE);
-- 
2.27.0



[PATCH 1/2] staging: rtl8192u: remove GPL boiler plate text

2020-07-03 Thread Michael Straube
The SPDX identifier is a legally binding shorthand, which
can be used instead of the full boiler plate text.

The file ieee80211_module.c has a proper SPDX line, so the
GPL boiler plate text is not needed.

Signed-off-by: Michael Straube 
---
 .../rtl8192u/ieee80211/ieee80211_module.c| 16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index a5a1b14f5a40..c52540b734fd 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -9,22 +9,6 @@
  *  
  *  Copyright (c) 2002-2003, Jouni Malinen 
  *
- *  This program is free software; you can redistribute it and/or modify it
- *  under the terms of version 2 of the GNU General Public License as
- *  published by the Free Software Foundation.
- *
- *  This program is distributed in the hope that it will be useful, but WITHOUT
- *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- *  more details.
- *
- *  You should have received a copy of the GNU General Public License along 
with
- *  this program; if not, write to the Free Software Foundation, Inc., 59
- *  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- *  The full GNU General Public License is included in this distribution in the
- *  file called LICENSE.
- *
  *  Contact Information:
  *  James P. Ketrenos 
  *  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-- 
2.27.0



[PATCH 2/2] staging: rtl8192u: remove copying file

2020-07-03 Thread Michael Straube
All source and header files have a GPL-2.0 SPDX identifier.
The 'copying' file with the whole GPL text is not needed, delete it.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8192u/copying | 340 ---
 1 file changed, 340 deletions(-)
 delete mode 100644 drivers/staging/rtl8192u/copying

diff --git a/drivers/staging/rtl8192u/copying b/drivers/staging/rtl8192u/copying
deleted file mode 100644
index e90dfed1a31e..
--- a/drivers/staging/rtl8192u/copying
+++ /dev/null
@@ -1,340 +0,0 @@
-   GNU GENERAL PUBLIC LICENSE
-  Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-   Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-   GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any 

[PATCH] staging: rtl8188eu: use common ieee80211 constants

2020-07-01 Thread Michael Straube
Many defined constants in wifi.h are unused and/or available from
, some with slightly different names. Use the
common ones, rename where necessary and remove unused.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c   | 12 ++---
 drivers/staging/rtl8188eu/core/rtw_mlme.c |  6 +--
 drivers/staging/rtl8188eu/include/wifi.h  | 46 ---
 .../staging/rtl8188eu/os_dep/ioctl_linux.c|  2 +-
 4 files changed, 10 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 817793b9aff2..41535441f82c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -535,7 +535,7 @@ void update_sta_info_apmode(struct adapter *padapter, 
struct sta_info *psta)
/*  bwmode */
if (le16_to_cpu(phtpriv_sta->ht_cap.cap_info &
phtpriv_ap->ht_cap.cap_info) &
-   IEEE80211_HT_CAP_SUP_WIDTH) {
+   IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
phtpriv_sta->bwmode = pmlmeext->cur_bwmode;
phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset;
}
@@ -925,12 +925,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 
*pbuf,  int len)
 
if ((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) ||
(psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP))
-   pht_cap->ampdu_params_info |= 
(IEEE80211_HT_CAP_AMPDU_DENSITY & (0x07 << 2));
+   pht_cap->ampdu_params_info |= 
(IEEE80211_HT_AMPDU_PARM_DENSITY & (0x07 << 2));
else
-   pht_cap->ampdu_params_info |= 
(IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00);
+   pht_cap->ampdu_params_info |= 
(IEEE80211_HT_AMPDU_PARM_DENSITY & 0x00);
 
/* set  Max Rx AMPDU size  to 64K */
-   pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_FACTOR & 
0x03);
+   pht_cap->ampdu_params_info |= (IEEE80211_HT_AMPDU_PARM_FACTOR & 
0x03);
 
pht_cap->mcs.rx_mask[0] = 0xff;
pht_cap->mcs.rx_mask[1] = 0x0;
@@ -1307,7 +1307,7 @@ static int rtw_ht_operation_update(struct adapter 
*padapter)
(pmlmepriv->ht_op_mode & 
HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT))
new_op_mode = OP_MODE_MIXED;
else if ((le16_to_cpu(phtpriv_ap->ht_cap.cap_info) &
- IEEE80211_HT_CAP_SUP_WIDTH) &&
+ IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
 pmlmepriv->num_sta_ht_20mhz)
new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED;
else if (pmlmepriv->olbc_ht)
@@ -1457,7 +1457,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, 
struct sta_info *psta)
pmlmepriv->num_sta_ht_no_gf);
}
 
-   if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH) == 0) {
+   if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH_20_40) == 0) {
if (!psta->ht_20mhz_set) {
psta->ht_20mhz_set = 1;
pmlmepriv->num_sta_ht_20mhz++;
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index b291ee6ca8f4..5d7a749f1aac 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1882,7 +1882,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter 
*padapter, u8 *in_ie, u8 *out_
 
memset(_cap, 0, sizeof(struct ieee80211_ht_cap));
 
-   ht_cap.cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH |
+   ht_cap.cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
  IEEE80211_HT_CAP_SGI_20 |
  IEEE80211_HT_CAP_SGI_40 |
  IEEE80211_HT_CAP_TX_STBC |
@@ -1900,9 +1900,9 @@ unsigned int rtw_restructure_ht_ie(struct adapter 
*padapter, u8 *in_ie, u8 *out_
ht_cap.ampdu_params_info = max_rx_ampdu_factor & 0x03;
 
if (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
-   ht_cap.ampdu_params_info |= 
IEEE80211_HT_CAP_AMPDU_DENSITY & (0x07 << 2);
+   ht_cap.ampdu_params_info |= 
IEEE80211_HT_AMPDU_PARM_DENSITY & (0x07 << 2);
else
-   ht_cap.ampdu_params_info |= 
IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00;
+   ht_cap.ampdu_params_info |= 
IEEE80211_HT_AMPDU_PARM_DENSITY & 0x00;
 
rtw_set_ie(out_ie + out_len, _HT_CAPABILITY_IE_,
   sizeof(stru

[PATCH] staging: rtl8188eu: remove unused parameter

2020-07-01 Thread Michael Straube
Remove unused parameter 'padapter' from rtw_os_xmit_resource_alloc().

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c  | 6 +++---
 drivers/staging/rtl8188eu/include/xmit_osdep.h | 3 +--
 drivers/staging/rtl8188eu/os_dep/xmit_linux.c  | 3 +--
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 258531bc1408..1b12afd33d95 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -124,10 +124,10 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, 
struct adapter *padapter)
pxmitbuf->ext_tag = false;
 
/* Tx buf allocation may fail sometimes, so sleep and retry. */
-   res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, 
(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ));
+   res = rtw_os_xmit_resource_alloc(pxmitbuf, (MAX_XMITBUF_SZ + 
XMITBUF_ALIGN_SZ));
if (res == _FAIL) {
msleep(10);
-   res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, 
(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ));
+   res = rtw_os_xmit_resource_alloc(pxmitbuf, 
(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ));
if (res == _FAIL)
goto exit;
}
@@ -162,7 +162,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
pxmitbuf->padapter = padapter;
pxmitbuf->ext_tag = true;
 
-   res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, 
max_xmit_extbuf_size + XMITBUF_ALIGN_SZ);
+   res = rtw_os_xmit_resource_alloc(pxmitbuf, max_xmit_extbuf_size 
+ XMITBUF_ALIGN_SZ);
if (res == _FAIL) {
res = _FAIL;
goto exit;
diff --git a/drivers/staging/rtl8188eu/include/xmit_osdep.h 
b/drivers/staging/rtl8188eu/include/xmit_osdep.h
index 5283a6d53700..5fd8ca51f156 100644
--- a/drivers/staging/rtl8188eu/include/xmit_osdep.h
+++ b/drivers/staging/rtl8188eu/include/xmit_osdep.h
@@ -22,8 +22,7 @@ int rtw_xmit_entry(struct sk_buff *pkt, struct  net_device 
*pnetdev);
 
 void rtw_os_xmit_schedule(struct adapter *padapter);
 
-int rtw_os_xmit_resource_alloc(struct adapter *padapter,
-  struct xmit_buf *pxmitbuf, u32 alloc_sz);
+int rtw_os_xmit_resource_alloc(struct xmit_buf *pxmitbuf, u32 alloc_sz);
 void rtw_os_xmit_resource_free(struct xmit_buf *pxmitbuf);
 
 void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c 
b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
index 017e1d628461..3ca1dc30efb7 100644
--- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
@@ -14,8 +14,7 @@
 #include 
 #include 
 
-int rtw_os_xmit_resource_alloc(struct adapter *padapter,
-  struct xmit_buf *pxmitbuf, u32 alloc_sz)
+int rtw_os_xmit_resource_alloc(struct xmit_buf *pxmitbuf, u32 alloc_sz)
 {
int i;
 
-- 
2.27.0



[PATCH] staging: rtl8712: use common ieee80211 constants

2020-07-01 Thread Michael Straube
Many defined constants in wifi.h are unused and/or available from
, some with slightly different names. Use the
common ones, rename where necessary and remove unused.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c |  2 +-
 drivers/staging/rtl8712/rtl871x_mlme.c|  8 +--
 drivers/staging/rtl8712/wifi.h| 51 ---
 3 files changed, 5 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 36c89cde525d..81482d5ae1a3 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1411,7 +1411,7 @@ static int r8711_wx_get_rate(struct net_device *dev,
pht_capie = (struct rtl_ieee80211_ht_cap *)(p + 2);
memcpy(_rate, pht_capie->supp_mcs_set, 2);
bw_40MHz = (le16_to_cpu(pht_capie->cap_info) &
-   IEEE80211_HT_CAP_SUP_WIDTH) ? 1 : 0;
+   IEEE80211_HT_CAP_SUP_WIDTH_20_40) ? 1 : 0;
short_GI = (le16_to_cpu(pht_capie->cap_info) &
(IEEE80211_HT_CAP_SGI_20 |
IEEE80211_HT_CAP_SGI_40)) ? 1 : 0;
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
b/drivers/staging/rtl8712/rtl871x_mlme.c
index efd75add8e35..9ee1bfac0763 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -1660,14 +1660,14 @@ unsigned int r8712_restructure_ht_ie(struct _adapter 
*padapter, u8 *in_ie,
}
out_len = *pout_len;
memset(_capie, 0, sizeof(struct rtl_ieee80211_ht_cap));
-   ht_capie.cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH |
+   ht_capie.cap_info = 
cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
IEEE80211_HT_CAP_SGI_20 |
IEEE80211_HT_CAP_SGI_40 |
IEEE80211_HT_CAP_TX_STBC |
IEEE80211_HT_CAP_MAX_AMSDU |
IEEE80211_HT_CAP_DSSSCCK40);
-   ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR &
-   0x03) | (IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00);
+   ht_capie.ampdu_params_info = (IEEE80211_HT_AMPDU_PARM_FACTOR &
+   0x03) | (IEEE80211_HT_AMPDU_PARM_DENSITY & 
0x00);
r8712_set_ie(out_ie + out_len, _HT_CAPABILITY_IE_,
 sizeof(struct rtl_ieee80211_ht_cap),
 (unsigned char *)_capie, pout_len);
@@ -1705,7 +1705,7 @@ static void update_ht_cap(struct _adapter *padapter, u8 
*pie, uint ie_len)
if (p && len > 0) {
pht_capie = (struct rtl_ieee80211_ht_cap *)(p + 2);
max_ampdu_sz = (pht_capie->ampdu_params_info &
-   IEEE80211_HT_CAP_AMPDU_FACTOR);
+   IEEE80211_HT_AMPDU_PARM_FACTOR);
/* max_ampdu_sz (kbytes); */
max_ampdu_sz = 1 << (max_ampdu_sz + 3);
phtpriv->rx_ampdu_maxlen = max_ampdu_sz;
diff --git a/drivers/staging/rtl8712/wifi.h b/drivers/staging/rtl8712/wifi.h
index 66e0634f07ba..601d4ff607bc 100644
--- a/drivers/staging/rtl8712/wifi.h
+++ b/drivers/staging/rtl8712/wifi.h
@@ -437,13 +437,6 @@ static inline unsigned char *get_hdr_bssid(unsigned char 
*pframe)
  
*--
  */
 
-/* block-ack parameters */
-#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
-#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
-#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0
-#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
-#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
-
 #define SetOrderBit(pbuf) ({ \
*(__le16 *)(pbuf) |= cpu_to_le16(_ORDER_); \
 })
@@ -481,49 +474,5 @@ struct ieee80211_ht_addt_info {
unsigned char   basic_set[16];
 } __packed;
 
-/* 802.11n HT capabilities masks */
-#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
-#define IEEE80211_HT_CAP_SM_PS 0x000C
-#define IEEE80211_HT_CAP_GRN_FLD   0x0010
-#define IEEE80211_HT_CAP_SGI_200x0020
-#define IEEE80211_HT_CAP_SGI_400x0040
-#define IEEE80211_HT_CAP_TX_STBC   0x0080
-#define IEEE80211_HT_CAP_DELAY_BA  0x0400
-#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
-#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
-/* 802.11n HT capability AMPDU settings */
-#define IEEE80211_HT_CAP_AMPDU_FACTOR  0x03
-#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
-/* 802.11n HT capability MSC set */
-#define IEEE80211_SUPP_MCS_SET_UEQM4
-#define IEEE80211_HT_CAP

[PATCH 1/2] staging: rtl8188eu: use compound assignment operators

2020-06-29 Thread Michael Straube
Use compound assignment operators to simplify the code and clear
missing spaces around operators checkpatch issues.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index d5968ef9f43d..68196d8c05eb 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -211,7 +211,7 @@ static char *translate_scan(struct adapter *padapter,
else/* default MCS7 */
max_rate = (bw_40MHz) ? ((short_GI) ? 150 : 135) : 
((short_GI) ? 72 : 65);
 
-   max_rate = max_rate*2;/* Mbps/2; */
+   max_rate *= 2; /* Mbps/2; */
}
 
iwe.cmd = SIOCGIWRATE;
@@ -1395,7 +1395,7 @@ static int rtw_wx_set_rate(struct net_device *dev,
ratevalue = 11;
goto set_rate;
}
-   target_rate = target_rate/10;
+   target_rate /= 10;
 
switch (target_rate) {
case 10:
-- 
2.27.0



[PATCH 1/3] staging: rtl8188eu: remove some ieee80211 constants from wifi.h

2020-06-29 Thread Michael Straube
The constants IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL and
IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA are not used in the driver
code and, if ever needed, available from 'include/linux/ieee80211.h'.
Remove them from wifi.h.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/include/wifi.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/wifi.h 
b/drivers/staging/rtl8188eu/include/wifi.h
index 667055796b66..e12e3d0a45e0 100644
--- a/drivers/staging/rtl8188eu/include/wifi.h
+++ b/drivers/staging/rtl8188eu/include/wifi.h
@@ -453,10 +453,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)
Below is the definition for 802.11n
 
--*/
 
-/* 802.11 BAR control masks */
-#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x
-#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA  0x0004
-
 /**
  * struct rtw_ieee80211_ht_cap - HT additional information
  *
-- 
2.27.0



[PATCH 3/3] staging: rtl8712: remove some ieee80211 constants from wifi.h

2020-06-29 Thread Michael Straube
The constants IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL and
IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA are not used in the driver
code and, if ever needed, available from 'include/linux/ieee80211.h'.
Remove them from wifi.h.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8712/wifi.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8712/wifi.h b/drivers/staging/rtl8712/wifi.h
index befb2f9b40ad..66e0634f07ba 100644
--- a/drivers/staging/rtl8712/wifi.h
+++ b/drivers/staging/rtl8712/wifi.h
@@ -451,10 +451,6 @@ static inline unsigned char *get_hdr_bssid(unsigned char 
*pframe)
 #define GetOrderBit(pbuf)  (((*(__le16 *)(pbuf)) & \
le16_to_cpu(_ORDER_)) != 0)
 
-/* 802.11 BAR control masks */
-#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x
-#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA  0x0004
-
 /*
  * struct rtl_ieee80211_ht_cap - HT capabilities
  *
-- 
2.27.0



[PATCH 2/3] staging: rtl8723bs: remove some ieee80211 constants from wifi.h

2020-06-29 Thread Michael Straube
The constants IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL and
IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA are not used in the driver
code and, if ever needed, available from 'include/linux/ieee80211.h'.
Remove them from wifi.h.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/include/wifi.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/wifi.h 
b/drivers/staging/rtl8723bs/include/wifi.h
index 88a6e982ce01..f75df547a946 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -657,11 +657,6 @@ struct rtw_ieee80211_bar {
__le16 start_seq_num;
 } __attribute__((packed));
 
-/* 802.11 BAR control masks */
-#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x
-#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA  0x0004
-
-
  /**
  * struct rtw_ieee80211_ht_cap - HT capabilities
  *
-- 
2.27.0



Re: [PATCH] staging: rtl8188eu: include: ieee80211.h: fixed multiple blank line coding style issues.

2020-06-29 Thread Michael Straube



On 2020-06-29 10:09, B K Karthik wrote:

removed multiple blank lines to improve code readability.

Signed-off-by: B K Karthik 
---
  drivers/staging/rtl8188eu/include/ieee80211.h | 9 -
  1 file changed, 9 deletions(-)


Hi, those lines are already removed in

commit 5bfb7eadc5874a3a08dd173d66a16a1ed0548444 ("staging: rtl8188eu: remove blank 
lines in header files")

regards,
Michael


[PATCH 2/2] staging: rtl8188eu: add spaces around operators

2020-06-29 Thread Michael Straube
Add spaces around operators to improve readability and clear
checkpatch issues.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c  |   8 +-
 drivers/staging/rtl8188eu/core/rtw_recv.c |  70 ++--
 drivers/staging/rtl8188eu/core/rtw_security.c | 102 +-
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c  |   2 +-
 .../staging/rtl8188eu/os_dep/ioctl_linux.c|  50 -
 5 files changed, 116 insertions(+), 116 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index ebf3bafb..39ca97411fd5 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -205,10 +205,10 @@ static bool rtw_pwr_unassociated_idle(struct adapter 
*adapter)
if (time_after_eq(adapter->pwrctrlpriv.ips_deny_time, jiffies))
return false;
 
-   if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR) ||
-   check_fwstate(pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS) ||
+   if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE | WIFI_SITE_MONITOR) ||
+   check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS) ||
check_fwstate(pmlmepriv, WIFI_AP_STATE) ||
-   check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE))
+   check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | 
WIFI_ADHOC_STATE))
return false;
 
return true;
@@ -249,7 +249,7 @@ void rtw_ps_processor(struct adapter *padapter)
if (!rtw_pwr_unassociated_idle(padapter))
goto exit;
 
-   if ((pwrpriv->rf_pwrstate == rf_on) && 
((pwrpriv->pwr_state_check_cnts%4) == 0)) {
+   if ((pwrpriv->rf_pwrstate == rf_on) && ((pwrpriv->pwr_state_check_cnts 
% 4) == 0)) {
DBG_88E("==>%s .fw_state(%x)\n", __func__, 
get_fwstate(pmlmepriv));
pwrpriv->change_rfpwrstate = rf_off;
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 61ea8f38829c..44579f7cab87 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -244,10 +244,10 @@ static int recvframe_chkmic(struct adapter *adapter,
}
 
/* icv_len included the mic code */
-   datalen = precvframe->pkt->len-prxattrib->hdrlen -
- prxattrib->iv_len-prxattrib->icv_len-8;
+   datalen = precvframe->pkt->len - prxattrib->hdrlen -
+ prxattrib->iv_len - prxattrib->icv_len - 8;
pframe = precvframe->pkt->data;
-   payload = pframe+prxattrib->hdrlen+prxattrib->iv_len;
+   payload = pframe + prxattrib->hdrlen + 
prxattrib->iv_len;
 
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n 
prxattrib->iv_len=%d prxattrib->icv_len=%d\n", prxattrib->iv_len, 
prxattrib->icv_len));
rtw_seccalctkipmic(mickey, pframe, payload, datalen, 
[0],
@@ -258,7 +258,7 @@ static int recvframe_chkmic(struct adapter *adapter,
bmic_err = false;
 
for (i = 0; i < 8; i++) {
-   if (miccode[i] != *(pframemic+i)) {
+   if (miccode[i] != *(pframemic + i)) {
RT_TRACE(_module_rtl871x_recv_c_, 
_drv_err_,
 ("%s: 
miccode[%d](%02x)!=*(pframemic+%d)(%02x) ",
  __func__, i, miccode[i], i, 
*(pframemic + i)));
@@ -269,14 +269,14 @@ static int recvframe_chkmic(struct adapter *adapter,
if (bmic_err) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 ("\n 
*(pframemic-8)-*(pframemic-1)=0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n",
-*(pframemic-8), *(pframemic-7), 
*(pframemic-6),
-*(pframemic-5), *(pframemic-4), 
*(pframemic-3),
-*(pframemic-2), *(pframemic-1)));
+*(pframemic - 8), *(pframemic - 7), 
*(pframemic - 6),
+*(pframemic - 5), *(pframemic - 4), 
*(pframemic - 3),
+*(pframemic - 2), *(pframemic - 1)));
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 ("\n 
*(pframemic-16)-*(pframemic-9)=0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n",
-

[PATCH v2] staging: rtl8188eu: remove unnecessary comments in hal8188e_phy_cfg.h

2020-06-28 Thread Michael Straube
Remove unnecessary comments in hal8188e_phy_cfg.h to improve
readability and clear multiple blank lines checkpatch issues.

CHECK: Please don't use multiple blank lines

Signed-off-by: Michael Straube 
---
v1 -> v2
Remove one more line as suggested by Dan Carpenter.

 .../rtl8188eu/include/hal8188e_phy_cfg.h  | 25 ---
 1 file changed, 25 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/hal8188e_phy_cfg.h 
b/drivers/staging/rtl8188eu/include/hal8188e_phy_cfg.h
index 0c5b2b0948f5..a1055ceb7206 100644
--- a/drivers/staging/rtl8188eu/include/hal8188e_phy_cfg.h
+++ b/drivers/staging/rtl8188eu/include/hal8188e_phy_cfg.h
@@ -7,8 +7,6 @@
 #ifndef __INC_HAL8188EPHYCFG_H__
 #define __INC_HAL8188EPHYCFG_H__
 
-
-/*--Define Parameters---*/
 #define LOOP_LIMIT 5
 #define MAX_STALL_TIME 50  /* us */
 #define AntennaDiversityValue  0x80
@@ -17,11 +15,6 @@
 
 #define MAX_AGGR_NUM   0x07
 
-
-/*--Define Parameters---*/
-
-
-/*--Define structure*/
 enum sw_chnl_cmd_id {
CmdID_End,
CmdID_SetTxPowerLevel,
@@ -145,22 +138,6 @@ struct bb_reg_def {
 */
 };
 
-/*--Define structure*/
-
-
-/*Export global variable*/
-/*Export global variable*/
-
-
-/*Export Marco Definition---*/
-/*Export Marco Definition---*/
-
-
-/*--Exported Function prototype-*/
-/*  */
-/*  BB and RF register read/write */
-/*  */
-
 /* Read initi reg value for tx power setting. */
 void rtl8192c_PHY_GetHWRegOriginalValue(struct adapter *adapter);
 
@@ -181,8 +158,6 @@ void PHY_EnableHostClkReq(struct adapter *adapter);
 
 bool SetAntennaConfig92C(struct adapter *adapter, u8 defaultant);
 
-/*--Exported Function prototype-*/
-
 #define PHY_SetMacReg  PHY_SetBBReg
 
 #defineSIC_HW_SUPPORT  0
-- 
2.27.0



[PATCH] staging: rtl8188eu: remove unnecessary comments in hal8188e_phy_cfg.h

2020-06-27 Thread Michael Straube
Remove unnecessary comments in hal8188e_phy_cfg.h to improve
readability and clear multiple blank lines checkpatch issues.

CHECK: Please don't use multiple blank lines

Signed-off-by: Michael Straube 
---
 .../rtl8188eu/include/hal8188e_phy_cfg.h  | 23 ---
 1 file changed, 23 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/hal8188e_phy_cfg.h 
b/drivers/staging/rtl8188eu/include/hal8188e_phy_cfg.h
index 0c5b2b0948f5..78b44bf55f28 100644
--- a/drivers/staging/rtl8188eu/include/hal8188e_phy_cfg.h
+++ b/drivers/staging/rtl8188eu/include/hal8188e_phy_cfg.h
@@ -7,8 +7,6 @@
 #ifndef __INC_HAL8188EPHYCFG_H__
 #define __INC_HAL8188EPHYCFG_H__
 
-
-/*--Define Parameters---*/
 #define LOOP_LIMIT 5
 #define MAX_STALL_TIME 50  /* us */
 #define AntennaDiversityValue  0x80
@@ -17,11 +15,6 @@
 
 #define MAX_AGGR_NUM   0x07
 
-
-/*--Define Parameters---*/
-
-
-/*--Define structure*/
 enum sw_chnl_cmd_id {
CmdID_End,
CmdID_SetTxPowerLevel,
@@ -145,21 +138,7 @@ struct bb_reg_def {
 */
 };
 
-/*--Define structure*/
-
-
-/*Export global variable*/
-/*Export global variable*/
-
-
-/*Export Marco Definition---*/
-/*Export Marco Definition---*/
-
-
-/*--Exported Function prototype-*/
-/*  */
 /*  BB and RF register read/write */
-/*  */
 
 /* Read initi reg value for tx power setting. */
 void rtl8192c_PHY_GetHWRegOriginalValue(struct adapter *adapter);
@@ -181,8 +160,6 @@ void PHY_EnableHostClkReq(struct adapter *adapter);
 
 bool SetAntennaConfig92C(struct adapter *adapter, u8 defaultant);
 
-/*--Exported Function prototype-*/
-
 #define PHY_SetMacReg  PHY_SetBBReg
 
 #defineSIC_HW_SUPPORT  0
-- 
2.27.0



[PATCH] staging: rtl8188eu: remove blank lines in header files

2020-06-27 Thread Michael Straube
Remove blank lines in header files to clear checkpatch issues.
CHECK: Please don't use multiple blank lines

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/include/drv_types.h |  1 -
 drivers/staging/rtl8188eu/include/hal_com.h   |  1 -
 drivers/staging/rtl8188eu/include/ieee80211.h | 11 ---
 drivers/staging/rtl8188eu/include/odm.h   |  4 
 drivers/staging/rtl8188eu/include/odm_debug.h |  2 --
 drivers/staging/rtl8188eu/include/pwrseq.h|  3 ---
 drivers/staging/rtl8188eu/include/pwrseqcmd.h |  1 -
 drivers/staging/rtl8188eu/include/recv_osdep.h|  2 --
 drivers/staging/rtl8188eu/include/rtl8188e_hal.h  |  5 -
 drivers/staging/rtl8188eu/include/rtl8188e_spec.h |  1 -
 drivers/staging/rtl8188eu/include/rtl8188e_xmit.h |  1 -
 drivers/staging/rtl8188eu/include/rtw_debug.h |  1 -
 drivers/staging/rtl8188eu/include/rtw_ioctl.h |  2 --
 drivers/staging/rtl8188eu/include/rtw_ioctl_set.h |  1 -
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h  |  3 ---
 drivers/staging/rtl8188eu/include/rtw_recv.h  |  3 ---
 drivers/staging/rtl8188eu/include/rtw_rf.h|  1 -
 drivers/staging/rtl8188eu/include/rtw_security.h  |  3 ---
 drivers/staging/rtl8188eu/include/rtw_xmit.h  |  1 -
 drivers/staging/rtl8188eu/include/wifi.h  |  5 -
 drivers/staging/rtl8188eu/include/wlan_bssdef.h   |  3 ---
 21 files changed, 55 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/drv_types.h 
b/drivers/staging/rtl8188eu/include/drv_types.h
index 35c0946bc65d..0a3acb378d6d 100644
--- a/drivers/staging/rtl8188eu/include/drv_types.h
+++ b/drivers/staging/rtl8188eu/include/drv_types.h
@@ -10,7 +10,6 @@
 
 
--*/
 
-
 #ifndef __DRV_TYPES_H__
 #define __DRV_TYPES_H__
 
diff --git a/drivers/staging/rtl8188eu/include/hal_com.h 
b/drivers/staging/rtl8188eu/include/hal_com.h
index 93cbbe7ba1fd..542e6e93ff8e 100644
--- a/drivers/staging/rtl8188eu/include/hal_com.h
+++ b/drivers/staging/rtl8188eu/include/hal_com.h
@@ -137,7 +137,6 @@
 #include "HalVerDef.h"
 void dump_chip_info(struct HAL_VERSION ChipVersion);
 
-
 /* return the final channel plan decision */
 u8 hal_com_get_channel_plan(u8 hw_channel_plan, u8 sw_channel_plan,
u8 def_channel_plan, bool load_fail);
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index 75f0ebe0faf5..83218e7ec0a9 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -90,7 +90,6 @@ enum {
 #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED   6
 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED7
 
-
 #defineIEEE_CRYPT_ALG_NAME_LEN 16
 
 #define WPA_CIPHER_NONEBIT(0)
@@ -99,8 +98,6 @@ enum {
 #define WPA_CIPHER_TKIPBIT(3)
 #define WPA_CIPHER_CCMPBIT(4)
 
-
-
 #define WPA_SELECTOR_LEN 4
 extern u8 RTW_WPA_OUI_TYPE[];
 extern u8 WPA_AUTH_KEY_MGMT_NONE[];
@@ -113,7 +110,6 @@ extern u8 WPA_CIPHER_SUITE_WRAP[];
 extern u8 WPA_CIPHER_SUITE_CCMP[];
 extern u8 WPA_CIPHER_SUITE_WEP104[];
 
-
 #define RSN_HEADER_LEN 4
 #define RSN_SELECTOR_LEN 4
 
@@ -192,7 +188,6 @@ enum NETWORK_TYPE {
 #define IsSupportedTxMCS(NetType)  \
((NetType) & (WIRELESS_11_24N | WIRELESS_11_5N) ? true : false)
 
-
 struct ieee_param {
u32 cmd;
u8 sta_addr[ETH_ALEN];
@@ -270,11 +265,9 @@ struct sta_data {
  * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro)
  */
 
-
 #define IEEE80211_HLEN 30
 #define IEEE80211_FRAME_LEN(IEEE80211_DATA_LEN + IEEE80211_HLEN)
 
-
 /* this is stolen from ipw2200 driver */
 #define IEEE_IBSS_MAC_HASH_SIZE 31
 
@@ -297,7 +290,6 @@ enum eap_type {
 #define RTW_IEEE80211_SCTL_FRAG0x000F
 #define RTW_IEEE80211_SCTL_SEQ 0xFFF0
 
-
 #define RTW_ERP_INFO_NON_ERP_PRESENT BIT(0)
 #define RTW_ERP_INFO_USE_PROTECTION BIT(1)
 #define RTW_ERP_INFO_BARKER_PREAMBLE_MODE BIT(2)
@@ -354,7 +346,6 @@ struct ieee80211_snap_hdr {
 #define IEEE80211_CCK_RATE_LEN 4
 #define IEEE80211_NUM_OFDM_RATESLEN8
 
-
 #define IEEE80211_CCK_RATE_1MB 0x02
 #define IEEE80211_CCK_RATE_2MB 0x04
 #define IEEE80211_CCK_RATE_5MB 0x0B
@@ -613,7 +604,6 @@ enum rtw_ieee80211_back_parties {
 #define WME_TSPEC_DIRECTION_DOWNLINK 1
 #define WME_TSPEC_DIRECTION_BI_DIRECTIONAL 3
 
-
 #define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */
 
 #define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */
@@ -758,7 +748,6 @@ uintrtw_get_rateset_len(u8  *rateset);
 struct registry_priv;
 int rtw_generate_ie(struct registry_priv *pregistrypriv);
 
-
 int rtw_get_bit_value_from_ieee_value(u8 val);
 
 bool rtw_is_cckrates_included(u8 *rate);
diff --git a/drivers/staging/rtl8188eu/include/od

[PATCH] staging: rtl8188eu: use common packet header constants

2020-06-19 Thread Michael Straube
The driver replicates the definitions of rfc1042_header and
bridge_tunnel_header available from cfg80211.h. Use the common
ones from cfg80211.h.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index a036ef104198..0257e56b551a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define ETHERNET_HEADER_SIZE   14  /*  Ethernet Header Length */
 #define LLC_HEADER_SIZE6   /*  LLC Header Length */
@@ -22,15 +23,6 @@
 static u8 SNAP_ETH_TYPE_IPX[2] = {0x81, 0x37};
 static u8 SNAP_ETH_TYPE_APPLETALK_AARP[2] = {0x80, 0xf3};
 
-/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */
-static u8 rtw_bridge_tunnel_header[] = {
-   0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8
-};
-
-static u8 rtw_rfc1042_header[] = {
-   0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
-};
-
 static void rtw_signal_stat_timer_hdl(struct timer_list *t);
 
 void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
@@ -1277,10 +1269,10 @@ static int wlanhdr_to_ethhdr(struct recv_frame 
*precvframe)
psnap = (struct ieee80211_snap_hdr *)(ptr+pattrib->hdrlen + 
pattrib->iv_len);
psnap_type = ptr+pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE;
/* convert hdr + possible LLC headers into Ethernet header */
-   if ((!memcmp(psnap, rtw_rfc1042_header, SNAP_SIZE) &&
+   if ((!memcmp(psnap, rfc1042_header, SNAP_SIZE) &&
 memcmp(psnap_type, SNAP_ETH_TYPE_IPX, 2) &&
 memcmp(psnap_type, SNAP_ETH_TYPE_APPLETALK_AARP, 2)) ||
-!memcmp(psnap, rtw_bridge_tunnel_header, SNAP_SIZE)) {
+!memcmp(psnap, bridge_tunnel_header, SNAP_SIZE)) {
/* remove RFC1042 or Bridge-Tunnel encapsulation and replace 
EtherType */
bsnaphdr = true;
} else {
@@ -1560,9 +1552,9 @@ static int amsdu_to_msdu(struct adapter *padapter, struct 
recv_frame *prframe)
/* convert hdr + possible LLC headers into Ethernet header */
eth_type = get_unaligned_be16(_skb->data[6]);
if (sub_skb->len >= 8 &&
-   ((!memcmp(sub_skb->data, rtw_rfc1042_header, SNAP_SIZE) &&
+   ((!memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) &&
  eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) ||
-!memcmp(sub_skb->data, rtw_bridge_tunnel_header, 
SNAP_SIZE))) {
+!memcmp(sub_skb->data, bridge_tunnel_header, 
SNAP_SIZE))) {
/* remove RFC1042 or Bridge-Tunnel encapsulation and 
replace EtherType */
skb_pull(sub_skb, SNAP_SIZE);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, 
ETH_ALEN);
-- 
2.27.0



[PATCH v2 1/2] staging: rtl8188eu: clean up some declarations

2020-05-24 Thread Michael Straube
Clean up some array declarations in phy_iq_calibrate() to reduce
indentation and clear line over 80 characters checkpatch warnings.

Signed-off-by: Michael Straube 
---
v1 -> v2
Added patch that makes arrays static const.

 drivers/staging/rtl8188eu/hal/phy.c | 33 +++--
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index 5eca3625d5a8..a0522d6764d6 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -953,25 +953,26 @@ static void phy_iq_calibrate(struct adapter *adapt, s32 
result[][8],
u32 i;
u8 path_a_ok, path_b_ok;
u32 adda_reg[IQK_ADDA_REG_NUM] = {
- rFPGA0_XCD_SwitchControl, rBlue_Tooth,
- rRx_Wait_CCA, rTx_CCK_RFON,
- rTx_CCK_BBON, rTx_OFDM_RFON,
- rTx_OFDM_BBON, rTx_To_Rx,
- rTx_To_Tx, rRx_CCK,
- rRx_OFDM, rRx_Wait_RIFS,
- rRx_TO_Rx, rStandby,
- rSleep, rPMPD_ANAEN};
-
+   rFPGA0_XCD_SwitchControl, rBlue_Tooth,
+   rRx_Wait_CCA, rTx_CCK_RFON,
+   rTx_CCK_BBON, rTx_OFDM_RFON,
+   rTx_OFDM_BBON, rTx_To_Rx,
+   rTx_To_Tx, rRx_CCK,
+   rRx_OFDM, rRx_Wait_RIFS,
+   rRx_TO_Rx, rStandby,
+   rSleep, rPMPD_ANAEN
+   };
u32 iqk_mac_reg[IQK_MAC_REG_NUM] = {
-   REG_TXPAUSE, REG_BCN_CTRL,
-   REG_BCN_CTRL_1, REG_GPIO_MUXCFG};
-
+   REG_TXPAUSE, REG_BCN_CTRL,
+   REG_BCN_CTRL_1, REG_GPIO_MUXCFG
+   };
/* since 92C & 92D have the different define in IQK_BB_REG */
u32 iqk_bb_reg_92c[IQK_BB_REG_NUM] = {
- rOFDM0_TRxPathEnable, 
rOFDM0_TRMuxPar,
- rFPGA0_XCD_RFInterfaceSW, 
rConfig_AntA, rConfig_AntB,
- rFPGA0_XAB_RFInterfaceSW, 
rFPGA0_XA_RFInterfaceOE,
- rFPGA0_XB_RFInterfaceOE, 
rFPGA0_RFMOD};
+   rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar,
+   rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB,
+   rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE,
+   rFPGA0_XB_RFInterfaceOE, rFPGA0_RFMOD
+   };
 
u32 retry_count = 9;
 
-- 
2.26.2



[PATCH v2 2/2] staging: rtl8188eu: make some arrays static const

2020-05-24 Thread Michael Straube
Make some arrays in phy_iq_calibrate() static const and adjust
the functions that take these arrays as parameters accordingly.
Reduces object file size by 84 bytes (GCC 9.3.1 x86_64).

Suggested-by: Joe Perches 
Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/phy.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index a0522d6764d6..920688fc9e9f 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -786,7 +786,7 @@ static void pathb_fill_iqk(struct adapter *adapt, bool 
iqkok, s32 result[][8],
}
 }
 
-static void save_adda_registers(struct adapter *adapt, u32 *addareg,
+static void save_adda_registers(struct adapter *adapt, const u32 *addareg,
u32 *backup, u32 register_num)
 {
u32 i;
@@ -795,7 +795,7 @@ static void save_adda_registers(struct adapter *adapt, u32 
*addareg,
backup[i] = phy_query_bb_reg(adapt, addareg[i], bMaskDWord);
 }
 
-static void save_mac_registers(struct adapter *adapt, u32 *mac_reg,
+static void save_mac_registers(struct adapter *adapt, const u32 *mac_reg,
   u32 *backup)
 {
u32 i;
@@ -806,7 +806,7 @@ static void save_mac_registers(struct adapter *adapt, u32 
*mac_reg,
backup[i] = usb_read32(adapt, mac_reg[i]);
 }
 
-static void reload_adda_reg(struct adapter *adapt, u32 *adda_reg,
+static void reload_adda_reg(struct adapter *adapt, const u32 *adda_reg,
u32 *backup, u32 regiester_num)
 {
u32 i;
@@ -815,8 +815,8 @@ static void reload_adda_reg(struct adapter *adapt, u32 
*adda_reg,
phy_set_bb_reg(adapt, adda_reg[i], bMaskDWord, backup[i]);
 }
 
-static void reload_mac_registers(struct adapter *adapt,
-u32 *mac_reg, u32 *backup)
+static void reload_mac_registers(struct adapter *adapt, const u32 *mac_reg,
+u32 *backup)
 {
u32 i;
 
@@ -826,7 +826,7 @@ static void reload_mac_registers(struct adapter *adapt,
usb_write32(adapt, mac_reg[i], backup[i]);
 }
 
-static void path_adda_on(struct adapter *adapt, u32 *adda_reg,
+static void path_adda_on(struct adapter *adapt, const u32 *adda_reg,
 bool is_path_a_on, bool is2t)
 {
u32 path_on;
@@ -844,7 +844,8 @@ static void path_adda_on(struct adapter *adapt, u32 
*adda_reg,
phy_set_bb_reg(adapt, adda_reg[i], bMaskDWord, path_on);
 }
 
-static void mac_setting_calibration(struct adapter *adapt, u32 *mac_reg, u32 
*backup)
+static void mac_setting_calibration(struct adapter *adapt, const u32 *mac_reg,
+   u32 *backup)
 {
u32 i = 0;
 
@@ -952,7 +953,7 @@ static void phy_iq_calibrate(struct adapter *adapt, s32 
result[][8],
struct odm_dm_struct *dm_odm = >HalData->odmpriv;
u32 i;
u8 path_a_ok, path_b_ok;
-   u32 adda_reg[IQK_ADDA_REG_NUM] = {
+   static const u32 adda_reg[IQK_ADDA_REG_NUM] = {
rFPGA0_XCD_SwitchControl, rBlue_Tooth,
rRx_Wait_CCA, rTx_CCK_RFON,
rTx_CCK_BBON, rTx_OFDM_RFON,
@@ -962,12 +963,12 @@ static void phy_iq_calibrate(struct adapter *adapt, s32 
result[][8],
rRx_TO_Rx, rStandby,
rSleep, rPMPD_ANAEN
};
-   u32 iqk_mac_reg[IQK_MAC_REG_NUM] = {
+   static const u32 iqk_mac_reg[IQK_MAC_REG_NUM] = {
REG_TXPAUSE, REG_BCN_CTRL,
REG_BCN_CTRL_1, REG_GPIO_MUXCFG
};
/* since 92C & 92D have the different define in IQK_BB_REG */
-   u32 iqk_bb_reg_92c[IQK_BB_REG_NUM] = {
+   static const u32 iqk_bb_reg_92c[IQK_BB_REG_NUM] = {
rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar,
rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB,
rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE,
-- 
2.26.2



[PATCH] staging: rtl8188eu: clean up some declarations

2020-05-24 Thread Michael Straube
Clean up some array declarations in phy_iq_calibrate() to reduce
indentation and clear line over 80 characters checkpatch warnings.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/phy.c | 33 +++--
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index 5eca3625d5a8..a0522d6764d6 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -953,25 +953,26 @@ static void phy_iq_calibrate(struct adapter *adapt, s32 
result[][8],
u32 i;
u8 path_a_ok, path_b_ok;
u32 adda_reg[IQK_ADDA_REG_NUM] = {
- rFPGA0_XCD_SwitchControl, rBlue_Tooth,
- rRx_Wait_CCA, rTx_CCK_RFON,
- rTx_CCK_BBON, rTx_OFDM_RFON,
- rTx_OFDM_BBON, rTx_To_Rx,
- rTx_To_Tx, rRx_CCK,
- rRx_OFDM, rRx_Wait_RIFS,
- rRx_TO_Rx, rStandby,
- rSleep, rPMPD_ANAEN};
-
+   rFPGA0_XCD_SwitchControl, rBlue_Tooth,
+   rRx_Wait_CCA, rTx_CCK_RFON,
+   rTx_CCK_BBON, rTx_OFDM_RFON,
+   rTx_OFDM_BBON, rTx_To_Rx,
+   rTx_To_Tx, rRx_CCK,
+   rRx_OFDM, rRx_Wait_RIFS,
+   rRx_TO_Rx, rStandby,
+   rSleep, rPMPD_ANAEN
+   };
u32 iqk_mac_reg[IQK_MAC_REG_NUM] = {
-   REG_TXPAUSE, REG_BCN_CTRL,
-   REG_BCN_CTRL_1, REG_GPIO_MUXCFG};
-
+   REG_TXPAUSE, REG_BCN_CTRL,
+   REG_BCN_CTRL_1, REG_GPIO_MUXCFG
+   };
/* since 92C & 92D have the different define in IQK_BB_REG */
u32 iqk_bb_reg_92c[IQK_BB_REG_NUM] = {
- rOFDM0_TRxPathEnable, 
rOFDM0_TRMuxPar,
- rFPGA0_XCD_RFInterfaceSW, 
rConfig_AntA, rConfig_AntB,
- rFPGA0_XAB_RFInterfaceSW, 
rFPGA0_XA_RFInterfaceOE,
- rFPGA0_XB_RFInterfaceOE, 
rFPGA0_RFMOD};
+   rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar,
+   rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB,
+   rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE,
+   rFPGA0_XB_RFInterfaceOE, rFPGA0_RFMOD
+   };
 
u32 retry_count = 9;
 
-- 
2.26.2



[PATCH 3/3] staging: rtl8188eu: remove blank lines

2019-10-15 Thread Michael Straube
Remove blank lines to reduce whitespace and improve readability.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 1e261ff8f0a0..af8a79ce8736 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -749,11 +749,9 @@ void HTOnAssocRsp(struct adapter *padapter)
 * AMPDU_para [4:2]:Min MPDU Start Spacing
 */
max_ampdu_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03;
-
min_mpdu_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
 
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, _mpdu_spacing);
-
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, _ampdu_len);
 }
 
-- 
2.23.0



[PATCH 2/3] staging: rtl8188eu: convert variables from unsigned char to u8

2019-10-15 Thread Michael Straube
Convert the local variables max_ampdu_len and min_mpdu_spacing from
unsigned char to u8 and remove unnecessary castings to u8 pointer.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 6d56ca7ee7b4..1e261ff8f0a0 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -729,8 +729,8 @@ void HT_info_handler(struct adapter *padapter, struct 
ndis_802_11_var_ie *pIE)
 
 void HTOnAssocRsp(struct adapter *padapter)
 {
-   unsigned char max_ampdu_len;
-   unsigned char min_mpdu_spacing;
+   u8 max_ampdu_len;
+   u8 min_mpdu_spacing;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
@@ -752,9 +752,9 @@ void HTOnAssocRsp(struct adapter *padapter)
 
min_mpdu_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
 
-   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 
*)(_mpdu_spacing));
+   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, _mpdu_spacing);
 
-   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 
*)(_ampdu_len));
+   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, _ampdu_len);
 }
 
 void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
-- 
2.23.0



[PATCH 1/3] staging: rtl8188eu: rename variables to avoid mixed case

2019-10-15 Thread Michael Straube
Rename local variables to avoid mixed case.

max_AMPDU_len -> max_ampdu_len
min_MPDU_spacing -> min_mpdu_spacing

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 24 +--
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index c985b1468d41..6d56ca7ee7b4 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -667,7 +667,7 @@ static void bwmode_update_check(struct adapter *padapter, 
struct ndis_802_11_var
 void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
 {
unsigned int i;
-   u8 max_AMPDU_len, min_MPDU_spacing;
+   u8 max_ampdu_len, min_mpdu_spacing;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = >mlmext_info;
struct mlme_priv *pmlmepriv = >mlmepriv;
@@ -689,16 +689,16 @@ void HT_caps_handler(struct adapter *padapter, struct 
ndis_802_11_var_ie *pIE)
} else {
/* modify from  fw by Thomas 2010/11/17 */
if ((pmlmeinfo->HT_caps.ampdu_params_info & 0x3) > 
(pIE->data[i] & 0x3))
-   max_AMPDU_len = pIE->data[i] & 0x3;
+   max_ampdu_len = pIE->data[i] & 0x3;
else
-   max_AMPDU_len = 
pmlmeinfo->HT_caps.ampdu_params_info & 0x3;
+   max_ampdu_len = 
pmlmeinfo->HT_caps.ampdu_params_info & 0x3;
 
if ((pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) > 
(pIE->data[i] & 0x1c))
-   min_MPDU_spacing = 
pmlmeinfo->HT_caps.ampdu_params_info & 0x1c;
+   min_mpdu_spacing = 
pmlmeinfo->HT_caps.ampdu_params_info & 0x1c;
else
-   min_MPDU_spacing = pIE->data[i] & 0x1c;
+   min_mpdu_spacing = pIE->data[i] & 0x1c;
 
-   pmlmeinfo->HT_caps.ampdu_params_info = max_AMPDU_len | 
min_MPDU_spacing;
+   pmlmeinfo->HT_caps.ampdu_params_info = max_ampdu_len | 
min_mpdu_spacing;
}
}
 
@@ -729,8 +729,8 @@ void HT_info_handler(struct adapter *padapter, struct 
ndis_802_11_var_ie *pIE)
 
 void HTOnAssocRsp(struct adapter *padapter)
 {
-   unsigned char max_AMPDU_len;
-   unsigned char min_MPDU_spacing;
+   unsigned char max_ampdu_len;
+   unsigned char min_mpdu_spacing;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
@@ -748,13 +748,13 @@ void HTOnAssocRsp(struct adapter *padapter)
 * AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
 * AMPDU_para [4:2]:Min MPDU Start Spacing
 */
-   max_AMPDU_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03;
+   max_ampdu_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03;
 
-   min_MPDU_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
+   min_mpdu_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
 
-   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 
*)(_MPDU_spacing));
+   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 
*)(_mpdu_spacing));
 
-   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 
*)(_AMPDU_len));
+   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 
*)(_ampdu_len));
 }
 
 void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
-- 
2.23.0



[PATCH 2/2] staging: rtl8188eu: remove unnecessary conversion to bool

2019-10-13 Thread Michael Straube
Comparsions evaluate to bool, explicit conversion with ternary
operator is overly verbose and unnecessary, so remove it.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index 7b16632048b7..03dc7e5fcc38 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -514,7 +514,7 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
pwrctrlpriv->power_mgnt = PS_MODE_ACTIVE;
else
pwrctrlpriv->power_mgnt = padapter->registrypriv.power_mgnt;/*  
PS_MODE_MIN; */
-   pwrctrlpriv->bLeisurePs = (pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE) ? 
true : false;
+   pwrctrlpriv->bLeisurePs = (pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE);
 
pwrctrlpriv->bFwCurrentInPSMode = false;
 
@@ -621,7 +621,7 @@ int rtw_pm_set_lps(struct adapter *padapter, u8 mode)
else
pwrctrlpriv->LpsIdleCount = 2;
pwrctrlpriv->power_mgnt = mode;
-   pwrctrlpriv->bLeisurePs = (pwrctrlpriv->power_mgnt != 
PS_MODE_ACTIVE) ? true : false;
+   pwrctrlpriv->bLeisurePs = (pwrctrlpriv->power_mgnt != 
PS_MODE_ACTIVE);
}
} else {
ret = -EINVAL;
-- 
2.23.0



[PATCH 1/2] staging: rtl8188eu: remove braces from single statement if block

2019-10-13 Thread Michael Straube
Remove braces from single statement if block to comply with kernel
coding style. Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 1ec3b237212e..e764436e120f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -2045,9 +2045,9 @@ void _rtw_roaming(struct adapter *padapter, struct 
wlan_network *tgt_network)
 
while (1) {
do_join_r = rtw_do_join(padapter);
-   if (do_join_r == _SUCCESS) {
+   if (do_join_r == _SUCCESS)
break;
-   }
+
DBG_88E("roaming do_join return %d\n", do_join_r);
pmlmepriv->to_roaming--;
 
-- 
2.23.0



[PATCH] staging: rtl8188eu: remove unnecessary asignment and initialization

2019-10-05 Thread Michael Straube
Variable badworden is asigned in two subsequent lines. So the first
asignment is useless and not needed. Also the initialization to zero
is not needed. Remove the first asignment and the initialization.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_efuse.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c 
b/drivers/staging/rtl8188eu/core/rtw_efuse.c
index 02c476f45b33..d191dbef0bb3 100644
--- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
+++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
@@ -615,10 +615,9 @@ static bool hal_EfusePgPacketWrite1ByteHeader(struct 
adapter *pAdapter, u8 efuse
 static bool hal_EfusePgPacketWriteData(struct adapter *pAdapter, u8 efuseType, 
u16 *pAddr, struct pgpkt *pTargetPkt)
 {
u16 efuse_addr = *pAddr;
-   u8 badworden = 0;
+   u8 badworden;
u32 PgWriteSuccess = 0;
 
-   badworden = 0x0f;
badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr + 1, 
pTargetPkt->word_en, pTargetPkt->data);
if (badworden == 0x0F) {
/*  write ok */
-- 
2.23.0



[PATCH 4/4] staging: rtl8188eu: cleanup comments in update_hw_ht_param

2019-10-03 Thread Michael Straube
Cleanup comments in update_hw_ht_param to follow kernel coding style
and avoid line length over 80 characters.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 97cab71cef23..9aa44c921aca 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -567,20 +567,17 @@ static void update_hw_ht_param(struct adapter *padapter)
 
DBG_88E("%s\n", __func__);
 
-   /* handle A-MPDU parameter field */
-   /*
-   ampdu_params_info [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 
3:64k
-   ampdu_params_info [4:2]:Min MPDU Start Spacing
-   */
+   /* handle A-MPDU parameter field
+* ampdu_params_info [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
+* ampdu_params_info [4:2]:Min MPDU Start Spacing
+*/
max_ampdu_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03;
min_mpdu_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
 
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, _mpdu_spacing);
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, _ampdu_len);
 
-   /*  */
-   /*  Config SM Power Save setting */
-   /*  */
+   /* Config SM Power Save setting */
pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & 0x0C) >> 
2;
if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC)
DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __func__);
-- 
2.23.0



[PATCH 3/4] staging: rtl8188eu: cleanup whitespace in update_hw_ht_param

2019-10-03 Thread Michael Straube
Replace tabs with spaces in declarations and reomve two blank lines in
update_hw_ht_param to cleanup whitespace and improve readability.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 75c34e8f2335..97cab71cef23 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -562,8 +562,8 @@ static void update_hw_ht_param(struct adapter *padapter)
 {
u8 max_ampdu_len;
u8 min_mpdu_spacing;
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
+   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
DBG_88E("%s\n", __func__);
 
@@ -573,11 +573,9 @@ static void update_hw_ht_param(struct adapter *padapter)
ampdu_params_info [4:2]:Min MPDU Start Spacing
*/
max_ampdu_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03;
-
min_mpdu_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
 
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, _mpdu_spacing);
-
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, _ampdu_len);
 
/*  */
-- 
2.23.0



[PATCH 0/4] staging: rtl8188eu: cleanups in update_hw_ht_param()

2019-10-03 Thread Michael Straube
Cleanup code in function update_hw_ht_param(). 

Michael Straube (4):
  staging: rtl8188eu: convert variables from unsigned char to u8
  staging: rtl8188eu: rename variables to avoid mixed case
  staging: rtl8188eu: cleanup whitespace in update_hw_ht_param
  staging: rtl8188eu: cleanup comments in update_hw_ht_param

 drivers/staging/rtl8188eu/core/rtw_ap.c | 31 +++--
 1 file changed, 13 insertions(+), 18 deletions(-)

-- 
2.23.0



[PATCH 1/4] staging: rtl8188eu: convert variables from unsigned char to u8

2019-10-03 Thread Michael Straube
Convert the local variables max_AMPDU_len and min_MPDU_spacing from
unsigned char to u8 and remove unnecessary castings to u8 pointer.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 51a5b71f8c25..1e4461a74474 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -560,8 +560,8 @@ void update_sta_info_apmode(struct adapter *padapter, 
struct sta_info *psta)
 
 static void update_hw_ht_param(struct adapter *padapter)
 {
-   unsigned char   max_AMPDU_len;
-   unsigned char   min_MPDU_spacing;
+   u8 max_AMPDU_len;
+   u8 min_MPDU_spacing;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
@@ -576,9 +576,9 @@ static void update_hw_ht_param(struct adapter *padapter)
 
min_MPDU_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
 
-   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 
*)(_MPDU_spacing));
+   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, _MPDU_spacing);
 
-   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 
*)(_AMPDU_len));
+   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, _AMPDU_len);
 
/*  */
/*  Config SM Power Save setting */
-- 
2.23.0



[PATCH 2/4] staging: rtl8188eu: rename variables to avoid mixed case

2019-10-03 Thread Michael Straube
Rename the local varibles max_AMPDU_len and min_MPDU_spacing to avoid
mixed case.

max_AMPDU_len -> max_ampdu_len
min_MPDU_spacing -> min_mpdu_spacing

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 1e4461a74474..75c34e8f2335 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -560,8 +560,8 @@ void update_sta_info_apmode(struct adapter *padapter, 
struct sta_info *psta)
 
 static void update_hw_ht_param(struct adapter *padapter)
 {
-   u8 max_AMPDU_len;
-   u8 min_MPDU_spacing;
+   u8 max_ampdu_len;
+   u8 min_mpdu_spacing;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
@@ -572,13 +572,13 @@ static void update_hw_ht_param(struct adapter *padapter)
ampdu_params_info [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 
3:64k
ampdu_params_info [4:2]:Min MPDU Start Spacing
*/
-   max_AMPDU_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03;
+   max_ampdu_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03;
 
-   min_MPDU_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
+   min_mpdu_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
 
-   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, _MPDU_spacing);
+   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, _mpdu_spacing);
 
-   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, _AMPDU_len);
+   rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, _ampdu_len);
 
/*  */
/*  Config SM Power Save setting */
-- 
2.23.0



[PATCH] staging: rtl8723bs: remove unused function write_cam_from_cache

2019-09-26 Thread Michael Straube
Function write_cam_from_cache in rtw_wlan_util.c is never used,
so remove it.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c   | 13 -
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h |  1 -
 2 files changed, 14 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 5ab98f3e722e..3933e8637e57 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -606,19 +606,6 @@ inline void clear_cam_entry(struct adapter *adapter, u8 id)
clear_cam_cache(adapter, id);
 }
 
-inline void write_cam_from_cache(struct adapter *adapter, u8 id)
-{
-   struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
-   struct cam_ctl_t *cam_ctl = >cam_ctl;
-   struct cam_entry_cache cache;
-
-   spin_lock_bh(_ctl->lock);
-   memcpy(, >cam_cache[id], sizeof(struct cam_entry_cache));
-   spin_unlock_bh(_ctl->lock);
-
-   _write_cam(adapter, id, cache.ctrl, cache.mac, cache.key);
-}
-
 void write_cam_cache(struct adapter *adapter, u8 id, u16 ctrl, u8 *mac, u8 
*key)
 {
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index fd3cf955c9f8..73e8ec09b6e1 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -576,7 +576,6 @@ void read_cam(struct adapter *padapter , u8 entry, u8 
*get_key);
 /* modify HW only */
 void _write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 
*key);
 void _clear_cam_entry(struct adapter *padapter, u8 entry);
-void write_cam_from_cache(struct adapter *adapter, u8 id);
 
 /* modify both HW and cache */
 void write_cam(struct adapter *padapter, u8 id, u16 ctrl, u8 *mac, u8 *key);
-- 
2.23.0



[PATCH] staging: exfat: add missing SPDX line to Kconfig

2019-09-17 Thread Michael Straube
Add SPDX identifier to Kconfig.

Signed-off-by: Michael Straube 
---
 drivers/staging/exfat/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/exfat/Kconfig b/drivers/staging/exfat/Kconfig
index 290dbfc7ace1..59e07afe249c 100644
--- a/drivers/staging/exfat/Kconfig
+++ b/drivers/staging/exfat/Kconfig
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
 config EXFAT_FS
tristate "exFAT fs support"
depends on BLOCK
-- 
2.23.0



[PATCH] staging: rtl8723bs: remove return statements from void functions

2019-09-14 Thread Michael Straube
Remove unnecessary return statements from void functions reported by
checkpatch.

WARNING: void function return statements are not generally useful

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c |  5 -
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 10 --
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c  |  1 -
 drivers/staging/rtl8723bs/core/rtw_security.c |  1 -
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c|  2 --
 drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c|  2 --
 drivers/staging/rtl8723bs/hal/odm_DIG.c   |  1 -
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c |  1 -
 drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c|  2 --
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c |  1 -
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c  |  1 -
 11 files changed, 27 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 34adf5789c98..4000125054c3 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -329,7 +329,6 @@ void rtw_generate_random_ibss(u8 *pibss)
pibss[3] = (u8)(curtime & 0xff) ;/* p[0]; */
pibss[4] = (u8)((curtime>>8) & 0xff) ;/* p[1]; */
pibss[5] = (u8)((curtime>>16) & 0xff) ;/* p[2]; */
-   return;
 }
 
 u8 *rtw_get_capability_from_ie(u8 *ie)
@@ -832,8 +831,6 @@ void rtw_survey_event_callback(struct adapter   
*adapter, u8 *pbuf)
 exit:
 
spin_unlock_bh(>lock);
-
-   return;
 }
 
 
@@ -1840,8 +1837,6 @@ void rtw_mlme_reset_auto_scan_int(struct adapter *adapter)
mlme->auto_scan_int_ms = mlme->roam_scan_int_ms;
} else
mlme->auto_scan_int_ms = 0; /* disabled */
-
-   return;
 }
 
 static void rtw_auto_scan_handler(struct adapter *padapter)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 2128886c9924..4f812cd19b31 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -3086,8 +3086,6 @@ void issue_auth(struct adapter *padapter, struct sta_info 
*psta, unsigned short
rtw_wep_encrypt(padapter, (u8 *)pmgntframe);
DBG_871X("%s\n", __func__);
dump_mgntframe(padapter, pmgntframe);
-
-   return;
 }
 
 
@@ -3405,8 +3403,6 @@ void issue_assocreq(struct adapter *padapter)
rtw_buf_update(>assoc_req, 
>assoc_req_len, (u8 *)pwlanhdr, pattrib->pktlen);
else
rtw_buf_free(>assoc_req, >assoc_req_len);
-
-   return;
 }
 
 /* when wait_ack is ture, this function shoule be called at process context */
@@ -5260,8 +5256,6 @@ void report_del_sta_event(struct adapter *padapter, 
unsigned char *MacAddr, unsi
DBG_871X("report_del_sta_event: delete STA, mac_id =%d\n", mac_id);
 
rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-
-   return;
 }
 
 void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, 
int cam_idx)
@@ -5306,8 +5300,6 @@ void report_add_sta_event(struct adapter *padapter, 
unsigned char *MacAddr, int
DBG_871X("report_add_sta_event: add STA\n");
 
rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-
-   return;
 }
 
 /
@@ -5869,8 +5861,6 @@ void link_timer_hdl(struct timer_list *t)
issue_assocreq(padapter);
set_link_timer(pmlmeext, REASSOC_TO);
}
-
-   return;
 }
 
 void addba_timer_hdl(struct timer_list *t)
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index 4075de07e0a9..30137f0bd984 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -190,7 +190,6 @@ void rtw_ps_processor(struct adapter *padapter)
}
 exit:
pwrpriv->ps_processing = false;
-   return;
 }
 
 static void pwr_state_check_handler(struct timer_list *t)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c 
b/drivers/staging/rtl8723bs/core/rtw_security.c
index 57cfe06d7d73..5ffaf9bfa6e8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -309,7 +309,6 @@ void rtw_wep_decrypt(struct adapter  *padapter, u8 
*precvframe)
 
WEP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
}
-   return;
 }
 
 /* 3   =TKIP related = */
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index ea3ea2a6b314..5ab98f3e722e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1170,8 +1170,6 @@ void HT_info_handler(struct adapter *padapter, struct 
ndis_80211_var_ie *pIE)
 
pmlm

[PATCH] staging: rtl8188eu: cleanup long line in rtw_mlme_ext.c

2019-09-12 Thread Michael Straube
Remove comparsion to NULL and unnecessary parentheses to avoid line
length over 80 characters and follow kernel coding style.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 18dc9fc1c04a..e984b4605e91 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -507,7 +507,7 @@ static void issue_probersp(struct adapter *padapter, 
unsigned char *da)
pwps_ie = rtw_get_wps_ie(cur_network->ies+_FIXED_IE_LENGTH_, 
cur_network->ie_length-_FIXED_IE_LENGTH_, NULL, _ielen);
 
/* inerset & update wps_probe_resp_ie */
-   if ((pmlmepriv->wps_probe_resp_ie != NULL) && pwps_ie && 
(wps_ielen > 0)) {
+   if (pmlmepriv->wps_probe_resp_ie && pwps_ie && wps_ielen > 0) {
uint wps_offset, remainder_ielen;
u8 *premainder_ie;
 
-- 
2.23.0



[PATCH 1/3] rtlwifi: rtl8192ce: replace _rtl92c_evm_db_to_percentage with generic version

2019-09-10 Thread Michael Straube
Function _rtl92c_evm_db_to_percentage is functionally identical
to the generic version rtl_evm_db_to_percentage, so remove
_rtl92c_evm_db_to_percentage and use the generic version instead.

Signed-off-by: Michael Straube 
---
 .../wireless/realtek/rtlwifi/rtl8192ce/trx.c  | 23 +--
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
index 123dbf0903a1..fc9a3aae047f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
@@ -33,27 +33,6 @@ static u8 _rtl92c_query_rxpwrpercentage(s8 antpower)
return 100 + antpower;
 }
 
-static u8 _rtl92c_evm_db_to_percentage(s8 value)
-{
-   s8 ret_val;
-
-   ret_val = value;
-
-   if (ret_val >= 0)
-   ret_val = 0;
-
-   if (ret_val <= -33)
-   ret_val = -33;
-
-   ret_val = 0 - ret_val;
-   ret_val *= 3;
-
-   if (ret_val == 99)
-   ret_val = 100;
-
-   return ret_val;
-}
-
 static long _rtl92ce_signal_scale_mapping(struct ieee80211_hw *hw,
long currsig)
 {
@@ -243,7 +222,7 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw 
*hw,
max_spatial_stream = 1;
 
for (i = 0; i < max_spatial_stream; i++) {
-   evm = _rtl92c_evm_db_to_percentage(p_drvinfo->rxevm[i]);
+   evm = rtl_evm_db_to_percentage(p_drvinfo->rxevm[i]);
 
if (packet_match_bssid) {
/* Fill value in RFD, Get the first
-- 
2.23.0



[PATCH 3/3] rtlwifi: rtl8192de: replace _rtl92d_evm_db_to_percentage with generic version

2019-09-10 Thread Michael Straube
Function _rtl92d_evm_db_to_percentage is functionally identical
to the generic version rtl_evm_db_to_percentage, so remove
_rtl92d_evm_db_to_percentage and use the generic version instead.

Signed-off-by: Michael Straube 
---
 .../wireless/realtek/rtlwifi/rtl8192de/trx.c   | 18 ++
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
index d162884a9e00..2494e1f118f8 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
@@ -4,6 +4,7 @@
 #include "../wifi.h"
 #include "../pci.h"
 #include "../base.h"
+#include "../stats.h"
 #include "reg.h"
 #include "def.h"
 #include "phy.h"
@@ -32,21 +33,6 @@ static u8 _rtl92d_query_rxpwrpercentage(s8 antpower)
return 100 + antpower;
 }
 
-static u8 _rtl92d_evm_db_to_percentage(s8 value)
-{
-   s8 ret_val = value;
-
-   if (ret_val >= 0)
-   ret_val = 0;
-   if (ret_val <= -33)
-   ret_val = -33;
-   ret_val = 0 - ret_val;
-   ret_val *= 3;
-   if (ret_val == 99)
-   ret_val = 100;
-   return ret_val;
-}
-
 static long _rtl92de_translate_todbm(struct ieee80211_hw *hw,
 u8 signal_strength_index)
 {
@@ -215,7 +201,7 @@ static void _rtl92de_query_rxphystatus(struct ieee80211_hw 
*hw,
else
max_spatial_stream = 1;
for (i = 0; i < max_spatial_stream; i++) {
-   evm = _rtl92d_evm_db_to_percentage(p_drvinfo->rxevm[i]);
+   evm = rtl_evm_db_to_percentage(p_drvinfo->rxevm[i]);
if (packet_match_bssid) {
if (i == 0)
pstats->signalquality =
-- 
2.23.0



[PATCH 0/3] rtlwifi: use generic rtl_evm_db_to_percentage

2019-09-10 Thread Michael Straube
Functions _rtl92{c,d}_evm_db_to_percentage are functionally identical
to the generic version rtl_evm_db_to percentage. This series converts
rtl8192ce, rtl8192cu and rtl8192de to use the generic version.

Michael Straube (3):
  rtlwifi: rtl8192ce: replace _rtl92c_evm_db_to_percentage with generic
version
  rtlwifi: rtl8192cu: replace _rtl92c_evm_db_to_percentage with generic
version
  rtlwifi: rtl8192de: replace _rtl92d_evm_db_to_percentage with generic
version

 .../wireless/realtek/rtlwifi/rtl8192ce/trx.c  | 23 +--
 .../wireless/realtek/rtlwifi/rtl8192cu/mac.c  | 18 +--
 .../wireless/realtek/rtlwifi/rtl8192de/trx.c  | 18 ++-
 3 files changed, 4 insertions(+), 55 deletions(-)

-- 
2.23.0



[PATCH 2/3] rtlwifi: rtl8192cu: replace _rtl92c_evm_db_to_percentage with generic version

2019-09-10 Thread Michael Straube
Function _rtl92c_evm_db_to_percentage is functionally identical
to the generic version rtl_evm_db_to_percentage, so remove
_rtl92c_evm_db_to_percentage and use the generic version instead.

Signed-off-by: Michael Straube 
---
 .../wireless/realtek/rtlwifi/rtl8192cu/mac.c   | 18 +-
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
index c8daad1e749f..cec19b32c7e2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
@@ -577,22 +577,6 @@ static u8 _rtl92c_query_rxpwrpercentage(s8 antpower)
return 100 + antpower;
 }
 
-static u8 _rtl92c_evm_db_to_percentage(s8 value)
-{
-   s8 ret_val;
-
-   ret_val = value;
-   if (ret_val >= 0)
-   ret_val = 0;
-   if (ret_val <= -33)
-   ret_val = -33;
-   ret_val = 0 - ret_val;
-   ret_val *= 3;
-   if (ret_val == 99)
-   ret_val = 100;
-   return ret_val;
-}
-
 static long _rtl92c_signal_scale_mapping(struct ieee80211_hw *hw,
long currsig)
 {
@@ -743,7 +727,7 @@ static void _rtl92c_query_rxphystatus(struct ieee80211_hw 
*hw,
else
max_spatial_stream = 1;
for (i = 0; i < max_spatial_stream; i++) {
-   evm = _rtl92c_evm_db_to_percentage(p_drvinfo->rxevm[i]);
+   evm = rtl_evm_db_to_percentage(p_drvinfo->rxevm[i]);
if (packet_match_bssid) {
if (i == 0)
pstats->signalquality =
-- 
2.23.0



[PATCH 3/6] staging: rtl8188eu: add spaces around '|' in usb_halinit.c

2019-07-26 Thread Michael Straube
Add spaces around '|' to improve readability and follow kernel
coding style. Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index fe68af7eaf85..9fa34c5c11c4 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -925,7 +925,7 @@ static void CardDisableRTL8188EU(struct adapter *Adapter)
val8 = usb_read8(Adapter, REG_GPIO_IO_SEL);
usb_write8(Adapter, REG_GPIO_IO_SEL, (val8<<4));
val8 = usb_read8(Adapter, REG_GPIO_IO_SEL + 1);
-   usb_write8(Adapter, REG_GPIO_IO_SEL + 1, val8|0x0F);/* Reg0x43 */
+   usb_write8(Adapter, REG_GPIO_IO_SEL + 1, val8 | 0x0F);/* Reg0x43 */
usb_write32(Adapter, REG_BB_PAD_CTRL, 0x00080808);/* set LNA 
,TRSW,EX_PA Pin to output mode */
Adapter->HalData->bMacPwrCtrlOn = false;
Adapter->bFWReady = false;
@@ -1176,7 +1176,7 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 
variable, u8 *val)
 
/* enable BCN0 Function for if1 */
/* don't enable update TSF0 for if1 (due to TSF update when 
beacon/probe rsp are received) */
-   usb_write8(Adapter, REG_BCN_CTRL, 
(DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION | BIT(1)));
+   usb_write8(Adapter, REG_BCN_CTRL, (DIS_TSF_UDT0_NORMAL_CHIP | 
EN_BCN_FUNCTION | BIT(1)));
 
/* dis BCN1 ATIM  WND if if2 is station */
usb_write8(Adapter, REG_BCN_CTRL_1, usb_read8(Adapter, 
REG_BCN_CTRL_1) | BIT(0));
@@ -1318,7 +1318,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
break;
case HW_VAR_CHECK_BSSID:
if (*((u8 *)val)) {
-   usb_write32(Adapter, REG_RCR, usb_read32(Adapter, 
REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN);
+   usb_write32(Adapter, REG_RCR, usb_read32(Adapter, 
REG_RCR) | RCR_CBSSID_DATA | RCR_CBSSID_BCN);
} else {
u32 val32;
 
@@ -1369,7 +1369,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
usb_write8(Adapter, REG_BCN_CTRL, 
usb_read8(Adapter, REG_BCN_CTRL) & (~BIT(4)));
}
 
-   usb_write32(Adapter, REG_RCR, usb_read32(Adapter, 
REG_RCR)|RCR_CBSSID_BCN);
+   usb_write32(Adapter, REG_RCR, usb_read32(Adapter, 
REG_RCR) | RCR_CBSSID_BCN);
}
break;
case HW_VAR_MLME_JOIN:
@@ -1382,7 +1382,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
/* enable to rx data frame.Accept all data 
frame */
usb_write16(Adapter, REG_RXFLTMAP2, 0x);
 
-   usb_write32(Adapter, REG_RCR, 
usb_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN);
+   usb_write32(Adapter, REG_RCR, 
usb_read32(Adapter, REG_RCR) | RCR_CBSSID_DATA | RCR_CBSSID_BCN);
 
if (check_fwstate(pmlmepriv, 
WIFI_STATION_STATE))
RetryLimit = (haldata->CustomerID == 
RT_CID_CCX) ? 7 : 48;
@@ -1396,7 +1396,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
/* enable update TSF */
usb_write8(Adapter, REG_BCN_CTRL, 
usb_read8(Adapter, REG_BCN_CTRL) & (~BIT(4)));
 
-   if (check_fwstate(pmlmepriv, 
WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE))
+   if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE | 
WIFI_ADHOC_MASTER_STATE))
RetryLimit = 0x7;
}
usb_write16(Adapter, REG_RL, RetryLimit << 
RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT);
@@ -1485,7 +1485,8 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
ulContent = 0;
/*  polling bit, and No Write enable, and 
address */
ulCommand = CAM_CONTENT_COUNT*ucIndex + i;
-   ulCommand = ulCommand | CAM_POLLINIG|CAM_WRITE;
+   ulCommand = ulCommand | CAM_POLLINIG |
+   CAM_WRITE;
/*  write content 0 is equall to mark invalid */
usb_write32(Adapter, WCAMI, ulContent);  /* 
delay_ms(40); */
usb_write32(Adapter, RWCAM, ulCommand);  /* 
delay_ms(40); */
@@ -1681,7 +1682,7 @@ void rtw_hal_set_hwreg(struct a

[PATCH 4/6] staging: rtl8188eu: add spaces around '<<' and '>>' in usb_halinit.c

2019-07-26 Thread Michael Straube
Add spaces around '<<' and '>>' to improve readability and follow
kernel coding style. Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 9fa34c5c11c4..40162f95 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -923,7 +923,7 @@ static void CardDisableRTL8188EU(struct adapter *Adapter)
usb_write8(Adapter, GPIO_IO_SEL, 0xFF);/* Reg0x46 */
 
val8 = usb_read8(Adapter, REG_GPIO_IO_SEL);
-   usb_write8(Adapter, REG_GPIO_IO_SEL, (val8<<4));
+   usb_write8(Adapter, REG_GPIO_IO_SEL, (val8 << 4));
val8 = usb_read8(Adapter, REG_GPIO_IO_SEL + 1);
usb_write8(Adapter, REG_GPIO_IO_SEL + 1, val8 | 0x0F);/* Reg0x43 */
usb_write32(Adapter, REG_BB_PAD_CTRL, 0x00080808);/* set LNA 
,TRSW,EX_PA Pin to output mode */
@@ -1307,7 +1307,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
usb_write8(Adapter, REG_BCN_CTRL, usb_read8(Adapter, 
REG_BCN_CTRL) & (~BIT(3)));
 
usb_write32(Adapter, REG_TSFTR, tsf);
-   usb_write32(Adapter, REG_TSFTR + 4, tsf>>32);
+   usb_write32(Adapter, REG_TSFTR + 4, tsf >> 32);
 
/* enable related TSF function */
usb_write8(Adapter, REG_BCN_CTRL, usb_read8(Adapter, 
REG_BCN_CTRL) | BIT(3));
@@ -1442,7 +1442,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
u8 regTmp;
u8 bShortPreamble = *((bool *)val);
/*  Joseph marked out for Netgear 3500 TKIP channel 7 
issue.(Temporarily) */
-   regTmp = (haldata->nCur40MhzPrimeSC)<<5;
+   regTmp = (haldata->nCur40MhzPrimeSC) << 5;
if (bShortPreamble)
regTmp |= 0x80;
 
@@ -1480,7 +1480,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
for (i = 0; i < CAM_CONTENT_COUNT; i++) {
/*  filled id in CAM config 2 byte */
if (i == 0)
-   ulContent |= (ucIndex & 0x03) | 
((u16)(ulEncAlgo)<<2);
+   ulContent |= (ucIndex & 0x03) | 
((u16)(ulEncAlgo) << 2);
else
ulContent = 0;
/*  polling bit, and No Write enable, and 
address */
@@ -1590,8 +1590,8 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
FactorToSet = 0xf;
 
for (index = 0; index < 4; index++) {
-   if ((pRegToSet[index] & 0xf0) > 
(FactorToSet<<4))
-   pRegToSet[index] = 
(pRegToSet[index] & 0x0f) | (FactorToSet<<4);
+   if ((pRegToSet[index] & 0xf0) > 
(FactorToSet << 4))
+   pRegToSet[index] = 
(pRegToSet[index] & 0x0f) | (FactorToSet << 4);
 
if ((pRegToSet[index] & 0x0f) > 
FactorToSet)
pRegToSet[index] = 
(pRegToSet[index] & 0xf0) | (FactorToSet);
-- 
2.22.0



[PATCH 5/6] staging: rtl8188eu: add spaces around '-' and '*' in usb_halinit.c

2019-07-26 Thread Michael Straube
Add spaces around '-' and '*' to improve readability and follow kernel
coding style. Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 40162f95..0f54fde2f47b 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -190,7 +190,7 @@ static void _InitPageBoundary(struct adapter *Adapter)
 {
/*  RX Page Boundary */
/*  */
-   u16 rxff_bndy = MAX_RX_DMA_BUFFER_SIZE_88E-1;
+   u16 rxff_bndy = MAX_RX_DMA_BUFFER_SIZE_88E - 1;
 
usb_write16(Adapter, (REG_TRXFF_BNDY + 2), rxff_bndy);
 }
@@ -1298,7 +1298,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
struct mlme_ext_priv*pmlmeext = 
>mlmeextpriv;
struct mlme_ext_info*pmlmeinfo = 
>mlmext_info;
 
-   tsf = pmlmeext->TSFValue - do_div(pmlmeext->TSFValue, 
(pmlmeinfo->bcn_interval*1024)) - 1024; /* us */
+   tsf = pmlmeext->TSFValue - do_div(pmlmeext->TSFValue, 
(pmlmeinfo->bcn_interval * 1024)) - 1024; /* us */
 
if (((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE) 
|| ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE))
StopTxBeacon(Adapter);
@@ -1484,7 +1484,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
else
ulContent = 0;
/*  polling bit, and No Write enable, and 
address */
-   ulCommand = CAM_CONTENT_COUNT*ucIndex + i;
+   ulCommand = CAM_CONTENT_COUNT * ucIndex + i;
ulCommand = ulCommand | CAM_POLLINIG |
CAM_WRITE;
/*  write content 0 is equall to mark invalid */
-- 
2.22.0



[PATCH 2/6] staging: rtl8188eu: add spaces around '&' in usb_halinit.c

2019-07-26 Thread Michael Straube
Add spaces around '&' to improve readability and follow kernel
coding style. Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 38 ++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index c2e1b000cf89..fe68af7eaf85 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -633,7 +633,7 @@ enum rt_rf_power_state RfOnOffDetect(struct adapter *adapt)
DBG_88E("pwrdown, 0x5c(BIT(7))=%02x\n", val8);
rfpowerstate = (val8 & BIT(7)) ? rf_off : rf_on;
} else { /*  rf on/off */
-   usb_write8(adapt, REG_MAC_PINMUX_CFG, usb_read8(adapt, 
REG_MAC_PINMUX_CFG)&~(BIT(3)));
+   usb_write8(adapt, REG_MAC_PINMUX_CFG, usb_read8(adapt, 
REG_MAC_PINMUX_CFG) & ~(BIT(3)));
val8 = usb_read8(adapt, REG_GPIO_IO_SEL);
DBG_88E("GPIO_IN=%02x\n", val8);
rfpowerstate = (val8 & BIT(3)) ? rf_on : rf_off;
@@ -880,7 +880,7 @@ static void CardDisableRTL8188EU(struct adapter *Adapter)
 
/* Stop Tx Report Timer. 0x4EC[Bit1]=b'0 */
val8 = usb_read8(Adapter, REG_TX_RPT_CTRL);
-   usb_write8(Adapter, REG_TX_RPT_CTRL, val8&(~BIT(1)));
+   usb_write8(Adapter, REG_TX_RPT_CTRL, val8 & (~BIT(1)));
 
/*  stop rx */
usb_write8(Adapter, REG_CR, 0x0);
@@ -905,7 +905,7 @@ static void CardDisableRTL8188EU(struct adapter *Adapter)
/* YJ,add,111212 */
/* Disable 32k */
val8 = usb_read8(Adapter, REG_32K_CTRL);
-   usb_write8(Adapter, REG_32K_CTRL, val8&(~BIT(0)));
+   usb_write8(Adapter, REG_32K_CTRL, val8 & (~BIT(0)));
 
/*  Card disable power action flow */
rtl88eu_pwrseqcmdparsing(Adapter, PWR_CUT_ALL_MSK,
@@ -913,7 +913,7 @@ static void CardDisableRTL8188EU(struct adapter *Adapter)
 
/*  Reset MCU IO Wrapper */
val8 = usb_read8(Adapter, REG_RSV_CTRL + 1);
-   usb_write8(Adapter, REG_RSV_CTRL + 1, (val8&(~BIT(3;
+   usb_write8(Adapter, REG_RSV_CTRL + 1, (val8 & (~BIT(3;
val8 = usb_read8(Adapter, REG_RSV_CTRL + 1);
usb_write8(Adapter, REG_RSV_CTRL + 1, val8 | BIT(3));
 
@@ -1135,7 +1135,7 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 
variable, u8 *val)
usb_write8(Adapter, REG_BCN_CTRL, usb_read8(Adapter, REG_BCN_CTRL) | 
BIT(4));
 
/*  set net_type */
-   val8 = usb_read8(Adapter, MSR)&0x0c;
+   val8 = usb_read8(Adapter, MSR) & 0x0c;
val8 |= mode;
usb_write8(Adapter, MSR, val8);
 
@@ -1214,7 +1214,7 @@ static void hw_var_set_bcn_func(struct adapter *Adapter, 
u8 variable, u8 *val)
if (*((u8 *)val))
usb_write8(Adapter, bcn_ctrl_reg, (EN_BCN_FUNCTION | 
EN_TXBCN_RPT));
else
-   usb_write8(Adapter, bcn_ctrl_reg, usb_read8(Adapter, 
bcn_ctrl_reg)&(~(EN_BCN_FUNCTION | EN_TXBCN_RPT)));
+   usb_write8(Adapter, bcn_ctrl_reg, usb_read8(Adapter, 
bcn_ctrl_reg) & (~(EN_BCN_FUNCTION | EN_TXBCN_RPT)));
 }
 
 void rtw_hal_set_hwreg(struct adapter *Adapter, u8 variable, u8 *val)
@@ -1228,7 +1228,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
{
u8 val8;
 
-   val8 = usb_read8(Adapter, MSR)&0x0c;
+   val8 = usb_read8(Adapter, MSR) & 0x0c;
val8 |= *((u8 *)val);
usb_write8(Adapter, MSR, val8);
}
@@ -1275,7 +1275,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
/*  Set RRSR rate table. */
usb_write8(Adapter, REG_RRSR, BrateCfg & 0xff);
usb_write8(Adapter, REG_RRSR + 1, (BrateCfg >> 8) & 
0xff);
-   usb_write8(Adapter, REG_RRSR + 2, usb_read8(Adapter, 
REG_RRSR + 2)&0xf0);
+   usb_write8(Adapter, REG_RRSR + 2, usb_read8(Adapter, 
REG_RRSR + 2) & 0xf0);
 
/*  Set RTS initial rate */
while (BrateCfg > 0x1) {
@@ -1300,11 +1300,11 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
 
tsf = pmlmeext->TSFValue - do_div(pmlmeext->TSFValue, 
(pmlmeinfo->bcn_interval*1024)) - 1024; /* us */
 
-   if (((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || 
((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
+   if (((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE) 
|| ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE))
StopTxBeacon(Adapter);
 
/* disable related TSF function

[PATCH 6/6] staging: rtl8188eu: cleanup comparsion to NULL in usb_halinit.c

2019-07-26 Thread Michael Straube
Use if(!x) instead of if(x == NULL).
Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 0f54fde2f47b..16a57b31a439 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -1889,7 +1889,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 
mac_id, u8 rssi_level)
if (mac_id >= NUM_STA) /* CAM_SIZE */
return;
psta = pmlmeinfo->FW_sta_info[mac_id].psta;
-   if (psta == NULL)
+   if (!psta)
return;
switch (mac_id) {
case 0:/*  for infra mode */
-- 
2.22.0



[PATCH 1/6] staging: rtl8188eu: add spaces around '+' in usb_halinit.c

2019-07-26 Thread Michael Straube
Add spaces around '+' to improve readability and follow kernel
coding style. Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 76 ++---
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 994392ac249b..c2e1b000cf89 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -183,7 +183,7 @@ static void _InitTxBufferBoundary(struct adapter *Adapter, 
u8 txpktbuf_bndy)
usb_write8(Adapter, REG_TXPKTBUF_MGQ_BDNY, txpktbuf_bndy);
usb_write8(Adapter, REG_TXPKTBUF_WMAC_LBK_BF_HD, txpktbuf_bndy);
usb_write8(Adapter, REG_TRXFF_BNDY, txpktbuf_bndy);
-   usb_write8(Adapter, REG_TDECTRL+1, txpktbuf_bndy);
+   usb_write8(Adapter, REG_TDECTRL + 1, txpktbuf_bndy);
 }
 
 static void _InitPageBoundary(struct adapter *Adapter)
@@ -504,7 +504,7 @@ static void usb_AggSettingRxUpdate(struct adapter *Adapter)
switch (haldata->UsbRxAggMode) {
case USB_RX_AGG_DMA:
usb_write8(Adapter, REG_RXDMA_AGG_PG_TH, 
haldata->UsbRxAggPageCount);
-   usb_write8(Adapter, REG_RXDMA_AGG_PG_TH+1, 
haldata->UsbRxAggPageTimeout);
+   usb_write8(Adapter, REG_RXDMA_AGG_PG_TH + 1, 
haldata->UsbRxAggPageTimeout);
break;
case USB_RX_AGG_USB:
usb_write8(Adapter, REG_USB_AGG_TH, 
haldata->UsbRxAggBlockCount);
@@ -512,7 +512,7 @@ static void usb_AggSettingRxUpdate(struct adapter *Adapter)
break;
case USB_RX_AGG_MIX:
usb_write8(Adapter, REG_RXDMA_AGG_PG_TH, 
haldata->UsbRxAggPageCount);
-   usb_write8(Adapter, REG_RXDMA_AGG_PG_TH+1, 
(haldata->UsbRxAggPageTimeout & 0x1F));/* 0x280[12:8] */
+   usb_write8(Adapter, REG_RXDMA_AGG_PG_TH + 1, 
(haldata->UsbRxAggPageTimeout & 0x1F));/* 0x280[12:8] */
usb_write8(Adapter, REG_USB_AGG_TH, 
haldata->UsbRxAggBlockCount);
usb_write8(Adapter, REG_USB_AGG_TO, 
haldata->UsbRxAggBlockTimeout);
break;
@@ -569,9 +569,9 @@ static void _InitBeaconParameters(struct adapter *Adapter)
 
haldata->RegBcnCtrlVal = usb_read8(Adapter, REG_BCN_CTRL);
haldata->RegTxPause = usb_read8(Adapter, REG_TXPAUSE);
-   haldata->RegFwHwTxQCtrl = usb_read8(Adapter, REG_FWHW_TXQ_CTRL+2);
-   haldata->RegReg542 = usb_read8(Adapter, REG_TBTT_PROHIBIT+2);
-   haldata->RegCR_1 = usb_read8(Adapter, REG_CR+1);
+   haldata->RegFwHwTxQCtrl = usb_read8(Adapter, REG_FWHW_TXQ_CTRL + 2);
+   haldata->RegReg542 = usb_read8(Adapter, REG_TBTT_PROHIBIT + 2);
+   haldata->RegCR_1 = usb_read8(Adapter, REG_CR + 1);
 }
 
 static void _BeaconFunctionEnable(struct adapter *Adapter,
@@ -579,7 +579,7 @@ static void _BeaconFunctionEnable(struct adapter *Adapter,
 {
usb_write8(Adapter, REG_BCN_CTRL, (BIT(4) | BIT(3) | BIT(1)));
 
-   usb_write8(Adapter, REG_RD_CTRL+1, 0x6F);
+   usb_write8(Adapter, REG_RD_CTRL + 1, 0x6F);
 }
 
 /*  Set CCK and OFDM Block "ON" */
@@ -770,7 +770,7 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter)
value8 = usb_read8(Adapter, REG_TX_RPT_CTRL);
usb_write8(Adapter,  REG_TX_RPT_CTRL, (value8 | BIT(1) | BIT(0)));
/* Set MAX RPT MACID */
-   usb_write8(Adapter,  REG_TX_RPT_CTRL+1, 2);/* FOR sta mode ,0: bc/mc 
,1:AP */
+   usb_write8(Adapter,  REG_TX_RPT_CTRL + 1, 2);/* FOR sta mode ,0: bc/mc 
,1:AP */
/* Tx RPT Timer. Unit: 32us */
usb_write16(Adapter, REG_TX_RPT_TIME, 0xCdf0);
 
@@ -827,10 +827,10 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter)
pwrctrlpriv->rf_pwrstate = rf_on;
 
/*  enable Tx report. */
-   usb_write8(Adapter,  REG_FWHW_TXQ_CTRL+1, 0x0F);
+   usb_write8(Adapter,  REG_FWHW_TXQ_CTRL + 1, 0x0F);
 
/*  Suggested by SD1 pisa. Added by tynli. 2011.10.21. */
-   usb_write8(Adapter, REG_EARLY_MODE_CONTROL+3, 0x01);/* Pretx_en, for 
WEP/TKIP SEC */
+   usb_write8(Adapter, REG_EARLY_MODE_CONTROL + 3, 0x01);/* Pretx_en, for 
WEP/TKIP SEC */
 
/* tynli_test_tx_report. */
usb_write16(Adapter, REG_TX_RPT_TIME, 0x3DF0);
@@ -894,9 +894,9 @@ static void CardDisableRTL8188EU(struct adapter *Adapter)
val8 = usb_read8(Adapter, REG_MCUFWDL);
if ((val8 & RAM_DL_SEL) && Adapter->bFWReady) { /* 8051 RAM code */
/*  Reset MCU 0x2[10]=0. */
-   val8 = usb_read8(Adapter, REG_SYS_FUNC_EN+1);
+   val8 = usb_read8(Adapter, REG_SYS_FUNC_EN + 1);
val8 &= ~BIT(2);/*  0x2[10], FEN_CPUEN */
-   usb_write8(Adapter, REG_SYS_FUNC_EN+1, val8);
+   usb_write8(Adapter, REG_SYS_FUNC_EN + 1, val8);
}
 
/*  reset MCU 

[PATCH] staging: rtl8188eu: replace hal_EfusePgCheckAvailableAddr()

2019-07-25 Thread Michael Straube
Function hal_EfusePgCheckAvailableAddr() contains just a single if
test. Remove the function and replace the call to it with the if test.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_efuse.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c 
b/drivers/staging/rtl8188eu/core/rtw_efuse.c
index 51c3dd6d7ffb..533ca1ddffb0 100644
--- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
+++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
@@ -763,17 +763,6 @@ static bool hal_EfusePartialWriteCheck(struct adapter 
*pAdapter, u8 efuseType, u
return ret;
 }
 
-static bool
-hal_EfusePgCheckAvailableAddr(
-   struct adapter *pAdapter,
-   u8 efuseType
-   )
-{
-   if (Efuse_GetCurrentSize(pAdapter) >= EFUSE_MAP_LEN_88E)
-   return false;
-   return true;
-}
-
 static void hal_EfuseConstructPGPkt(u8 offset, u8 word_en, u8 *pData, struct 
pgpkt *pTargetPkt)
 {
memset((void *)pTargetPkt->data, 0xFF, sizeof(u8)*8);
@@ -789,7 +778,7 @@ bool Efuse_PgPacketWrite(struct adapter *pAdapter, u8 
offset, u8 word_en, u8 *pD
u16 startAddr = 0;
u8 efuseType = EFUSE_WIFI;
 
-   if (!hal_EfusePgCheckAvailableAddr(pAdapter, efuseType))
+   if (Efuse_GetCurrentSize(pAdapter) >= EFUSE_MAP_LEN_88E)
return false;
 
hal_EfuseConstructPGPkt(offset, word_en, pData, );
-- 
2.22.0



[PATCH] staging: rtl8723bs: remove unused file hal_phy.c

2019-07-21 Thread Michael Straube
Remove the unused file hal_phy.c. No function from this file is used
in the driver code and it is not listed in the Makefile.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/hal/hal_phy.c | 157 
 1 file changed, 157 deletions(-)
 delete mode 100644 drivers/staging/rtl8723bs/hal/hal_phy.c

diff --git a/drivers/staging/rtl8723bs/hal/hal_phy.c 
b/drivers/staging/rtl8723bs/hal/hal_phy.c
deleted file mode 100644
index 24a9d8f783f0..
--- a/drivers/staging/rtl8723bs/hal/hal_phy.c
+++ /dev/null
@@ -1,157 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/**
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- 
**/
-#define _HAL_PHY_C_
-
-#include 
-
-/*  */
-/*  ==> RF shadow Operation API Code Section!!! */
-/*  */
-/*-
- * Function:   PHY_RFShadowRead
- * PHY_RFShadowWrite
- * PHY_RFShadowCompare
- * PHY_RFShadowRecorver
- * PHY_RFShadowCompareAll
- * PHY_RFShadowRecorverAll
- * PHY_RFShadowCompareFlagSet
- * PHY_RFShadowRecorverFlagSet
- *
- * Overview:   When we set RF register, we must write shadow at first.
- * When we are running, we must compare shadow abd locate error 
addr.
- * Decide to recorver or not.
- *
- * Input:   NONE
- *
- * Output:  NONE
- *
- * Return:  NONE
- *
- * Revised History:
- * WhenWho Remark
- * 11/20/2008  MHC Create Version 0.
- *
- *---*/
-u32 PHY_RFShadowRead(IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset)
-{
-   return  RF_Shadow[eRFPath][Offset].Value;
-
-}  /* PHY_RFShadowRead */
-
-
-void PHY_RFShadowWrite(
-   IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset, IN u32 Data
-)
-{
-   RF_Shadow[eRFPath][Offset].Value = (Data & bRFRegOffsetMask);
-   RF_Shadow[eRFPath][Offset].Driver_Write = true;
-
-}  /* PHY_RFShadowWrite */
-
-
-bool PHY_RFShadowCompare(IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset)
-{
-   u32 reg;
-   /*  Check if we need to check the register */
-   if (RF_Shadow[eRFPath][Offset].Compare == true) {
-   reg = rtw_hal_read_rfreg(Adapter, eRFPath, Offset, 
bRFRegOffsetMask);
-   /*  Compare shadow and real rf register for 20bits!! */
-   if (RF_Shadow[eRFPath][Offset].Value != reg) {
-   /*  Locate error position. */
-   RF_Shadow[eRFPath][Offset].ErrorOrNot = true;
-   /* RT_TRACE(COMP_INIT, DBG_LOUD, */
-   /* PHY_RFShadowCompare RF-%d Addr%02lx Err = %05lx\n", 
*/
-   /* eRFPath, Offset, reg)); */
-   }
-   return RF_Shadow[eRFPath][Offset].ErrorOrNot;
-   }
-   return false;
-}  /* PHY_RFShadowCompare */
-
-
-void PHY_RFShadowRecorver(IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset)
-{
-   /*  Check if the address is error */
-   if (RF_Shadow[eRFPath][Offset].ErrorOrNot == true) {
-   /*  Check if we need to recorver the register. */
-   if (RF_Shadow[eRFPath][Offset].Recorver == true) {
-   rtw_hal_write_rfreg(Adapter, eRFPath, Offset, 
bRFRegOffsetMask,
-   
RF_Shadow[eRFPath][Offset].Value);
-   /* RT_TRACE(COMP_INIT, DBG_LOUD, */
-   /* PHY_RFShadowRecorver RF-%d Addr%02lx=%05lx", */
-   /* eRFPath, Offset, RF_Shadow[eRFPath][Offset].Value)); 
*/
-   }
-   }
-
-}  /* PHY_RFShadowRecorver */
-
-
-void PHY_RFShadowCompareAll(IN PADAPTER Adapter)
-{
-   u8 eRFPath = 0;
-   u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
-
-   for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) {
-   for (Offset = 0; Offset < maxReg; Offset++) {
-   PHY_RFShadowCompare(Adapter, eRFPath, Offset);
-   }
-   }
-
-}  /* PHY_RFShadowCompareAll */
-
-
-void PHY_RFShadowRecorverAll(IN PADAPTER Adapter)
-{
-   u8 eRFPath = 0;
-   u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
-
-   for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) {
-   for (Offset = 0; Offset < maxReg; Offset++) {
-   PHY_RFShadowRecorver(Adapter, eRFPath, Offset);
-   }
-   }
-
-}  /* PHY_RFShadowRecorverAll */
-
-
-void
-PHY_RFShadowCompareFlagSet(
-   IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset, IN u8 Type
-)
-{

[PATCH] staging: rtl8188eu: remove unused definitions from hal8188e_phy_reg.h

2019-07-07 Thread Michael Straube
Remove unused definitions from the file hal8188e_phy_reg.h.

Signed-off-by: Michael Straube 
---
 .../rtl8188eu/include/hal8188e_phy_reg.h  | 881 --
 1 file changed, 881 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/hal8188e_phy_reg.h 
b/drivers/staging/rtl8188eu/include/hal8188e_phy_reg.h
index 53afcea21c96..bd915a1f2511 100644
--- a/drivers/staging/rtl8188eu/include/hal8188e_phy_reg.h
+++ b/drivers/staging/rtl8188eu/include/hal8188e_phy_reg.h
@@ -16,55 +16,10 @@
 /*  5. Other definition for BB/RF R/W */
 /*  */
 
-
-/*  */
-/*  1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF 
*/
-/*  1. Page1(0x100) */
-/*  */
-#definerPMAC_Reset 0x100
-#definerPMAC_TxStart   0x104
-#definerPMAC_TxLegacySIG   0x108
-#definerPMAC_TxHTSIG1  0x10c
-#definerPMAC_TxHTSIG2  0x110
-#definerPMAC_PHYDebug  0x114
-#definerPMAC_TxPacketNum   0x118
-#definerPMAC_TxIdle0x11c
-#definerPMAC_TxMACHeader0  0x120
-#definerPMAC_TxMACHeader1  0x124
-#definerPMAC_TxMACHeader2  0x128
-#definerPMAC_TxMACHeader3  0x12c
-#definerPMAC_TxMACHeader4  0x130
-#definerPMAC_TxMACHeader5  0x134
-#definerPMAC_TxDataType0x138
-#definerPMAC_TxRandomSeed  0x13c
-#definerPMAC_CCKPLCPPreamble   0x140
-#definerPMAC_CCKPLCPHeader 0x144
-#definerPMAC_CCKCRC16  0x148
-#definerPMAC_OFDMRxCRC32OK 0x170
-#definerPMAC_OFDMRxCRC32Er 0x174
-#definerPMAC_OFDMRxParityEr0x178
-#definerPMAC_OFDMRxCRC8Er  0x17c
-#definerPMAC_CCKCRxRC16Er  0x180
-#definerPMAC_CCKCRxRC32Er  0x184
-#definerPMAC_CCKCRxRC32OK  0x188
-#definerPMAC_TxStatus  0x18c
-
-/*  2. Page2(0x200) */
-/*  The following two definition are only used for USB interface. */
-#defineRF_BB_CMD_ADDR  0x02c0  /*  RF/BB r/w cmd address. */
-#defineRF_BB_CMD_DATA  0x02c4  /*  RF/BB r/w cmd data. */
-
 /*  3. Page8(0x800) */
 #definerFPGA0_RFMOD0x800   /* RF mode & CCK TxSC RF BW 
Setting */
-
-#definerFPGA0_TxInfo   0x804   /*  Status report?? */
-#definerFPGA0_PSDFunction  0x808
-
 #definerFPGA0_TxGainStage  0x80c   /*  Set TX PWR init gain? */
 
-#definerFPGA0_RFTiming10x810   /*  Useless now */
-#definerFPGA0_RFTiming20x814
-
 #definerFPGA0_XA_HSSIParameter10x820   /*  RF 3 wire register 
*/
 #definerFPGA0_XA_HSSIParameter20x824
 #definerFPGA0_XB_HSSIParameter10x828
@@ -73,9 +28,6 @@
 #definerFPGA0_XA_LSSIParameter 0x840
 #definerFPGA0_XB_LSSIParameter 0x844
 
-#definerFPGA0_RFWakeUpParameter0x850   /*  Useless now */
-#definerFPGA0_RFSleepUpParameter   0x854
-
 #definerFPGA0_XAB_SwitchControl0x858   /*  RF Channel switch */
 #definerFPGA0_XCD_SwitchControl0x85c
 
@@ -86,181 +38,63 @@
 #definerFPGA0_XCD_RFInterfaceSW0x874
 
 #definerFPGA0_XAB_RFParameter  0x878   /*  RF Parameter */
-#definerFPGA0_XCD_RFParameter  0x87c
-
-/* Crystal cap setting RF-R/W protection for parameter4?? */
-#definerFPGA0_AnalogParameter1 0x880
-#definerFPGA0_AnalogParameter2 0x884
-#definerFPGA0_AnalogParameter3 0x888
-/*  enable ad/da clock1 for dual-phy */
-#definerFPGA0_AdDaClockEn  0x888
-#definerFPGA0_AnalogParameter4 0x88c
 
 #definerFPGA0_XA_LSSIReadBack  0x8a0   /*  Tranceiver LSSI 
Readback */
 #definerFPGA0_XB_LSSIReadBack  0x8a4
-#definerFPGA0_XC_LSSIReadBack  0x8a8
-#definerFPGA0_XD_LSSIReadBack  0x8ac
 
-#definerFPGA0_PSDReport0x8b4   /*  Useless now */
-/*  Transceiver A HSPI Readback */
 #defineTransceiverA_HSPI_Readback  0x8b8
-/*  Transceiver B HSPI Readback */
 #defineTransceiverB_HSPI_Readback  0x8bc
-/*  Useless now RF Interface Readback Value */
 #definerFPGA0_XAB_RFInterfaceRB0x8e0
-#definerFPGA0_XCD_RFInterfaceRB0x8e4   /*  Useless now */
 
 /*  4. Page9(0x900) */
 /* RF mode & OFDM TxSC RF BW Setting?? */
 #definerFPGA1_RFMOD0x900
 
-#definerFPGA1_TxBlock  0x904   /*  Useless now */
-#definerFPGA1_DebugSelect  0x908   /*  Useless now */
-#definerFPGA1_TxInfo   0x90c   /*  Useless now Status 
report */
-
 /*  5. PageA(0xA00) */
 /*  Set Control channel to upper or lower - required only for 40MHz */
 #definerCCK0_System0xa00
 
-/*  Disable i

[PATCH 2/2] staging: rtl8188eu: remove unused function is_ap_in_wep()

2019-06-23 Thread Michael Straube
Function is_ap_in_wep() is not used in the driver code, so remove it.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 30 ---
 .../staging/rtl8188eu/include/rtw_mlme_ext.h  |  1 -
 2 files changed, 31 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 159c46b096cb..7bfc5b7c2757 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -1074,36 +1074,6 @@ unsigned int is_ap_in_tkip(struct adapter *padapter)
}
 }
 
-unsigned int is_ap_in_wep(struct adapter *padapter)
-{
-   u32 i;
-   struct ndis_802_11_var_ie *pIE;
-   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
-   struct wlan_bssid_ex *cur_network = >network;
-
-   if (rtw_get_capability((struct wlan_bssid_ex *)cur_network) & 
WLAN_CAPABILITY_PRIVACY) {
-   for (i = sizeof(struct ndis_802_11_fixed_ie); i < 
pmlmeinfo->network.ie_length;) {
-   pIE = (struct ndis_802_11_var_ie 
*)(pmlmeinfo->network.ies + i);
-
-   switch (pIE->ElementID) {
-   case _VENDOR_SPECIFIC_IE_:
-   if (!memcmp(pIE->data, RTW_WPA_OUI, 4))
-   return false;
-   break;
-   case _RSN_IE_2_:
-   return false;
-   default:
-   break;
-   }
-   i += (pIE->Length + 2);
-   }
-   return true;
-   } else {
-   return false;
-   }
-}
-
 static int wifirate2_ratetbl_inx(unsigned char rate)
 {
rate = rate & 0x7f;
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index fa14b6fedf08..327f7d1bc20c 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -525,7 +525,6 @@ void set_sta_rate(struct adapter *padapter, struct sta_info 
*psta);
 unsigned char get_highest_rate_idx(u32 mask);
 int support_short_GI(struct adapter *padapter, struct ieee80211_ht_cap *caps);
 unsigned int is_ap_in_tkip(struct adapter *padapter);
-unsigned int is_ap_in_wep(struct adapter *padapter);
 
 void report_join_res(struct adapter *padapter, int res);
 void report_survey_event(struct adapter *padapter,
-- 
2.22.0



[PATCH 1/2] staging: rtl8188eu: remove unused function get_bsstype()

2019-06-23 Thread Michael Straube
Function get_bsstype() is not used in the driver code, so remove it.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c   | 10 --
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h |  1 -
 2 files changed, 11 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index d1e99885c8f5..159c46b096cb 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -346,16 +346,6 @@ void set_channel_bwmode(struct adapter *padapter, unsigned 
char channel, unsigne
SetBWMode(padapter, bwmode, channel_offset);
 }
 
-int get_bsstype(unsigned short capability)
-{
-   if (capability & BIT(0))
-   return WIFI_FW_AP_STATE;
-   else if (capability & BIT(1))
-   return WIFI_FW_ADHOC_STATE;
-   else
-   return 0;
-}
-
 u16 get_beacon_interval(struct wlan_bssid_ex *bss)
 {
__le16 val;
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 1fb2349bd0a0..fa14b6fedf08 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -485,7 +485,6 @@ void flush_all_cam_entry(struct adapter *padapter);
 void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
struct adapter *adapter, bool update_ie);
 
-int get_bsstype(unsigned short capability);
 u16 get_beacon_interval(struct wlan_bssid_ex *bss);
 
 int is_client_associated_to_ap(struct adapter *padapter);
-- 
2.22.0



[PATCH 1/2] staging: rtl8188eu: cleanup lines ending with a '('

2019-06-22 Thread Michael Straube
Cleanup checkpatch issues in usb_halinit.c.
CHECK: Lines should not end with a '('

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 21 +
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 70c02c49b177..69008accb015 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -469,10 +469,7 @@ static void usb_AggSettingTxUpdate(struct adapter *Adapter)
  *
  *---
  */
-static void
-usb_AggSettingRxUpdate(
-   struct adapter *Adapter
-   )
+static void usb_AggSettingRxUpdate(struct adapter *Adapter)
 {
struct hal_data_8188e *haldata = Adapter->HalData;
u8 valueDMA;
@@ -1044,10 +1041,7 @@ static void Hal_EfuseParseMACAddr_8188EU(struct adapter 
*adapt, u8 *hwinfo, bool
 eeprom->mac_addr));
 }
 
-static void
-readAdapterInfo_8188EU(
-   struct adapter *adapt
-   )
+static void readAdapterInfo_8188EU(struct adapter *adapt)
 {
struct eeprom_priv *eeprom = GET_EEPROM_EFUSE_PRIV(adapt);
 
@@ -1067,9 +1061,7 @@ readAdapterInfo_8188EU(
Hal_ReadThermalMeter_88E(adapt, eeprom->efuse_eeprom_data, 
eeprom->bautoload_fail_flag);
 }
 
-static void _ReadPROMContent(
-   struct adapter *Adapter
-   )
+static void _ReadPROMContent(struct adapter *Adapter)
 {
struct eeprom_priv *eeprom = GET_EEPROM_EFUSE_PRIV(Adapter);
u8 eeValue;
@@ -1782,11 +1774,8 @@ void rtw_hal_get_hwreg(struct adapter *Adapter, u8 
variable, u8 *val)
 /* Description: */
 /* Query setting of specified variable. */
 /*  */
-u8 rtw_hal_get_def_var(
-   struct adapter *Adapter,
-   enum hal_def_variable eVariable,
-   void *pValue
-   )
+u8 rtw_hal_get_def_var(struct adapter *Adapter, enum hal_def_variable 
eVariable,
+  void *pValue)
 {
struct hal_data_8188e *haldata = Adapter->HalData;
u8 bResult = _SUCCESS;
-- 
2.22.0



[PATCH 2/2] staging: rtl8188eu: remove hal_init_macaddr()

2019-06-22 Thread Michael Straube
Function hal_init_macaddr() just calls rtw_hal_set_hwreg().
Use rtw_hal_set_hwreg() directly and remove hal_init_macaddr().

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/hal_com.c | 6 --
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 3 ++-
 drivers/staging/rtl8188eu/include/hal_com.h | 1 -
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c 
b/drivers/staging/rtl8188eu/hal/hal_com.c
index ff481fbd074c..95f1b1431373 100644
--- a/drivers/staging/rtl8188eu/hal/hal_com.c
+++ b/drivers/staging/rtl8188eu/hal/hal_com.c
@@ -283,9 +283,3 @@ bool hal_mapping_out_pipe(struct adapter *adapter, u8 
numoutpipe)
}
return result;
 }
-
-void hal_init_macaddr(struct adapter *adapter)
-{
-   rtw_hal_set_hwreg(adapter, HW_VAR_MAC_ADDR,
- adapter->eeprompriv.mac_addr);
-}
diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 69008accb015..ac5552050752 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -746,7 +746,8 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter)
_InitDriverInfoSize(Adapter, DRVINFO_SZ);
 
_InitInterrupt(Adapter);
-   hal_init_macaddr(Adapter);/* set mac_address */
+   rtw_hal_set_hwreg(Adapter, HW_VAR_MAC_ADDR,
+ Adapter->eeprompriv.mac_addr);
_InitNetworkType(Adapter);/* set msr */
_InitWMACSetting(Adapter);
_InitAdaptiveCtrl(Adapter);
diff --git a/drivers/staging/rtl8188eu/include/hal_com.h 
b/drivers/staging/rtl8188eu/include/hal_com.h
index 2f7bdade40a5..93cbbe7ba1fd 100644
--- a/drivers/staging/rtl8188eu/include/hal_com.h
+++ b/drivers/staging/rtl8188eu/include/hal_com.h
@@ -148,5 +148,4 @@ void hal_set_brate_cfg(u8 *brates, u16 *rate_cfg);
 
 bool hal_mapping_out_pipe(struct adapter *adapter, u8 numoutpipe);
 
-void hal_init_macaddr(struct adapter *adapter);
 #endif /* __HAL_COMMON_H__ */
-- 
2.22.0



[PATCH] staging: rtl8188eu: remove unused code

2019-06-19 Thread Michael Straube
Remove unused and/or commented code from rtw_wlan_util.c.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index f404370d6631..d1e99885c8f5 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -27,9 +27,6 @@ static const u8 EPIGRAM_OUI[] = {0x00, 0x90, 0x4c};
 
 u8 REALTEK_96B_IE[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20};
 
-#define R2T_PHY_DELAY  (0)
-
-/* define WAIT_FOR_BCN_TO_M(3000) */
 #define WAIT_FOR_BCN_TO_MIN(6000)
 #define WAIT_FOR_BCN_TO_MAX(2)
 
@@ -1041,7 +1038,6 @@ void update_beacon_info(struct adapter *padapter, u8 
*pframe, uint pkt_len, stru
 
switch (pIE->ElementID) {
case _HT_EXTRA_INFO_IE_:/* HT info */
-   /* HT_info_handler(padapter, pIE); */
bwmode_update_check(padapter, pIE);
break;
case _ERPINFO_IE_:
@@ -1346,8 +1342,6 @@ void update_IOT_info(struct adapter *padapter)
   false);
break;
case HT_IOT_PEER_REALTEK:
-   /* rtw_write16(padapter, 0x4cc, 0x); */
-   /* rtw_write16(padapter, 0x546, 0x01c0); */
/* disable high power */
Switch_DM_Func(padapter, (u32)(~DYNAMIC_BB_DYNAMIC_TXPWR),
   false);
-- 
2.22.0



Re: [PATCH 1/2] staging: rtl8188eu: remove redundant definition of ETH_ALEN

2019-06-03 Thread Michael Straube

On 2019-06-02 22:07, Joe Perches wrote:

On Sun, 2019-06-02 at 18:35 +0200, Michael Straube wrote:

ETH_ALEN is defined in linux/if_ether.h which is included by
osdep_service.h, so remove the redundant definition from ieee80211.h.

[]

diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h

[]

@@ -14,7 +14,6 @@
  
  #define MGMT_QUEUE_NUM 5
  
-#define ETH_ALEN	6

  #define ETH_TYPE_LEN  2
  #define PAYLOAD_TYPE_LEN  1


While you're at it:

neither ETH_TYPE_LEN nor PAYLOAD_TYPE_LEN appear to be used.




They are removed in the second patch of the series.


[PATCH 1/2] staging: rtl8188eu: remove redundant definition of ETH_ALEN

2019-06-02 Thread Michael Straube
ETH_ALEN is defined in linux/if_ether.h which is included by
osdep_service.h, so remove the redundant definition from ieee80211.h.

osdep_service.h:33:#include 
etherdevice.h:25:#include 

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/include/ieee80211.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index c60b833ca110..d43aa4304ca5 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -14,7 +14,6 @@
 
 #define MGMT_QUEUE_NUM 5
 
-#define ETH_ALEN   6
 #define ETH_TYPE_LEN   2
 #define PAYLOAD_TYPE_LEN   1
 
-- 
2.21.0



[PATCH 2/2] staging: rtl8188eu: remove unused definitions from ieee80211.h

2019-06-02 Thread Michael Straube
MGMT_QUEUE_NUM, ETH_TYPE_LEN and PAYLOAD_TYPE_LEN are defined but
not used in the driver code, so remove them.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/include/ieee80211.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index d43aa4304ca5..42ee4ebe90eb 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -12,11 +12,6 @@
 #include "wifi.h"
 #include 
 
-#define MGMT_QUEUE_NUM 5
-
-#define ETH_TYPE_LEN   2
-#define PAYLOAD_TYPE_LEN   1
-
 #ifdef CONFIG_88EU_AP_MODE
 
 #define RTL_IOCTL_HOSTAPD (SIOCIWFIRSTPRIV + 28)
-- 
2.21.0



[PATCH] staging: rtl8188eu: remove ODM_PhyStatusQuery() wrapper

2019-06-02 Thread Michael Straube
Function ODM_PhyStatusQuery() is just a wrapper around
ODM_PhyStatusQuery_92CSeries(). Rename ODM_PhyStatusQuery_92CSeries()
to ODM_PhyStatusQuery() and remove the wrapper.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/odm_hwconfig.c | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/odm_hwconfig.c 
b/drivers/staging/rtl8188eu/hal/odm_hwconfig.c
index 149b0009ad66..d5a9ac51e907 100644
--- a/drivers/staging/rtl8188eu/hal/odm_hwconfig.c
+++ b/drivers/staging/rtl8188eu/hal/odm_hwconfig.c
@@ -387,10 +387,9 @@ static void odm_Process_RSSIForDM(struct odm_dm_struct 
*dm_odm,
 }
 
 /*  Endianness before calling this API */
-static void ODM_PhyStatusQuery_92CSeries(struct odm_dm_struct *dm_odm,
-struct odm_phy_status_info *pPhyInfo,
-u8 *pPhyStatus,
-struct odm_per_pkt_info *pPktinfo)
+void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,
+   struct odm_phy_status_info *pPhyInfo,
+   u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo)
 {
odm_RxPhyStatus92CSeries_Parsing(dm_odm, pPhyInfo, pPhyStatus,
 pPktinfo);
@@ -398,12 +397,4 @@ static void ODM_PhyStatusQuery_92CSeries(struct 
odm_dm_struct *dm_odm,
;/*  Select the packets to do RSSI checking for antenna 
switching. */
else
odm_Process_RSSIForDM(dm_odm, pPhyInfo, pPktinfo);
-
-}
-
-void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,
-   struct odm_phy_status_info *pPhyInfo,
-   u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo)
-{
-   ODM_PhyStatusQuery_92CSeries(dm_odm, pPhyInfo, pPhyStatus, pPktinfo);
 }
-- 
2.21.0



[PATCH] staging: rtl8712: get rid of IS_MCAST

2019-05-05 Thread Michael Straube
Use is_multicast_ether_addr instead of custom IS_MCAST and remove
the now unused IS_MCAST. All buffers are properly aligned.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8712/rtl8712_xmit.c |  2 +-
 drivers/staging/rtl8712/rtl871x_recv.c | 14 +++---
 drivers/staging/rtl8712/rtl871x_security.c |  4 ++--
 drivers/staging/rtl8712/rtl871x_xmit.c | 12 ++--
 drivers/staging/rtl8712/wifi.h | 11 ---
 5 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c 
b/drivers/staging/rtl8712/rtl8712_xmit.c
index 7574a4b569a4..307b0e292976 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -419,7 +419,7 @@ static void update_txdesc(struct xmit_frame *pxmitframe, 
uint *pmem, int sz)
struct cmd_priv *pcmdpriv = >cmdpriv;
 #endif
u8 blnSetTxDescOffset;
-   sint bmcst = IS_MCAST(pattrib->ra);
+   bool bmcst = is_multicast_ether_addr(pattrib->ra);
struct ht_priv *phtpriv = >htpriv;
struct tx_desc txdesc_mp;
 
diff --git a/drivers/staging/rtl8712/rtl871x_recv.c 
b/drivers/staging/rtl8712/rtl871x_recv.c
index 28f736913292..5298fe603437 100644
--- a/drivers/staging/rtl8712/rtl871x_recv.c
+++ b/drivers/staging/rtl8712/rtl871x_recv.c
@@ -151,7 +151,7 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter,
if (prxattrib->encrypt == _TKIP_) {
/* calculate mic code */
if (stainfo != NULL) {
-   if (IS_MCAST(prxattrib->ra)) {
+   if (is_multicast_ether_addr(prxattrib->ra)) {
iv = precvframe->u.hdr.rx_data +
 prxattrib->hdrlen;
idx = iv[3];
@@ -180,12 +180,12 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter,
if (bmic_err) {
if (prxattrib->bdecrypted)
r8712_handle_tkip_mic_err(adapter,
-   (u8)IS_MCAST(prxattrib->ra));
+   
(u8)is_multicast_ether_addr(prxattrib->ra));
res = _FAIL;
} else {
/* mic checked ok */
if (!psecuritypriv->bcheck_grpkey &&
-   IS_MCAST(prxattrib->ra))
+   is_multicast_ether_addr(prxattrib->ra))
psecuritypriv->bcheck_grpkey = true;
}
recvframe_pull_tail(precvframe, 8);
@@ -305,7 +305,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
u8 *mybssid  = get_bssid(pmlmepriv);
u8 *myhwaddr = myid(>eeprompriv);
u8 *sta_addr = NULL;
-   sint bmcast = IS_MCAST(pattrib->dst);
+   bool bmcast = is_multicast_ether_addr(pattrib->dst);
 
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
@@ -331,7 +331,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
/* For AP mode, if DA == MCAST, then BSSID should
 * be also MCAST
 */
-   if (!IS_MCAST(pattrib->bssid))
+   if (!is_multicast_ether_addr(pattrib->bssid))
return _FAIL;
} else { /* not mc-frame */
/* For AP mode, if DA is non-MCAST, then it must be
@@ -373,7 +373,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
struct  mlme_priv *pmlmepriv = >mlmepriv;
u8 *mybssid  = get_bssid(pmlmepriv);
u8 *myhwaddr = myid(>eeprompriv);
-   sint bmcast = IS_MCAST(pattrib->dst);
+   bool bmcast = is_multicast_ether_addr(pattrib->dst);
 
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) &&
check_fwstate(pmlmepriv, _FW_LINKED)) {
@@ -532,7 +532,7 @@ static sint validate_recv_data_frame(struct _adapter 
*adapter,
 
if (pattrib->privacy) {
GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt,
-  IS_MCAST(pattrib->ra));
+  is_multicast_ether_addr(pattrib->ra));
SET_ICE_IV_LEN(pattrib->iv_len, pattrib->icv_len,
   pattrib->encrypt);
} else {
diff --git a/drivers/staging/rtl8712/rtl871x_security.c 
b/drivers/staging/rtl8712/rtl871x_security.c
index f82645011d02..693008bba83e 100644
--- a/drivers/staging/rtl8712/rtl871x_security.c
+++ b/drivers/staging/rtl8712/rtl871x_security.c
@@ -665,7 +665,7 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 
*precvframe)
  

[PATCH 1/4] staging: rtl8188eu: add spaces around operators in rtw_ap.c

2019-04-22 Thread Michael Straube
Add spaces around '+', '-' and '|' to follow kernel coding style.
Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index c360856a86ec..9588ba2a16e4 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -922,7 +922,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 
*pbuf,  int len)
 
pht_cap->mcs.rx_mask[0] = 0xff;
pht_cap->mcs.rx_mask[1] = 0x0;
-   memcpy(>htpriv.ht_cap, p+2, ie_len);
+   memcpy(>htpriv.ht_cap, p + 2, ie_len);
}
 
/* parsing HT_INFO_IE */
@@ -1122,9 +1122,11 @@ static void update_bcn_erpinfo_ie(struct adapter 
*padapter)
struct ndis_802_11_var_ie *pIE = (struct ndis_802_11_var_ie *)p;
 
if (pmlmepriv->num_sta_non_erp == 1)
-   pIE->data[0] |= 
RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION;
+   pIE->data[0] |= RTW_ERP_INFO_NON_ERP_PRESENT |
+   RTW_ERP_INFO_USE_PROTECTION;
else
-   pIE->data[0] &= 
~(RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION);
+   pIE->data[0] &= ~(RTW_ERP_INFO_NON_ERP_PRESENT |
+ RTW_ERP_INFO_USE_PROTECTION);
 
if (pmlmepriv->num_sta_no_short_preamble > 0)
pIE->data[0] |= RTW_ERP_INFO_BARKER_PREAMBLE_MODE;
@@ -1153,12 +1155,13 @@ static void update_bcn_wps_ie(struct adapter *padapter)
if (!pwps_ie_src)
return;
 
-   pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, 
NULL, _ielen);
+   pwps_ie = rtw_get_wps_ie(ie + _FIXED_IE_LENGTH_,
+ielen - _FIXED_IE_LENGTH_, NULL, _ielen);
 
if (!pwps_ie || wps_ielen == 0)
return;
 
-   wps_offset = (uint)(pwps_ie-ie);
+   wps_offset = (uint)(pwps_ie - ie);
 
premainder_ie = pwps_ie + wps_ielen;
 
@@ -1171,15 +1174,15 @@ static void update_bcn_wps_ie(struct adapter *padapter)
}
 
wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
-   if ((wps_offset+wps_ielen+2+remainder_ielen) <= MAX_IE_SZ) {
-   memcpy(pwps_ie, pwps_ie_src, wps_ielen+2);
-   pwps_ie += (wps_ielen+2);
+   if ((wps_offset + wps_ielen + 2 + remainder_ielen) <= MAX_IE_SZ) {
+   memcpy(pwps_ie, pwps_ie_src, wps_ielen + 2);
+   pwps_ie += (wps_ielen + 2);
 
if (pbackup_remainder_ie)
memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen);
 
/* update ie_length */
-   pnetwork->ie_length = wps_offset + (wps_ielen+2) + 
remainder_ielen;
+   pnetwork->ie_length = wps_offset + (wps_ielen + 2) + 
remainder_ielen;
}
 
kfree(pbackup_remainder_ie);
-- 
2.21.0



[PATCH 4/4] staging: rtl8188eu: remove unnecessary parentheses

2019-04-22 Thread Michael Straube
Remove unnecessary parentheses to improve readability.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c  | 6 +++---
 drivers/staging/rtl8188eu/core/rtw_cmd.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 9588ba2a16e4..51a5b71f8c25 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -1174,15 +1174,15 @@ static void update_bcn_wps_ie(struct adapter *padapter)
}
 
wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
-   if ((wps_offset + wps_ielen + 2 + remainder_ielen) <= MAX_IE_SZ) {
+   if (wps_offset + wps_ielen + 2 + remainder_ielen <= MAX_IE_SZ) {
memcpy(pwps_ie, pwps_ie_src, wps_ielen + 2);
-   pwps_ie += (wps_ielen + 2);
+   pwps_ie += wps_ielen + 2;
 
if (pbackup_remainder_ie)
memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen);
 
/* update ie_length */
-   pnetwork->ie_length = wps_offset + (wps_ielen + 2) + 
remainder_ielen;
+   pnetwork->ie_length = wps_offset + wps_ielen + 2 + 
remainder_ielen;
}
 
kfree(pbackup_remainder_ie);
diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 61da56a3bbc4..a24b40761af2 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -405,7 +405,7 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct 
wlan_network *pnetwork)
 
psecuritypriv->authenticator_ie[0] = (unsigned 
char)psecnetwork->ie_length;
 
-   if ((psecnetwork->ie_length - 12) < 255)
+   if (psecnetwork->ie_length - 12 < 255)
memcpy(>authenticator_ie[1], 
>ies[12], psecnetwork->ie_length - 12);
else
memcpy(>authenticator_ie[1], 
>ies[12], 255);
-- 
2.21.0



[PATCH 3/4] staging: rtl8188eu: add spaces around '-' in rtw_cmd.c

2019-04-22 Thread Michael Straube
Add spaces around '-' to follow kernel coding style.
Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 7bd38b3745c9..61da56a3bbc4 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -405,8 +405,8 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct 
wlan_network *pnetwork)
 
psecuritypriv->authenticator_ie[0] = (unsigned 
char)psecnetwork->ie_length;
 
-   if ((psecnetwork->ie_length-12) < 255)
-   memcpy(>authenticator_ie[1], 
>ies[12], psecnetwork->ie_length-12);
+   if ((psecnetwork->ie_length - 12) < 255)
+   memcpy(>authenticator_ie[1], 
>ies[12], psecnetwork->ie_length - 12);
else
memcpy(>authenticator_ie[1], 
>ies[12], 255);
 
-- 
2.21.0



  1   2   3   4   5   6   7   8   9   >