[OPW,kernel,v3,20/28] staging: rtl8723au: hal: usb_halinit.c: Replace non-standard return values
diff mbox

Message ID 1414668396-4093-21-git-send-email-roberta.dobrescu@gmail.com
State New, archived
Headers show

Commit Message

Roberta Dobrescu Oct. 30, 2014, 11:26 a.m. UTC
This patch replaces non-standard return values _SUCCESS/_FAIL with 0
or an appropriate err code and modifies the code according to that.

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
---
 drivers/staging/rtl8723au/hal/usb_halinit.c | 40 ++++++++++++++---------------
 1 file changed, 19 insertions(+), 21 deletions(-)

Patch
diff mbox

diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c
index adc2953..dc25b4d 100644
--- a/drivers/staging/rtl8723au/hal/usb_halinit.c
+++ b/drivers/staging/rtl8723au/hal/usb_halinit.c
@@ -94,7 +94,7 @@  void rtl8723au_chip_configure(struct rtw_adapter *padapter)
 
 static int _InitPowerOn(struct rtw_adapter *padapter)
 {
-	int status = _SUCCESS;
+	int status = 0;
 	u16 value16 = 0;
 	u8 value8 = 0;
 
@@ -105,7 +105,7 @@  static int _InitPowerOn(struct rtw_adapter *padapter)
 	/*  HW Power on sequence */
 	if (!HalPwrSeqCmdParsing23a(padapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,
 				 PWR_INTF_USB_MSK, rtl8723AU_card_enable_flow))
-		return _FAIL;
+		return -EINVAL;
 
 	/*  0x04[19] = 1, suggest by Jackie 2011.05.09, reset 8051 */
 	value8 = rtl8723au_read8(padapter, REG_APS_FSMCO+2);
@@ -533,7 +533,7 @@  int rtl8723au_hal_init(struct rtw_adapter *Adapter)
 {
 	u8 val8 = 0;
 	u32 boundary;
-	int status = _SUCCESS;
+	int status = 0;
 	struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
 	struct pwrctrl_priv *pwrctrlpriv = &Adapter->pwrctrlpriv;
 	struct registry_priv *pregistrypriv = &Adapter->registrypriv;
@@ -574,7 +574,7 @@  int rtl8723au_hal_init(struct rtw_adapter *Adapter)
 	}
 
 	status = _InitPowerOn(Adapter);
-	if (status == _FAIL) {
+	if (status < 0) {
 		RT_TRACE(_module_hci_hal_init_c_, _drv_err_,
 			 ("Failed to init power on!\n"));
 		goto exit;
@@ -589,7 +589,7 @@  int rtl8723au_hal_init(struct rtw_adapter *Adapter)
 
 	if (!pHalData->bMACFuncEnable) {
 		status =  InitLLTTable23a(Adapter, boundary);
-		if (status == _FAIL) {
+		if (status < 0) {
 			RT_TRACE(_module_hci_hal_init_c_, _drv_err_,
 				 ("Failed to init LLT table\n"));
 			goto exit;
@@ -600,7 +600,7 @@  int rtl8723au_hal_init(struct rtw_adapter *Adapter)
 		_InitRDGSetting(Adapter);
 
 	status = rtl8723a_FirmwareDownload(Adapter);
-	if (status != _SUCCESS) {
+	if (status != 0) {
 		Adapter->bFWReady = false;
 		pHalData->fw_ractrl = false;
 		DBG_8723A("fw download fail!\n");
@@ -631,7 +631,7 @@  int rtl8723au_hal_init(struct rtw_adapter *Adapter)
 	pHalData->CurrentChannel = 6;/* default set to 6 */
 
 	status = PHY_MACConfig8723A(Adapter);
-	if (status == _FAIL) {
+	if (status < 0) {
 		DBG_8723A("PHY_MACConfig8723A fault !!\n");
 		goto exit;
 	}
@@ -640,7 +640,7 @@  int rtl8723au_hal_init(struct rtw_adapter *Adapter)
 	/* d. Initialize BB related configurations. */
 	/*  */
 	status = PHY_BBConfig8723A(Adapter);
-	if (status == _FAIL) {
+	if (status < 0) {
 		DBG_8723A("PHY_BBConfig8723A fault !!\n");
 		goto exit;
 	}
@@ -649,7 +649,7 @@  int rtl8723au_hal_init(struct rtw_adapter *Adapter)
 	/*  Because the tx power by rate table is inited in BB config. */
 
 	status = PHY_RF6052_Config8723A(Adapter);
-	if (status == _FAIL) {
+	if (status < 0) {
 		DBG_8723A("PHY_RF6052_Config8723A failed!!\n");
 		goto exit;
 	}
@@ -793,7 +793,7 @@  int rtl8723au_hal_init(struct rtw_adapter *Adapter)
 			  rtl8723au_read32(Adapter, REG_FWHW_TXQ_CTRL)|BIT(12));
 
 exit:
-	if (status == _SUCCESS) {
+	if (status == 0) {
 		Adapter->hw_init_completed = true;
 
 		if (Adapter->registrypriv.notch_filter == 1)
@@ -1124,37 +1124,35 @@  int rtl8723au_hal_deinit(struct rtw_adapter *padapter)
 
 	padapter->hw_init_completed = false;
 
-	return _SUCCESS;
+	return 0;
 }
 
 int rtl8723au_inirp_init(struct rtw_adapter *Adapter)
 {
 	u8 i;
 	struct recv_buf *precvbuf;
-	int status;
+	int status = 0;
 	struct recv_priv *precvpriv = &Adapter->recvpriv;
 	struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
 
-	status = _SUCCESS;
-
 	RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("===> usb_inirp_init\n"));
 
 	/* issue Rx irp to receive data */
 	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
 	for (i = 0; i < NR_RECVBUFF; i++) {
 		if (rtl8723au_read_port(Adapter, RECV_BULK_IN_ADDR, 0,
-					precvbuf) == _FAIL) {
+					precvbuf) < 0) {
 			RT_TRACE(_module_hci_hal_init_c_, _drv_err_,
 				 ("usb_rx_init: usb_read_port error\n"));
-			status = _FAIL;
+			status = -EIO;
 			goto exit;
 		}
 		precvbuf++;
 	}
-	if (rtl8723au_read_interrupt(Adapter, RECV_INT_IN_ADDR) == _FAIL) {
+	if (rtl8723au_read_interrupt(Adapter, RECV_INT_IN_ADDR) < 0) {
 		RT_TRACE(_module_hci_hal_init_c_, _drv_err_,
 			 ("usb_rx_init: usb_read_interrupt error\n"));
-		status = _FAIL;
+		status = -EINTR;
 	}
 	pHalData->IntrMask[0] = rtl8723au_read32(Adapter, REG_USB_HIMR);
 	MSG_8723A("pHalData->IntrMask = 0x%04x\n", pHalData->IntrMask[0]);
@@ -1180,7 +1178,7 @@  int rtl8723au_inirp_deinit(struct rtw_adapter *Adapter)
 	rtl8723au_write32(Adapter, REG_USB_HIMR, pHalData->IntrMask[0]);
 	RT_TRACE(_module_hci_hal_init_c_, _drv_info_,
 		 ("\n <=== usb_rx_deinit\n"));
-	return _SUCCESS;
+	return 0;
 }
 
 static void _ReadBoardType(struct rtw_adapter *Adapter, u8 *PROMContent,
@@ -1369,7 +1367,7 @@  int GetHalDefVar8192CUsb(struct rtw_adapter *Adapter,
 			 enum hal_def_variable eVariable, void *pValue)
 {
 	struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
-	int bResult = _SUCCESS;
+	int bResult = 0;
 
 	switch (eVariable) {
 	case HAL_DEF_UNDERCORATEDSMOOTHEDPWDB:
@@ -1407,7 +1405,7 @@  int GetHalDefVar8192CUsb(struct rtw_adapter *Adapter,
 	default:
 		/* RT_TRACE(COMP_INIT, DBG_WARNING, ("GetHalDefVar8192CUsb(): "
 		   "Unkown variable: %d!\n", eVariable)); */
-		bResult = _FAIL;
+		bResult = -EINVAL;
 		break;
 	}