Skip to contentSkip to conversation

Subject: [PATCH v2 0/5] staging: rtl8192e: CLeanup patchset for style issues in rtl819x_Y.c files

PATCH In review Mitali Borkar 3 participants 12 messages Apr 14, 2021 – Apr 15, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Changes from v1:- Dropped 6/6 from and made this as a patchset of 5 as alignment of code is done in following patches.
[PATCH 1/5]:- No changes.
[PATCH 2/5]:- No changes.
[PATCH 3/5]:- No changes.
[PATCH 4/5]:- Rectified spelling mistake and replaced memcmp with ether_oui_equal.
[PATCH 5/5]:- No changes.

Mitali Borkar (5):
staging: rtl8192e: add spaces around binary operators
staging: rtl8192e: remove unnecessary blank line before brace
staging: rtl8192e: remove unnecessary blank line after close brace
staging: rtl8192e: rectified spelling mistake and replace memcmp with
ether_oui_equal
staging: rtl8192e: removed multiple blank lines

 drivers/staging/rtl8192e/rtl819x_HTProc.c     | 67 ++++++++---------
 drivers/staging/rtl8192e/rtl819x_TSProc.c     | 10 +++--
 include/linux/etherdevice.h                   |  5 +
 3 files changed, 37 insertions(+), 45 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/5 staging: rtl8192e: add spaces around binary operators

Added spaces around binary operators like '+', '*', '|', '-', '&', to improve readability and to meet linux kernel coding style.

---

Changes from v1:- No changes.

 drivers/staging/rtl8192e/rtl819x_HTProc.c | 8 ++++----
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +4 -4
index 4a2968566b93..b74c6ac817d4 100644
@@ -138,7 +138,7 @@ u16  TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate)
 		is40MHz = 1;
 		isShortGI = 1;
 	}
-	return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf];
+	return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate & 0xf];
 }
 
 bool IsHTHalfNmodeAPs(struct rtllib_device *ieee)
@@ -479,8 +479,8 @@ u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet,
 		if (availableMcsRate[i] != 0) {
 			bitMap = availableMcsRate[i];
 			for (j = 0; j < 8; j++) {
-				if ((bitMap%2) != 0) {
-					if (HTMcsToDataRate(ieee, (8*i+j)) >
+				if ((bitMap % 2) != 0) {
+					if (HTMcsToDataRate(ieee, (8 * i + j)) >
 					    HTMcsToDataRate(ieee, mcsRate))
 						mcsRate = 8 * i + j;
 				}
@@ -577,7 +577,7 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
 
 	pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable;
 	if (ieee->rtllib_ap_sec_type &&
-	   (ieee->rtllib_ap_sec_type(ieee)&(SEC_ALG_WEP|SEC_ALG_TKIP))) {
+	   (ieee->rtllib_ap_sec_type(ieee) & (SEC_ALG_WEP | SEC_ALG_TKIP))) {
 		if ((pHTInfo->IOTPeer == HT_IOT_PEER_ATHEROS) ||
 				(pHTInfo->IOTPeer == HT_IOT_PEER_UNKNOWN))
 			pHTInfo->bCurrentAMPDUEnable = false;
drivers/staging/rtl8192e/rtl819x_TSProc.c +4 -4
index 6c51323104e5..b14ed3534ffa 100644
@@ -104,7 +104,7 @@ static void ResetTsCommonInfo(struct ts_common_info *pTsCommonInfo)
 {
 	eth_zero_addr(pTsCommonInfo->Addr);
 	memset(&pTsCommonInfo->TSpec, 0, sizeof(union tspec_body));
-	memset(&pTsCommonInfo->TClass, 0, sizeof(union qos_tclas)*TCLAS_NUM);
+	memset(&pTsCommonInfo->TClass, 0, sizeof(union qos_tclas) * TCLAS_NUM);
 	pTsCommonInfo->TClasProc = 0;
 	pTsCommonInfo->TClasNum = 0;
 }
@@ -188,9 +188,9 @@ void TSInitialize(struct rtllib_device *ieee)
 	for (count = 0; count < REORDER_ENTRY_NUM; count++) {
 		list_add_tail(&pRxReorderEntry->List,
 			      &ieee->RxReorder_Unused_List);
-		if (count == (REORDER_ENTRY_NUM-1))
+		if (count == (REORDER_ENTRY_NUM - 1))
 			break;
-		pRxReorderEntry = &ieee->RxReorderEntry[count+1];
+		pRxReorderEntry = &ieee->RxReorderEntry[count + 1];
 	}
 
 }
@@ -517,7 +517,7 @@ void TsStartAddBaProcess(struct rtllib_device *ieee, struct tx_ts_record *pTxTS)
 				  msecs_to_jiffies(TS_ADDBA_DELAY));
 		} else {
 			netdev_dbg(ieee->dev, "Immediately Start ADDBA\n");
-			mod_timer(&pTxTS->TsAddBaTimer, jiffies+10);
+			mod_timer(&pTxTS->TsAddBaTimer, jiffies + 10);
 		}
 	} else
 		netdev_dbg(ieee->dev, "BA timer is already added\n");
Signature · 1 line
2.30.2
#2 lore raw

PATCH v2 2/5 staging: rtl8192e: remove unnecessary blank line before brace

In reply to Mitali Borkar

Removed an extra blank line before close brace as it was not necessary. Reported by checkpatch.

---

Changes from v1:- No changes.

 drivers/staging/rtl8192e/rtl819x_HTProc.c | 2 --
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 2 --
 2 files changed, 4 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +0 -2
index b74c6ac817d4..651441a71646 100644
@@ -263,7 +263,6 @@ static void HTIOTActDetermineRaFunc(struct rtllib_device *ieee, bool bPeerRx2ss)
 
 	if (pHTInfo->IOTAction & HT_IOT_ACT_AMSDU_ENABLE)
 		pHTInfo->IOTRaFunc |= HT_IOT_RAFUNC_TX_AMSDU;
-
 }
 
 void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo)
