[PATCH v5 14/15] staging: rtl8723au: Use __func__ in trace logs

2015-03-28 Thread M. Vefa Bicakci
Rework the trace log-related lines in rtl8723au's rtw_security.c
to use the __func__ GCC magic variable instead of hardcoding the
function names into the trace log strings. This also corrects a
copy-paste-related typo in the function named rtw_tkip_decrypt23a.

Thanks to Jes Sorensen for the suggestion to use __func__.

Signed-off-by: M. Vefa Bicakci 
---
 drivers/staging/rtl8723au/core/rtw_security.c | 41 ++-
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_security.c 
b/drivers/staging/rtl8723au/core/rtw_security.c
index 0ed048fcb36f..5ef16bb30dc4 100644
--- a/drivers/staging/rtl8723au/core/rtw_security.c
+++ b/drivers/staging/rtl8723au/core/rtw_security.c
@@ -248,9 +248,9 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter,
 
if (actual_crc != expected_crc) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-"rtw_wep_decrypt23a:icv CRC mismatch: "
+"%s:icv CRC mismatch: "
 "actual: %08x, expected: %08x\n",
-actual_crc, expected_crc);
+__func__, actual_crc, expected_crc);
}
 }
 
@@ -635,13 +635,13 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter,
 
if (stainfo == NULL) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-"rtw_tkip_encrypt23a: stainfo == NULL!!!\n");
+"%s: stainfo == NULL!!!\n", __func__);
DBG_8723A("%s, psta == NUL\n", __func__);
return _FAIL;
}
 
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-"rtw_tkip_encrypt23a: stainfo!= NULL!!!\n");
+"%s: stainfo!= NULL!!!\n", __func__);
 
if (!(stainfo->state & _FW_LINKED)) {
DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, 
stainfo->state);
@@ -733,7 +733,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
 >ta[0]);
if (stainfo == NULL) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-"rtw_tkip_decrypt23a: stainfo == NULL!!!\n");
+"%s: stainfo == NULL!!!\n", __func__);
return _FAIL;
}
 
@@ -748,7 +748,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
prwskeylen = 16;
} else {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-"rtw_tkip_decrypt23a: stainfo!= NULL!!!\n");
+"%s: stainfo!= NULL!!!\n", __func__);
prwskey = >dot118021x_UncstKey.skey[0];
prwskeylen = 16;
}
@@ -774,9 +774,9 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
 
if (actual_crc != expected_crc) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-"rtw_wep_decrypt23a:icv CRC mismatch: "
+"%s:icv CRC mismatch: "
 "actual: %08x, expected: %08x\n",
-actual_crc, expected_crc);
+__func__, actual_crc, expected_crc);
res = _FAIL;
}
 
@@ -1313,7 +1313,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter,
 
if (!stainfo) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-"rtw_aes_encrypt23a: stainfo == NULL!!!\n");
+"%s: stainfo == NULL!!!\n", __func__);
DBG_8723A("%s, psta == NUL\n", __func__);
res = _FAIL;
goto out;
@@ -1324,7 +1324,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter,
return _FAIL;
}
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-"rtw_aes_encrypt23a: stainfo!= NULL!!!\n");
+"%s: stainfo!= NULL!!!\n", __func__);
 
if (is_multicast_ether_addr(pattrib->ra))
prwskey = 
psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;
@@ -1552,11 +1552,14 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 
*pframe, uint plen)
for (i = 0; i < 8; i++) {
if (pframe[hdrlen + 8 + plen - 8 + i] != message[hdrlen + 8 + 
plen - 8 + i]) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-"aes_decipher:mic check error mic[%d]: 
pframe(%x) != message(%x)\n",
-i, pframe[hdrlen + 8 + plen - 8 + i],
+"%s:mic check error mic[%d]: pframe(%x) != 
message(%x)\n",
+__func__, i,
+pframe[hdrlen + 8 + plen - 8 + i],
 message[hdrlen + 8 + plen - 8 + i]);
