diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2014-05-16 10:04:29 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-16 11:34:28 -0700 |
commit | 44f3f16d8ba0d36c6fdc1ce5a3fe5ff288ff990b (patch) | |
tree | 052d454ba869ff430686d28a49464672f663cddd | |
parent | 1ec8911b6d7d12757be89d6d8f0cbbd8aa4ba350 (diff) | |
download | linux-44f3f16d8ba0d36c6fdc1ce5a3fe5ff288ff990b.tar.bz2 |
staging: rtl8723au: Clean up error code mess in rtw_efuse.c
Use int to return error codes, and avoid mixing and matching
true/false with _FAIL/_SUCCESS at random.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/rtl8723au/core/rtw_efuse.c | 53 | ||||
-rw-r--r-- | drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 6 | ||||
-rw-r--r-- | drivers/staging/rtl8723au/include/rtw_efuse.h | 11 |
3 files changed, 34 insertions, 36 deletions
diff --git a/drivers/staging/rtl8723au/core/rtw_efuse.c b/drivers/staging/rtl8723au/core/rtw_efuse.c index 8ba5166a2559..61fef36ab35a 100644 --- a/drivers/staging/rtl8723au/core/rtw_efuse.c +++ b/drivers/staging/rtl8723au/core/rtw_efuse.c @@ -403,11 +403,11 @@ EFUSE_Write1Byte( }/* EFUSE_Write1Byte */ /* 11/16/2008 MH Read one byte from real Efuse. */ -u8 +int efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data) { u8 tmpidx = 0; - u8 bResult; + int bResult; /* -----------------e-fuse reg ctrl --------------------------------- */ /* address */ @@ -421,20 +421,20 @@ efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data) tmpidx++; if (tmpidx < 100) { *data = rtw_read8(pAdapter, EFUSE_CTRL); - bResult = true; + bResult = _SUCCESS; } else { *data = 0xff; - bResult = false; + bResult = _FAIL; } return bResult; } /* 11/16/2008 MH Write one byte to reald Efuse. */ -u8 +int efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data) { u8 tmpidx = 0; - u8 bResult; + int bResult; /* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr = %x Data =%x\n", addr, data)); */ @@ -453,14 +453,10 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data) tmpidx++; } - if (tmpidx<100) - { - bResult = true; - } + if (tmpidx < 100) + bResult = _SUCCESS; else - { - bResult = false; - } + bResult = _FAIL; return bResult; } @@ -509,12 +505,12 @@ efuse_WordEnableDataRead23a(u8 word_en, } } -static u8 efuse_read8(struct rtw_adapter *padapter, u16 address, u8 *value) +static int efuse_read8(struct rtw_adapter *padapter, u16 address, u8 *value) { return efuse_OneByteRead23a(padapter, address, value); } -static u8 efuse_write8(struct rtw_adapter *padapter, u16 address, u8 *value) +static int efuse_write8(struct rtw_adapter *padapter, u16 address, u8 *value) { return efuse_OneByteWrite23a(padapter, address, *value); } @@ -522,13 +518,13 @@ static u8 efuse_write8(struct rtw_adapter *padapter, u16 address, u8 *value) /* * read/wirte raw efuse data */ -u8 rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr, - u16 cnts, u8 *data) +int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr, + u16 cnts, u8 *data) { int i = 0; - u16 real_content_len = 0, max_available_size = 0; - u8 res = _FAIL ; - u8 (*rw8)(struct rtw_adapter *, u16, u8*); + u16 real_content_len = 0, max_available_size = 0; + int res = _FAIL ; + int (*rw8)(struct rtw_adapter *, u16, u8*); EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, @@ -557,7 +553,8 @@ u8 rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr, } res = rw8(padapter, start_addr++, data++); - if (_FAIL == res) break; + if (res == _FAIL) + break; } Efuse_PowerSwitch(padapter, bWrite, false); @@ -567,14 +564,14 @@ u8 rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr, /* */ u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter) { - u16 max_size; + u16 max_size; EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_size); return max_size; } /* */ -u8 efuse_GetCurrentSize23a(struct rtw_adapter *padapter, u16 *size) +int efuse_GetCurrentSize23a(struct rtw_adapter *padapter, u16 *size) { Efuse_PowerSwitch(padapter, false, true); *size = Efuse_GetCurrentSize23a(padapter, EFUSE_WIFI); @@ -583,9 +580,10 @@ u8 efuse_GetCurrentSize23a(struct rtw_adapter *padapter, u16 *size) return _SUCCESS; } /* */ -u8 rtw_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data) +int rtw_efuse_map_read23a(struct rtw_adapter *padapter, + u16 addr, u16 cnts, u8 *data) { - u16 mapLen = 0; + u16 mapLen = 0; EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (void *)&mapLen); @@ -602,9 +600,10 @@ u8 rtw_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *d return _SUCCESS; } -u8 rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data) +int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter, + u16 addr, u16 cnts, u8 *data) { - u16 mapLen = 0; + u16 mapLen = 0; EFUSE_GetEfuseDefinition23a(padapter, EFUSE_BT, TYPE_EFUSE_MAP_LEN, (void *)&mapLen); diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index ca122d0f80a6..3a9a96a2a5ea 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -703,7 +703,7 @@ u16 rtl8723a_EfuseGetCurrentSize_WiFi(struct rtw_adapter *padapter) while (AVAILABLE_EFUSE_ADDR(efuse_addr)) { if (efuse_OneByteRead23a(padapter, efuse_addr, &efuse_data) == - false) { + _FAIL) { DBG_8723A(KERN_ERR "%s: efuse_OneByteRead23a Fail! " "addr = 0x%X !!\n", __func__, efuse_addr); break; @@ -774,7 +774,7 @@ u16 rtl8723a_EfuseGetCurrentSize_BT(struct rtw_adapter *padapter) while (AVAILABLE_EFUSE_ADDR(efuse_addr)) { if (efuse_OneByteRead23a(padapter, efuse_addr, - &efuse_data) == false) { + &efuse_data) == _FAIL) { DBG_8723A(KERN_ERR "%s: efuse_OneByteRead23a Fail!" " addr = 0x%X !!\n", __func__, efuse_addr); @@ -851,7 +851,7 @@ rtl8723a_EfusePgPacketRead(struct rtw_adapter *padapter, u8 offset, u8 *data) /* */ while (AVAILABLE_EFUSE_ADDR(efuse_addr)) { if (efuse_OneByteRead23a(padapter, efuse_addr++, &efuse_data) == - false) { + _FAIL) { ret = false; break; } diff --git a/drivers/staging/rtl8723au/include/rtw_efuse.h b/drivers/staging/rtl8723au/include/rtw_efuse.h index a7755056163f..07bdc3464443 100644 --- a/drivers/staging/rtl8723au/include/rtw_efuse.h +++ b/drivers/staging/rtl8723au/include/rtw_efuse.h @@ -81,20 +81,19 @@ struct pg_pkt_struct { /*------------------------Export global variable----------------------------*/ -u8 efuse_GetCurrentSize23a(struct rtw_adapter *padapter, u16 *size); u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter); -u8 rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bRead, u16 start_addr, u16 cnts, u8 *data); -u8 rtw_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data); +int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bRead, u16 start_addr, u16 cnts, u8 *data); +int rtw_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data); u8 rtw_efuse_map_write(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data); -u8 rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data); +int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data); u8 rtw_BT_efuse_map_write(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data); u16 Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType); u8 Efuse_CalculateWordCnts23a(u8 word_en); void ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf); void EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, u8 type, void *pOut); -u8 efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data); -u8 efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data); +int efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data); +int efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data); void Efuse_PowerSwitch23a(struct rtw_adapter *pAdapter,u8 bWrite,u8 PwrState); int Efuse_PgPacketRead23a(struct rtw_adapter *pAdapter, u8 offset, u8 *data); |