@@ -445,7 +444,6 @@ static u8 HT_PickMCSRate(struct rtllib_device *ieee, u8 *pOperateMCS)
 		break;
 	default:
 		break;
-
 	}
 
 	return true;
drivers/staging/rtl8192e/rtl819x_TSProc.c +0 -2
index b14ed3534ffa..34b00a76b6bd 100644
@@ -192,7 +192,6 @@ void TSInitialize(struct rtllib_device *ieee)
 			break;
 		pRxReorderEntry = &ieee->RxReorderEntry[count + 1];
 	}
-
 }
 
 static void AdmitTS(struct rtllib_device *ieee,
@@ -253,7 +252,6 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee,
 			    pRet->TSpec.f.TSInfo.field.ucTSID == TID &&
 			    pRet->TSpec.f.TSInfo.field.ucDirection == dir)
 				break;
-
 		}
 		if (&pRet->List  != psearch_list)
 			break;
Signature · 1 line
2.30.2
#3 lore raw

PATCH v2 3/5 staging: rtl8192e: remove unnecessary blank line after close brace

In reply to Mitali Borkar

Removed an extra blank line after close brace '{' as it was not necessary.
Reported by checkpatch

---

Changes from v1:- No changes.

 drivers/staging/rtl8192e/rtl819x_HTProc.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +0 -2
index 651441a71646..b6805908bbbd 100644
@@ -492,7 +492,6 @@ u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet,
 static u8 HTFilterMCSRate(struct rtllib_device *ieee, u8 *pSupportMCS,
 			  u8 *pOperateMCS)
 {
-
 	u8 i;
 
 	for (i = 0; i <= 15; i++)
@@ -685,7 +684,6 @@ void HTInitializeHTInfo(struct rtllib_device *ieee)
 
 void HTInitializeBssDesc(struct bss_ht *pBssHT)
 {
-
 	pBssHT->bd_support_ht = false;
 	memset(pBssHT->bd_ht_cap_buf, 0, sizeof(pBssHT->bd_ht_cap_buf));
 	pBssHT->bd_ht_cap_len = 0;
Signature · 1 line
2.30.2
#4 lore raw

PATCH v2 4/5 staging: rtl8192e: rectified spelling mistake and replace memcmp with ether_oui_equal

In reply to Mitali Borkar

Added a generic function of static inline bool in include/linux/etherdevice.h to replace memcmp with ether_oui_equal throughout the execution. Corrected the misspelled words in this file.

---

Changes from v1:- Rectified spelling mistake and replaced memcmp with ether_oui_equal.

 drivers/staging/rtl8192e/rtl819x_HTProc.c | 48 +++++++++++------------
 include/linux/etherdevice.h               |  5 +++
 2 files changed, 29 insertions(+), 24 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +24 -24
index ec6b46166e84..ce58feb2af9a 100644
@@ -43,7 +43,7 @@ u16 MCS_DATA_RATE[2][2][77] = {
 	 810, 720, 810, 900, 900, 990} }
 };
 