-   DBG_8723A("aes_decipher:mic check error mic[%d]: 
pframe(%x) != message(%x)\n",
-   

[PATCH v5 14/15] staging: rtl8723au: Use __func__ in trace logs

2015-03-28 Thread M. Vefa Bicakci
Rework the trace log-related lines in rtl8723au's rtw_security.c
to use the __func__ GCC magic variable instead of hardcoding the
function names into the trace log strings. This also corrects a
copy-paste-related typo in the function named rtw_tkip_decrypt23a.

Thanks to Jes Sorensen for the suggestion to use __func__.

Signed-off-by: M. Vefa Bicakci m@runbox.com
---
 drivers/staging/rtl8723au/core/rtw_security.c | 41 ++-
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_security.c 
b/drivers/staging/rtl8723au/core/rtw_security.c
index 0ed048fcb36f..5ef16bb30dc4 100644
--- a/drivers/staging/rtl8723au/core/rtw_security.c
+++ b/drivers/staging/rtl8723au/core/rtw_security.c
@@ -248,9 +248,9 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter,
 
if (actual_crc != expected_crc) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-rtw_wep_decrypt23a:icv CRC mismatch: 
+%s:icv CRC mismatch: 
 actual: %08x, expected: %08x\n,
-actual_crc, expected_crc);
+__func__, actual_crc, expected_crc);
}
 }
 
@@ -635,13 +635,13 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter,
 
if (stainfo == NULL) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-rtw_tkip_encrypt23a: stainfo == NULL!!!\n);
+%s: stainfo == NULL!!!\n, __func__);
DBG_8723A(%s, psta == NUL\n, __func__);
return _FAIL;
}
 
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-rtw_tkip_encrypt23a: stainfo!= NULL!!!\n);
+%s: stainfo!= NULL!!!\n, __func__);
 
if (!(stainfo-state  _FW_LINKED)) {
DBG_8723A(%s, psta-state(0x%x) != _FW_LINKED\n, __func__, 
stainfo-state);
@@ -733,7 +733,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
 prxattrib-ta[0]);
if (stainfo == NULL) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-rtw_tkip_decrypt23a: stainfo == NULL!!!\n);
+%s: stainfo == NULL!!!\n, __func__);
return _FAIL;
}
 
@@ -748,7 +748,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
prwskeylen = 16;
} else {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-rtw_tkip_decrypt23a: stainfo!= NULL!!!\n);
+%s: stainfo!= NULL!!!\n, __func__);
prwskey = stainfo-dot118021x_UncstKey.skey[0];
prwskeylen = 16;
}
@@ -774,9 +774,9 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
 
if (actual_crc != expected_crc) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-rtw_wep_decrypt23a:icv CRC mismatch: 
+%s:icv CRC mismatch: 
 actual: %08x, expected: %08x\n,
-actual_crc, expected_crc);
+__func__, actual_crc, expected_crc);
res = _FAIL;
}
 
@@ -1313,7 +1313,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter,
 
if (!stainfo) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-rtw_aes_encrypt23a: stainfo == NULL!!!\n);
+%s: stainfo == NULL!!!\n, __func__);
DBG_8723A(%s, psta == NUL\n, __func__);
res = _FAIL;
goto out;
@@ -1324,7 +1324,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter,
return _FAIL;
}
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-rtw_aes_encrypt23a: stainfo!= NULL!!!\n);
+%s: stainfo!= NULL!!!\n, __func__);
 
if (is_multicast_ether_addr(pattrib-ra))
prwskey = 
psecuritypriv-dot118021XGrpKey[psecuritypriv-dot118021XGrpKeyid].skey;
@@ -1552,11 +1552,14 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 
*pframe, uint plen)
for (i = 0; i  8; i++) {
if (pframe[hdrlen + 8 + plen - 8 + i] != message[hdrlen + 8 + 
plen - 8 + i]) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-aes_decipher:mic check error mic[%d]: 
pframe(%x) != message(%x)\n,
-i, pframe[hdrlen + 8 + plen - 8 + i],
+%s:mic check error mic[%d]: pframe(%x) != 
message(%x)\n,
+__func__, i,
+pframe[hdrlen + 8 + plen - 8 + i],
 message[hdrlen + 8 + plen - 8 + i]);
-   DBG_8723A(aes_decipher:mic check error mic[%d]: 
pframe(%x) != message(%x)\n,
- i,