All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] staging: r8188eu: some error logic cleanups
@ 2023-01-15 21:07 Michael Straube
  2023-01-15 21:07 ` [PATCH 1/4] staging: r8188eu: convert PHY_MACConfig8188E() to common error logic Michael Straube
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Michael Straube @ 2023-01-15 21:07 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube

This series converts some more functions away from returning _SUCCESS
and _FAIL.

Tested on x86_64 with Inter-Tech DMG-02.

Michael Straube (4):
  staging: r8188eu: convert PHY_MACConfig8188E() to common error logic
  staging: r8188eu: convert phy_RF6052_Config_ParaFile() to common error
    logic
  staging: r8188eu: convert phy_BB8188E_Config_ParaFile() to common
    error logic
  staging: r8188eu: convert PHY_BBConfig8188E() to common error logic

 drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 35 ++++++++++---------
 drivers/staging/r8188eu/hal/rtl8188e_rf6052.c |  7 ++--
 drivers/staging/r8188eu/hal/usb_halinit.c     | 15 ++++----
 3 files changed, 27 insertions(+), 30 deletions(-)

-- 
2.39.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] staging: r8188eu: convert PHY_MACConfig8188E() to common error logic
  2023-01-15 21:07 [PATCH 0/4] staging: r8188eu: some error logic cleanups Michael Straube
@ 2023-01-15 21:07 ` Michael Straube
  2023-01-15 21:07 ` [PATCH 2/4] staging: r8188eu: convert phy_RF6052_Config_ParaFile() " Michael Straube
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Straube @ 2023-01-15 21:07 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube

Convert the function PHY_MACConfig8188E() away from returning _FAIL or
_SUCCESS which uses inverted error logic. Use the common error logic
instead. Return 0 for success and negative values for failure.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 9 ++++-----
 drivers/staging/r8188eu/hal/usb_halinit.c     | 5 ++---
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
index b7f3c7a670fb..204c1c30377b 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
@@ -315,21 +315,20 @@ rtl8188e_PHY_SetRFReg(
  *  08/12/2008	MHC		Create Version 0.
  *
  *---------------------------------------------------------------------------*/
-s32 PHY_MACConfig8188E(struct adapter *Adapter)
+int PHY_MACConfig8188E(struct adapter *Adapter)
 {
 	struct hal_data_8188e *pHalData = &Adapter->haldata;
-	int rtStatus = _SUCCESS;
+	int err;
 
 	/*  */
 	/*  Config MAC */
 	/*  */
-	if (ODM_ReadAndConfig_MAC_REG_8188E(&pHalData->odmpriv))
-		rtStatus = _FAIL;
+	err = ODM_ReadAndConfig_MAC_REG_8188E(&pHalData->odmpriv);
 
 	/*  2010.07.13 AMPDU aggregation number B */
 	rtw_write16(Adapter, REG_MAX_AGGR_NUM, MAX_AGGR_NUM);
 
-	return rtStatus;
+	return err;
 }
 
 /**
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index d28b4dc2a767..9ba6a526e90d 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -600,9 +600,8 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter)
 	Adapter->pwrctrlpriv.bFwCurrentInPSMode = false;
 	haldata->LastHMEBoxNum = 0;
 
-	status = PHY_MACConfig8188E(Adapter);
-	if (status == _FAIL)
-		goto exit;
+	if (PHY_MACConfig8188E(Adapter))
+		return _FAIL;
 
 	/*  */
 	/* d. Initialize BB related configurations. */
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] staging: r8188eu: convert phy_RF6052_Config_ParaFile() to common error logic
  2023-01-15 21:07 [PATCH 0/4] staging: r8188eu: some error logic cleanups Michael Straube
  2023-01-15 21:07 ` [PATCH 1/4] staging: r8188eu: convert PHY_MACConfig8188E() to common error logic Michael Straube
@ 2023-01-15 21:07 ` Michael Straube
  2023-01-15 21:07 ` [PATCH 3/4] staging: r8188eu: convert phy_BB8188E_Config_ParaFile() " Michael Straube
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Straube @ 2023-01-15 21:07 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube

Convert the function phy_RF6052_Config_ParaFile() away from returning
_FAIL or _SUCCESS which uses inverted error logic. Use the common error
logic instead. Return 0 for success and negative values for failure.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 7 +++----
 drivers/staging/r8188eu/hal/usb_halinit.c     | 5 ++---
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
index e5ec6e563fbd..1988fb6e780a 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
@@ -371,7 +371,7 @@ int phy_RF6052_Config_ParaFile(struct adapter *Adapter)
 	struct bb_reg_def *pPhyReg;
 	struct hal_data_8188e *pHalData = &Adapter->haldata;
 	u32 u4RegValue = 0;
-	int rtStatus = _SUCCESS;
+	int err;
 
 	/* Initialize RF */
 