-static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
+static u8 UNKNOWN_BROADCOM[3] = {0x00, 0x14, 0xbf};
 
 static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0x00, 0x1a, 0x70};
 
@@ -146,16 +146,16 @@ bool IsHTHalfNmodeAPs(struct rtllib_device *ieee)
 	bool			retValue = false;
 	struct rtllib_network *net = &ieee->current_network;
 
-	if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
+	if ((ether_oui_equal(net->bssid, BELKINF5D8233V1_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, BELKINF5D82334V3_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, PCI_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, EDIMAX_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, AIRLINK_RALINK) == 0) ||
 	    (net->ralink_cap_exist))
 		retValue = true;
-	else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ||
+	else if (ether_oui_equal(net->bssid, UNKNOWN_BROADCOM) ||
+		 ether_oui_equal(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM) ||
+		 ether_oui_equal(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM) ||
 		 (net->broadcom_cap_exist))
 		retValue = true;
 	else if (net->bssht.bd_rt2rt_aggregation)
@@ -179,26 +179,26 @@ static void HTIOTPeerDetermine(struct rtllib_device *ieee)
 			pHTInfo->IOTPeer = HT_IOT_PEER_92U_SOFTAP;
 	} else if (net->broadcom_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
-	} else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)) {
+	} else if (ether_oui_equal(net->bssid, UNKNOWN_BROADCOM) ||
+		   ether_oui_equal(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM) ||
+		   ether_oui_equal(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM)) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
-	} else if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
-		  net->ralink_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, BELKINF5D8233V1_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, BELKINF5D82334V3_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, PCI_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, EDIMAX_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, AIRLINK_RALINK) == 0) ||
+		   net->ralink_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_RALINK;
 	} else if ((net->atheros_cap_exist) ||
-		(memcmp(net->bssid, DLINK_ATHEROS_1, 3) == 0) ||
-		(memcmp(net->bssid, DLINK_ATHEROS_2, 3) == 0)) {
+		   (ether_oui_equal(net->bssid, DLINK_ATHEROS_1) == 0) ||
+		   (ether_oui_equal(net->bssid, DLINK_ATHEROS_2) == 0)) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS;
-	} else if ((memcmp(net->bssid, CISCO_BROADCOM, 3) == 0) ||
-		  net->cisco_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, CISCO_BROADCOM) == 0) ||
+		   net->cisco_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_CISCO;
-	} else if ((memcmp(net->bssid, LINKSYS_MARVELL_4400N, 3) == 0) ||
-		  net->marvell_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, LINKSYS_MARVELL_4400N) == 0) ||
+		   net->marvell_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_MARVELL;
 	} else if (net->airgo_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_AIRGO;
include/linux/etherdevice.h +5 -0
index 2e5debc0373c..6a1a63168319 100644
@@ -87,6 +87,11 @@ static inline bool is_link_local_ether_addr(const u8 *addr)
 #endif
 }
 
