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
This commit is contained in:
@@ -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);
|
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);
|
QDF_STATUS hdd_issta_p2p_clientconnected(struct hdd_context *hdd_ctx);
|
||||||
bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx);
|
bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx);
|
||||||
|
|
||||||
|
@@ -1987,39 +1987,24 @@ bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
bool hdd_is_valid_mac_address(const uint8_t *mac_addr)
|
||||||
* 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)
|
|
||||||
{
|
{
|
||||||
int xdigit = 0;
|
int xdigit = 0;
|
||||||
int separator = 0;
|
int separator = 0;
|
||||||
|
|
||||||
while (*pMacAddr) {
|
while (*mac_addr) {
|
||||||
if (isxdigit(*pMacAddr)) {
|
if (isxdigit(*mac_addr)) {
|
||||||
xdigit++;
|
xdigit++;
|
||||||
} else if (':' == *pMacAddr) {
|
} else if (':' == *mac_addr) {
|
||||||
if (0 == xdigit || ((xdigit / 2) - 1) != separator)
|
if (0 == xdigit || ((xdigit / 2) - 1) != separator)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++separator;
|
++separator;
|
||||||
} else {
|
} else {
|
||||||
/* Invalid MAC found */
|
/* Invalid MAC found */
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
++pMacAddr;
|
++mac_addr;
|
||||||
}
|
}
|
||||||
return xdigit == 12 && (separator == 5 || separator == 0);
|
return xdigit == 12 && (separator == 5 || separator == 0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user