Переглянути джерело

qcacld-3.0: Rename hdd_is_valid_mac_address() pMacAddr param

hdd_is_valid_mac_address() currently takes a parameter named pMacAddr.
Per the Linux coding style "mixed-case names are frowned upon" and
"so-called Hungarian notation [...] is brain damaged" so rename the
parameter to mac_addr to conform to the naming convention. As part of
the cleanup relocate the documentation so that the interface is
documented, not the implementation.

Change-Id: I4abff563bb396a4ffce1356527307ce3bfed8a16
CRs-Fixed: 2347990
Jeff Johnson 6 роки тому
батько
коміт
030cd90bd9
2 змінених файлів з 23 додано та 22 видалено
  1. 17 1
      core/hdd/inc/wlan_hdd_main.h
  2. 6 21
      core/hdd/src/wlan_hdd_main.c

+ 17 - 1
core/hdd/inc/wlan_hdd_main.h

@@ -2289,7 +2289,23 @@ int __hdd_validate_adapter(struct hdd_adapter *adapter, const char *func);
 
 int __wlan_hdd_validate_session_id(uint8_t session_id, const char *func);
 
-bool hdd_is_valid_mac_address(const uint8_t *pMacAddr);
+/**
+ * hdd_is_valid_mac_address() - validate MAC address
+ * @mac_addr:	Pointer to the input MAC address
+ *
+ * This function validates whether the given MAC address is valid or not
+ * Expected MAC address is of the format XX:XX:XX:XX:XX:XX
+ * where X is the hexa decimal digit character and separated by ':'
+ * This algorithm works even if MAC address is not separated by ':'
+ *
+ * This code checks given input string mac contains exactly 12 hexadecimal
+ * digits and a separator colon : appears in the input string only after
+ * an even number of hex digits.
+ *
+ * Return: true for valid and false for invalid
+ */
+bool hdd_is_valid_mac_address(const uint8_t *mac_addr);
+
 QDF_STATUS hdd_issta_p2p_clientconnected(struct hdd_context *hdd_ctx);
 bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx);
 

+ 6 - 21
core/hdd/src/wlan_hdd_main.c

@@ -1987,39 +1987,24 @@ bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx)
 	return true;
 }
 
-/**
- * hdd_is_valid_mac_address() - validate MAC address
- * @pMacAddr:	Pointer to the input MAC address
- *
- * This function validates whether the given MAC address is valid or not
- * Expected MAC address is of the format XX:XX:XX:XX:XX:XX
- * where X is the hexa decimal digit character and separated by ':'
- * This algorithm works even if MAC address is not separated by ':'
- *
- * This code checks given input string mac contains exactly 12 hexadecimal
- * digits and a separator colon : appears in the input string only after
- * an even number of hex digits.
- *
- * Return: 1 for valid and 0 for invalid
- */
-bool hdd_is_valid_mac_address(const uint8_t *pMacAddr)
+bool hdd_is_valid_mac_address(const uint8_t *mac_addr)
 {
 	int xdigit = 0;
 	int separator = 0;
 
-	while (*pMacAddr) {
-		if (isxdigit(*pMacAddr)) {
+	while (*mac_addr) {
+		if (isxdigit(*mac_addr)) {
 			xdigit++;
-		} else if (':' == *pMacAddr) {
+		} else if (':' == *mac_addr) {
 			if (0 == xdigit || ((xdigit / 2) - 1) != separator)
 				break;
 
 			++separator;
 		} else {
 			/* Invalid MAC found */
-			return 0;
+			return false;
 		}
-		++pMacAddr;
+		++mac_addr;
 	}
 	return xdigit == 12 && (separator == 5 || separator == 0);
 }