+static inline bool ether_oui_equal(const u8 *addr, const u8 *oui)
+{
+return addr[0] == oui[0] && addr[1] == oui[1] && addr[2] == oui[2];
+}
+
 /**
  * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
  * @addr: Pointer to a six-byte array containing the Ethernet address
Signature · 1 line
2.30.2
#10 lore raw

PATCH v2 5/5 staging: rtl8192e: removed multiple blank lines

In reply to Mitali Borkar

Removed multiple blank lines to make code better and neater. Reported by checkpatch.

---

Changes from v1:- No changes.

 drivers/staging/rtl8192e/rtl819x_HTProc.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +0 -7
index b11b0054d8cb..955442b95bdc 100644
@@ -214,7 +214,6 @@ static u8 HTIOTActIsDisableMCS14(struct rtllib_device *ieee, u8 *PeerMacAddr)
 	return 0;
 }
 
-
 static bool HTIOTActIsDisableMCS15(struct rtllib_device *ieee)
 {
 	return false;
@@ -236,7 +235,6 @@ static u8 HTIOTActIsMgntUseCCK6M(struct rtllib_device *ieee,
 {
 	u8	retValue = 0;
 
-
 	if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM)
 		retValue = 1;
 
@@ -315,7 +313,6 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap,
 	pCapELE->PSMP = 0;
 	pCapELE->LSigTxopProtect = 0;
 
-
 	netdev_dbg(ieee->dev,
 		   "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n",
 		   pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk);
@@ -390,7 +387,6 @@ void HTConstructInfoElement(struct rtllib_device *ieee, u8 *posHTInfo,
 
 		memset(pHTInfoEle->BasicMSC, 0, 16);
 
-
 		*len = 22 + 2;
 
 	} else {
@@ -541,7 +537,6 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
 	else
 		pPeerHTInfo = (struct ht_info_ele *)(pHTInfo->PeerHTInfoBuf);
 
-
 #ifdef VERBOSE_DEBUG
 	print_hex_dump_bytes("%s: ", __func__, DUMP_PREFIX_NONE,
 			     pPeerHTCap, sizeof(struct ht_capab_ele));
@@ -562,7 +557,6 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
 			       ((pPeerHTCap->DssCCk == 1) ? true :
 			       false) : false);
 
-
 	pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support;
 
 	nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize == 0) ? 3839 : 7935;
@@ -750,7 +744,6 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,
 		if (bIOTAction)
 			pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_ALL_2SS;
 
-
 		bIOTAction = HTIOTActIsDisableEDCATurbo(ieee, pNetwork->bssid);
 		if (bIOTAction)
 			pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_EDCA_TURBO;
Signature · 1 line
2.30.2
#5 lore raw

Re: [PATCH v2 4/5] staging: rtl8192e: rectified spelling mistake and replace memcmp with ether_oui_equal

In reply to Mitali Borkar
Quoted 5 lines · Mitali Borkar

Added a generic function of static inline bool in include/linux/etherdevice.h to replace memcmp with ether_oui_equal throughout the execution. Corrected the misspelled words in this file.

Quoted 8 lines

---

Changes from v1:- Rectified spelling mistake and replaced memcmp with ether_oui_equal.

 drivers/staging/rtl8192e/rtl819x_HTProc.c | 48 +++++++++++------------
 include/linux/etherdevice.h               |  5 +++

^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is networking code and not staging code, but the netdev mailing list isn't CC'd.

drivers/staging/rtl8192e/rtl819x_HTProc.c u16 MCS_DATA_RATE[2][2][77] = { · line 46

Quoted 12 lines
 2 files changed, 29 insertions(+), 24 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +1 -1
index ec6b46166e84..ce58feb2af9a 100644
@@ -43,7 +43,7 @@ u16 MCS_DATA_RATE[2][2][77] = {
 	 810, 720, 810, 900, 900, 990} }
 };
 
-static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
+static u8 UNKNOWN_BROADCOM[3] = {0x00, 0x14, 0xbf};

Please pull this spelling fix into its own patch.

[ snip ]

include/linux/etherdevice.h static inline bool is_link_local_ether_addr(const u8 *addr) · line 93

Quoted 12 lines
include/linux/etherdevice.h +4 -0
index 2e5debc0373c..6a1a63168319 100644
@@ -87,6 +87,11 @@ static inline bool is_link_local_ether_addr(const u8 *addr)
 #endif
 }
 
+static inline bool ether_oui_equal(const u8 *addr, const u8 *oui)
+{
+return addr[0] == oui[0] && addr[1] == oui[1] && addr[2] == oui[2];
+}

The indenting is messed up on this.

regards,
dan carpenter

maintainer
#7 lore raw

Re: [PATCH v2 4/5] staging: rtl8192e: rectified spelling mistake and replace memcmp with ether_oui_equal

In reply to Mitali Borkar
Quoted 100 lines · Mitali Borkar

Added a generic function of static inline bool in include/linux/etherdevice.h to replace memcmp with ether_oui_equal throughout the execution. Corrected the misspelled words in this file.

---

Changes from v1:- Rectified spelling mistake and replaced memcmp with ether_oui_equal.

 drivers/staging/rtl8192e/rtl819x_HTProc.c | 48 +++++++++++------------
 include/linux/etherdevice.h               |  5 +++
 2 files changed, 29 insertions(+), 24 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +24 -24
index ec6b46166e84..ce58feb2af9a 100644
@@ -43,7 +43,7 @@ u16 MCS_DATA_RATE[2][2][77] = {
 	 810, 720, 810, 900, 900, 990} }
 };
 
-static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
+static u8 UNKNOWN_BROADCOM[3] = {0x00, 0x14, 0xbf};
 
 static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0x00, 0x1a, 0x70};
 
@@ -146,16 +146,16 @@ bool IsHTHalfNmodeAPs(struct rtllib_device *ieee)
 	bool			retValue = false;
 	struct rtllib_network *net = &ieee->current_network;
 
-	if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
+	if ((ether_oui_equal(net->bssid, BELKINF5D8233V1_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, BELKINF5D82334V3_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, PCI_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, EDIMAX_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, AIRLINK_RALINK) == 0) ||
 	    (net->ralink_cap_exist))
 		retValue = true;
-	else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ||
+	else if (ether_oui_equal(net->bssid, UNKNOWN_BROADCOM) ||
+		 ether_oui_equal(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM) ||
+		 ether_oui_equal(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM) ||
 		 (net->broadcom_cap_exist))
 		retValue = true;
 	else if (net->bssht.bd_rt2rt_aggregation)
@@ -179,26 +179,26 @@ static void HTIOTPeerDetermine(struct rtllib_device *ieee)
 			pHTInfo->IOTPeer = HT_IOT_PEER_92U_SOFTAP;
 	} else if (net->broadcom_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
-	} else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)) {
+	} else if (ether_oui_equal(net->bssid, UNKNOWN_BROADCOM) ||
+		   ether_oui_equal(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM) ||
+		   ether_oui_equal(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM)) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
-	} else if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
-		  net->ralink_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, BELKINF5D8233V1_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, BELKINF5D82334V3_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, PCI_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, EDIMAX_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, AIRLINK_RALINK) == 0) ||
+		   net->ralink_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_RALINK;
 	} else if ((net->atheros_cap_exist) ||
-		(memcmp(net->bssid, DLINK_ATHEROS_1, 3) == 0) ||
-		(memcmp(net->bssid, DLINK_ATHEROS_2, 3) == 0)) {
+		   (ether_oui_equal(net->bssid, DLINK_ATHEROS_1) == 0) ||
+		   (ether_oui_equal(net->bssid, DLINK_ATHEROS_2) == 0)) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS;
-	} else if ((memcmp(net->bssid, CISCO_BROADCOM, 3) == 0) ||
-		  net->cisco_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, CISCO_BROADCOM) == 0) ||
+		   net->cisco_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_CISCO;
-	} else if ((memcmp(net->bssid, LINKSYS_MARVELL_4400N, 3) == 0) ||
-		  net->marvell_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, LINKSYS_MARVELL_4400N) == 0) ||
+		   net->marvell_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_MARVELL;
 	} else if (net->airgo_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_AIRGO;
include/linux/etherdevice.h +0 -0
index 2e5debc0373c..6a1a63168319 100644

include/linux/etherdevice.h static inline bool is_link_local_ether_addr(const u8 *addr) · line 93

Quoted 7 lines
include/linux/etherdevice.h +4 -0
@@ -87,6 +87,11 @@ static inline bool is_link_local_ether_addr(const u8 *addr)
 #endif
 }
 
+static inline bool ether_oui_equal(const u8 *addr, const u8 *oui)
+{
+return addr[0] == oui[0] && addr[1] == oui[1] && addr[2] == oui[2];
+}

Staging drivers are stand-alone, we can not add code outside of the driver directory in these patches, sorry.

And as Dan said, this is wrong formatting, did you run checkpatch.pl on your changes?

thanks,

greg k-h

maintainer
#11 lore raw
In reply to Mitali Borkar
Quoted 2 lines · Mitali Borkar

Changes from v1:- Dropped 6/6 from and made this as a patchset of 5 as alignment of code is done in following patches.

Why is "Subject:" listed in your subject line? Do not manually add it after git format-patch has created it...

thanks,

greg k-h

#8 lore raw

Re: [PATCH v2 4/5] staging: rtl8192e: rectified spelling mistake and replace memcmp with ether_oui_equal

In reply to Greg KH
Quoted 104 lines · Greg KH
Quoted 103 lines · Mitali Borkar

Added a generic function of static inline bool in include/linux/etherdevice.h to replace memcmp with ether_oui_equal throughout the execution. Corrected the misspelled words in this file.

---

Changes from v1:- Rectified spelling mistake and replaced memcmp with ether_oui_equal.

 drivers/staging/rtl8192e/rtl819x_HTProc.c | 48 +++++++++++------------
 include/linux/etherdevice.h               |  5 +++
 2 files changed, 29 insertions(+), 24 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +24 -24
index ec6b46166e84..ce58feb2af9a 100644
@@ -43,7 +43,7 @@ u16 MCS_DATA_RATE[2][2][77] = {
 	 810, 720, 810, 900, 900, 990} }
 };
 
-static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
+static u8 UNKNOWN_BROADCOM[3] = {0x00, 0x14, 0xbf};
 
 static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0x00, 0x1a, 0x70};
 
@@ -146,16 +146,16 @@ bool IsHTHalfNmodeAPs(struct rtllib_device *ieee)
 	bool			retValue = false;
 	struct rtllib_network *net = &ieee->current_network;
 
-	if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
+	if ((ether_oui_equal(net->bssid, BELKINF5D8233V1_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, BELKINF5D82334V3_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, PCI_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, EDIMAX_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, AIRLINK_RALINK) == 0) ||
 	    (net->ralink_cap_exist))
 		retValue = true;
-	else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ||
+	else if (ether_oui_equal(net->bssid, UNKNOWN_BROADCOM) ||
+		 ether_oui_equal(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM) ||
+		 ether_oui_equal(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM) ||
 		 (net->broadcom_cap_exist))
 		retValue = true;
 	else if (net->bssht.bd_rt2rt_aggregation)
@@ -179,26 +179,26 @@ static void HTIOTPeerDetermine(struct rtllib_device *ieee)
 			pHTInfo->IOTPeer = HT_IOT_PEER_92U_SOFTAP;
 	} else if (net->broadcom_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
-	} else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)) {
+	} else if (ether_oui_equal(net->bssid, UNKNOWN_BROADCOM) ||
+		   ether_oui_equal(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM) ||
+		   ether_oui_equal(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM)) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
-	} else if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
-		  net->ralink_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, BELKINF5D8233V1_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, BELKINF5D82334V3_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, PCI_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, EDIMAX_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, AIRLINK_RALINK) == 0) ||
+		   net->ralink_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_RALINK;
 	} else if ((net->atheros_cap_exist) ||
-		(memcmp(net->bssid, DLINK_ATHEROS_1, 3) == 0) ||
-		(memcmp(net->bssid, DLINK_ATHEROS_2, 3) == 0)) {
+		   (ether_oui_equal(net->bssid, DLINK_ATHEROS_1) == 0) ||
+		   (ether_oui_equal(net->bssid, DLINK_ATHEROS_2) == 0)) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS;
-	} else if ((memcmp(net->bssid, CISCO_BROADCOM, 3) == 0) ||
-		  net->cisco_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, CISCO_BROADCOM) == 0) ||
+		   net->cisco_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_CISCO;
-	} else if ((memcmp(net->bssid, LINKSYS_MARVELL_4400N, 3) == 0) ||
-		  net->marvell_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, LINKSYS_MARVELL_4400N) == 0) ||
+		   net->marvell_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_MARVELL;
 	} else if (net->airgo_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_AIRGO;
include/linux/etherdevice.h +0 -0
index 2e5debc0373c..6a1a63168319 100644
@@ -87,6 +87,11 @@ static inline bool is_link_local_ether_addr(const u8 *addr)
 #endif
 }
 
Quoted 8 lines

include/linux/etherdevice.h static inline bool is_link_local_ether_addr(const u8 *addr) · line 93

Quoted 4 lines
include/linux/etherdevice.h +4 -0
+static inline bool ether_oui_equal(const u8 *addr, const u8 *oui)
+{
+return addr[0] == oui[0] && addr[1] == oui[1] && addr[2] == oui[2];
+}

Staging drivers are stand-alone, we can not add code outside of the driver directory in these patches, sorry.

Okay Sir. When I tried to add static inline bool line in current file, it showed errors which I was not able to rectify, but when I added that line to include/linux/etherdevice.h file, and replaced memcmp with ether_oui_equal, it worked fine.
I may be wrong in application. May I know how to resolve this?

Quoted 3 lines

And as Dan said, this is wrong formatting, did you run checkpatch.pl on your changes?

Yes Sir, I ran checkpatch.pl, on both files, it showed no errors against the changes I made.

Quoted 3 lines

thanks,

greg k-h

maintainer
#9 lore raw

Re: [PATCH v2 4/5] staging: rtl8192e: rectified spelling mistake and replace memcmp with ether_oui_equal

Quoted 113 lines · Mitali Borkar
Quoted 104 lines · Greg KH
Quoted 103 lines · Mitali Borkar

Added a generic function of static inline bool in include/linux/etherdevice.h to replace memcmp with ether_oui_equal throughout the execution. Corrected the misspelled words in this file.

---

Changes from v1:- Rectified spelling mistake and replaced memcmp with ether_oui_equal.

 drivers/staging/rtl8192e/rtl819x_HTProc.c | 48 +++++++++++------------
 include/linux/etherdevice.h               |  5 +++
 2 files changed, 29 insertions(+), 24 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +24 -24
index ec6b46166e84..ce58feb2af9a 100644
@@ -43,7 +43,7 @@ u16 MCS_DATA_RATE[2][2][77] = {
 	 810, 720, 810, 900, 900, 990} }
 };
 
-static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
+static u8 UNKNOWN_BROADCOM[3] = {0x00, 0x14, 0xbf};
 
 static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0x00, 0x1a, 0x70};
 
@@ -146,16 +146,16 @@ bool IsHTHalfNmodeAPs(struct rtllib_device *ieee)
 	bool			retValue = false;
 	struct rtllib_network *net = &ieee->current_network;
 
-	if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
-	    (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
+	if ((ether_oui_equal(net->bssid, BELKINF5D8233V1_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, BELKINF5D82334V3_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, PCI_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, EDIMAX_RALINK) == 0) ||
+	    (ether_oui_equal(net->bssid, AIRLINK_RALINK) == 0) ||
 	    (net->ralink_cap_exist))
 		retValue = true;
-	else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ||
+	else if (ether_oui_equal(net->bssid, UNKNOWN_BROADCOM) ||
+		 ether_oui_equal(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM) ||
+		 ether_oui_equal(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM) ||
 		 (net->broadcom_cap_exist))
 		retValue = true;
 	else if (net->bssht.bd_rt2rt_aggregation)
@@ -179,26 +179,26 @@ static void HTIOTPeerDetermine(struct rtllib_device *ieee)
 			pHTInfo->IOTPeer = HT_IOT_PEER_92U_SOFTAP;
 	} else if (net->broadcom_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
-	} else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
-		 !memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)) {
+	} else if (ether_oui_equal(net->bssid, UNKNOWN_BROADCOM) ||
+		   ether_oui_equal(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM) ||
+		   ether_oui_equal(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM)) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
-	} else if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
-		 (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
-		  net->ralink_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, BELKINF5D8233V1_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, BELKINF5D82334V3_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, PCI_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, EDIMAX_RALINK) == 0) ||
+		   (ether_oui_equal(net->bssid, AIRLINK_RALINK) == 0) ||
+		   net->ralink_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_RALINK;
 	} else if ((net->atheros_cap_exist) ||
-		(memcmp(net->bssid, DLINK_ATHEROS_1, 3) == 0) ||
-		(memcmp(net->bssid, DLINK_ATHEROS_2, 3) == 0)) {
+		   (ether_oui_equal(net->bssid, DLINK_ATHEROS_1) == 0) ||
+		   (ether_oui_equal(net->bssid, DLINK_ATHEROS_2) == 0)) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS;
-	} else if ((memcmp(net->bssid, CISCO_BROADCOM, 3) == 0) ||
-		  net->cisco_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, CISCO_BROADCOM) == 0) ||
+		   net->cisco_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_CISCO;
-	} else if ((memcmp(net->bssid, LINKSYS_MARVELL_4400N, 3) == 0) ||
-		  net->marvell_cap_exist) {
+	} else if ((ether_oui_equal(net->bssid, LINKSYS_MARVELL_4400N) == 0) ||
+		   net->marvell_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_MARVELL;
 	} else if (net->airgo_cap_exist) {
 		pHTInfo->IOTPeer = HT_IOT_PEER_AIRGO;
include/linux/etherdevice.h +0 -0
index 2e5debc0373c..6a1a63168319 100644
@@ -87,6 +87,11 @@ static inline bool is_link_local_ether_addr(const u8 *addr)
 #endif
 }
 
Quoted 8 lines

include/linux/etherdevice.h static inline bool is_link_local_ether_addr(const u8 *addr) · line 93

Quoted 4 lines
include/linux/etherdevice.h +4 -0
+static inline bool ether_oui_equal(const u8 *addr, const u8 *oui)
+{
+return addr[0] == oui[0] && addr[1] == oui[1] && addr[2] == oui[2];
+}

Staging drivers are stand-alone, we can not add code outside of the driver directory in these patches, sorry.

Quoted 2 lines

Okay Sir. When I tried to add static inline bool line in current file, it showed errors which I was not able to rectify,

What errors was shown?

What did you do to try to fix it?

There should not be any need to add this to a kernel-wide header file for a tiny staging driver.

thanks,

greg k-h

#6 lore raw

Re: [PATCH v2 4/5] staging: rtl8192e: rectified spelling mistake and replace memcmp with ether_oui_equal

In reply to Dan Carpenter
Quoted 9 lines · Dan Carpenter
Quoted 8 lines · Mitali Borkar

Added a generic function of static inline bool in include/linux/etherdevice.h to replace memcmp with ether_oui_equal throughout the execution. Corrected the misspelled words in this file.

---

Quoted 9 lines
Quoted 5 lines

Changes from v1:- Rectified spelling mistake and replaced memcmp with ether_oui_equal.

 drivers/staging/rtl8192e/rtl819x_HTProc.c | 48 +++++++++++------------
 include/linux/etherdevice.h               |  5 +++

^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is networking code and not staging code, but the netdev mailing list isn't CC'd.

I didn't knew mail id then, I will look into this,

Quoted 10 lines
Quoted 10 lines
 2 files changed, 29 insertions(+), 24 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +0 -0
index ec6b46166e84..ce58feb2af9a 100644
@@ -43,7 +43,7 @@ u16 MCS_DATA_RATE[2][2][77] = {
 	 810, 720, 810, 900, 900, 990} }
 };
 
Quoted 5 lines

drivers/staging/rtl8192e/rtl819x_HTProc.c u16 MCS_DATA_RATE[2][2][77] = { · line 46

Quoted 2 lines
drivers/staging/rtl8192e/rtl819x_HTProc.c +1 -1
-static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
+static u8 UNKNOWN_BROADCOM[3] = {0x00, 0x14, 0xbf};

Please pull this spelling fix into its own patch.

Okay Sir.

Quoted 10 lines

[ snip ]

Quoted 8 lines
include/linux/etherdevice.h +0 -0
index 2e5debc0373c..6a1a63168319 100644
@@ -87,6 +87,11 @@ static inline bool is_link_local_ether_addr(const u8 *addr)
 #endif
 }
 
Quoted 7 lines

include/linux/etherdevice.h static inline bool is_link_local_ether_addr(const u8 *addr) · line 93

Quoted 4 lines
include/linux/etherdevice.h +4 -0
+static inline bool ether_oui_equal(const u8 *addr, const u8 *oui)
+{
+return addr[0] == oui[0] && addr[1] == oui[1] && addr[2] == oui[2];
+}

The indenting is messed up on this.

OKay Sir, I am looking into this.

Quoted 3 lines

regards,
dan carpenter