@@ -396,11 +396,10 @@ int phy_RF6052_Config_ParaFile(struct adapter *Adapter)
 	udelay(1);/* PlatformStallExecution(1); */
 
 	/*----Initialize RF fom connfiguration file----*/
-	if (ODM_ReadAndConfig_RadioA_1T_8188E(&pHalData->odmpriv))
-		rtStatus = _FAIL;
+	err = ODM_ReadAndConfig_RadioA_1T_8188E(&pHalData->odmpriv);
 
 	/*----Restore RFENV control type----*/;
 	rtl8188e_PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue);
 
-	return rtStatus;
+	return err;
 }
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index 9ba6a526e90d..cb36b42c5ecc 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -610,9 +610,8 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter)
 	if (status == _FAIL)
 		goto exit;
 
-	status = phy_RF6052_Config_ParaFile(Adapter);
-	if (status == _FAIL)
-		goto exit;
+	if (phy_RF6052_Config_ParaFile(Adapter))
+		return _FAIL;
 
 	status = rtl8188e_iol_efuse_patch(Adapter);
 	if (status == _FAIL)
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] staging: r8188eu: convert phy_BB8188E_Config_ParaFile() to common error logic
  2023-01-15 21:07 [PATCH 0/4] staging: r8188eu: some error logic cleanups Michael Straube
  2023-01-15 21:07 ` [PATCH 1/4] staging: r8188eu: convert PHY_MACConfig8188E() to common error logic Michael Straube
  2023-01-15 21:07 ` [PATCH 2/4] staging: r8188eu: convert phy_RF6052_Config_ParaFile() " Michael Straube
@ 2023-01-15 21:07 ` Michael Straube
  2023-01-15 21:07 ` [PATCH 4/4] staging: r8188eu: convert PHY_BBConfig8188E() " Michael Straube
  2023-01-16 19:33 ` [PATCH 0/4] staging: r8188eu: some error logic cleanups Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Straube @ 2023-01-15 21:07 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube

Convert the fubction phy_BB8188E_Config_ParaFile() away from returning
_FAIL or _SUCCESS which uses inverted error logic. Use the common error
logic instead. Return 0 for success and negative values for failure.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
index 204c1c30377b..c52af93f1669 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
@@ -449,13 +449,15 @@ static	int phy_BB8188E_Config_ParaFile(struct adapter *Adapter)
 {
 	struct eeprom_priv *pEEPROM = &Adapter->eeprompriv;
 	struct hal_data_8188e *pHalData = &Adapter->haldata;
+	int err;
 
 	/*  */
 	/*  1. Read PHY_REG.TXT BB INIT!! */
 	/*  We will separate as 88C / 92C according to chip version */
 	/*  */
-	if (ODM_ReadAndConfig_PHY_REG_1T_8188E(&pHalData->odmpriv))
-		return _FAIL;
+	err = ODM_ReadAndConfig_PHY_REG_1T_8188E(&pHalData->odmpriv);
+	if (err)
+		return err;
 
 	/*  2. If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */
 	if (!pEEPROM->bautoload_fail_flag) {
@@ -464,10 +466,11 @@ static	int phy_BB8188E_Config_ParaFile(struct adapter *Adapter)
 	}
 
 	/*  3. BB AGC table Initialization */
-	if (ODM_ReadAndConfig_AGC_TAB_1T_8188E(&pHalData->odmpriv))
-		return _FAIL;
+	err = ODM_ReadAndConfig_AGC_TAB_1T_8188E(&pHalData->odmpriv);
+	if (err)
+		return err;
 
-	return _SUCCESS;
+	return 0;
 }
 
 int
@@ -497,7 +500,8 @@ PHY_BBConfig8188E(
 	rtw_write8(Adapter, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | FEN_BB_GLB_RSTn | FEN_BBRSTB);
 
 	/*  Config BB and AGC */
-	rtStatus = phy_BB8188E_Config_ParaFile(Adapter);
+	if (phy_BB8188E_Config_ParaFile(Adapter))
+		rtStatus = _FAIL;
 
 	/*  write 0x24[16:11] = 0x24[22:17] = CrystalCap */
 	CrystalCap = pHalData->CrystalCap & 0x3F;
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] staging: r8188eu: convert PHY_BBConfig8188E() to common error logic
  2023-01-15 21:07 [PATCH 0/4] staging: r8188eu: some error logic cleanups Michael Straube
                   ` (2 preceding siblings ...)
  2023-01-15 21:07 ` [PATCH 3/4] staging: r8188eu: convert phy_BB8188E_Config_ParaFile() " Michael Straube
@ 2023-01-15 21:07 ` Michael Straube
  2023-01-16 19:33 ` [PATCH 0/4] staging: r8188eu: some error logic cleanups Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Straube @ 2023-01-15 21:07 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube

Convert the function PHY_BBConfig8188E() away from returning _FAIL or
_SUCCESS which uses inverted error logic. Use the common error logic
instead. Return 0 for success and negative values for failure.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 14 ++++++--------
 drivers/staging/r8188eu/hal/usb_halinit.c     |  5 ++---
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
index c52af93f1669..f4edf4a8f5c2 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
@@ -478,18 +478,17 @@ PHY_BBConfig8188E(
 		struct adapter *Adapter
 	)
 {
-	int	rtStatus = _SUCCESS;
 	struct hal_data_8188e *pHalData = &Adapter->haldata;
 	u16 RegVal;
 	u8 CrystalCap;
-	int res;
+	int err;
 
 	phy_InitBBRFRegisterDefinition(Adapter);
 
 	/*  Enable BB and RF */
-	res = rtw_read16(Adapter, REG_SYS_FUNC_EN, &RegVal);
-	if (res)
-		return _FAIL;
+	err = rtw_read16(Adapter, REG_SYS_FUNC_EN, &RegVal);
+	if (err)
+		return err;
 
 	rtw_write16(Adapter, REG_SYS_FUNC_EN, (u16)(RegVal | BIT(13) | BIT(0) | BIT(1)));
 
@@ -500,14 +499,13 @@ PHY_BBConfig8188E(
 	rtw_write8(Adapter, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | FEN_BB_GLB_RSTn | FEN_BBRSTB);
 
 	/*  Config BB and AGC */
-	if (phy_BB8188E_Config_ParaFile(Adapter))
-		rtStatus = _FAIL;
+	err = phy_BB8188E_Config_ParaFile(Adapter);
 
 	/*  write 0x24[16:11] = 0x24[22:17] = CrystalCap */
 	CrystalCap = pHalData->CrystalCap & 0x3F;
 	rtl8188e_PHY_SetBBReg(Adapter, REG_AFE_XTAL_CTRL, 0x7ff800, (CrystalCap | (CrystalCap << 6)));
 
-	return rtStatus;
+	return err;
 }
 
 static void getTxPowerIndex88E(struct adapter *Adapter, u8 channel, u8 *cckPowerLevel,
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index cb36b42c5ecc..b7c9e5fd9a59 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -606,9 +606,8 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter)
 	/*  */
 	/* d. Initialize BB related configurations. */
 	/*  */
-	status = PHY_BBConfig8188E(Adapter);
-	if (status == _FAIL)
-		goto exit;
+	if (PHY_BBConfig8188E(Adapter))
+		return _FAIL;
 
 	if (phy_RF6052_Config_ParaFile(Adapter))
 		return _FAIL;
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] staging: r8188eu: some error logic cleanups
  2023-01-15 21:07 [PATCH 0/4] staging: r8188eu: some error logic cleanups Michael Straube
                   ` (3 preceding siblings ...)
  2023-01-15 21:07 ` [PATCH 4/4] staging: r8188eu: convert PHY_BBConfig8188E() " Michael Straube
@ 2023-01-16 19:33 ` Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2023-01-16 19:33 UTC (permalink / raw)
  To: Michael Straube, gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel

On 1/15/23 22:07, Michael Straube wrote:
> This series converts some more functions away from returning _SUCCESS
> and _FAIL.
> 
> Tested on x86_64 with Inter-Tech DMG-02.
> 
> Michael Straube (4):
>    staging: r8188eu: convert PHY_MACConfig8188E() to common error logic
>    staging: r8188eu: convert phy_RF6052_Config_ParaFile() to common error
>      logic
>    staging: r8188eu: convert phy_BB8188E_Config_ParaFile() to common
>      error logic
>    staging: r8188eu: convert PHY_BBConfig8188E() to common error logic
> 
>   drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 35 ++++++++++---------
>   drivers/staging/r8188eu/hal/rtl8188e_rf6052.c |  7 ++--
>   drivers/staging/r8188eu/hal/usb_halinit.c     | 15 ++++----
>   3 files changed, 27 insertions(+), 30 deletions(-)
> 

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-16 19:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-15 21:07 [PATCH 0/4] staging: r8188eu: some error logic cleanups Michael Straube
2023-01-15 21:07 ` [PATCH 1/4] staging: r8188eu: convert PHY_MACConfig8188E() to common error logic Michael Straube
2023-01-15 21:07 ` [PATCH 2/4] staging: r8188eu: convert phy_RF6052_Config_ParaFile() " Michael Straube
2023-01-15 21:07 ` [PATCH 3/4] staging: r8188eu: convert phy_BB8188E_Config_ParaFile() " Michael Straube
2023-01-15 21:07 ` [PATCH 4/4] staging: r8188eu: convert PHY_BBConfig8188E() " Michael Straube
2023-01-16 19:33 ` [PATCH 0/4] staging: r8188eu: some error logic cleanups Philipp Hortmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.