linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver
@ 2023-03-25  8:34 Philipp Hortmann
  2023-03-25  8:35 ` [PATCH 01/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_read Philipp Hortmann
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Keep code that
is executed under condition (priv->rf_chip == RF_8256) and remove dead
code including unused variables.

Tested with rtl8192e
Transferred this patch over wlan connection of rtl8192e

Philipp Hortmann (11):
  staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_read
  staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_write
  staging: rtl8192e: Remove priv->rf_chip in rtl92e_set_tx_power
  staging: rtl8192e: Remove priv->rf_chip in rtl92e_config_phy
  staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_tx_power_level
  staging: rtl8192e: Remove priv->rf_chip in
    _rtl92e_phy_switch_channel_step
  staging: rtl8192e: Remove priv->rf_chip in
    _rtl92e_set_bw_mode_work_item
  staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_rf_power_state
  staging: rtl8192e: Remove rf_chip in
    _rtl92e_get_supported_wireless_mode
  staging: rtl8192e: Remove priv->rf_chip in _rtl92e_get_channel_map
  staging: rtl8192e: Remove priv->rf_chip

 .../staging/rtl8192e/rtl8192e/r8192E_dev.c    |   2 -
 .../staging/rtl8192e/rtl8192e/r8192E_phy.c    | 431 ++++++------------
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c  |  23 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h  |  10 -
 4 files changed, 138 insertions(+), 328 deletions(-)

-- 
2.39.2


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

* [PATCH 01/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_read
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
@ 2023-03-25  8:35 ` Philipp Hortmann
  2023-03-25  8:35 ` [PATCH 02/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_write Philipp Hortmann
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Remove
conditions in function _rtl92e_phy_rf_read as those are dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 .../staging/rtl8192e/rtl8192e/r8192E_phy.c    | 43 ++++++++-----------
 1 file changed, 18 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 2dbddf4ae3d6..c4fd412cf3d6 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -82,24 +82,20 @@ static u32 _rtl92e_phy_rf_read(struct net_device *dev,
 
 	Offset &= 0x3f;
 
-	if (priv->rf_chip == RF_8256) {
-		rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0);
-		if (Offset >= 31) {
-			priv->rf_reg_0value[eRFPath] |= 0x140;
-			rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset,
-					  bMaskDWord,
-					  (priv->rf_reg_0value[eRFPath] << 16));
-			NewOffset = Offset - 30;
-		} else if (Offset >= 16) {
-			priv->rf_reg_0value[eRFPath] |= 0x100;
-			priv->rf_reg_0value[eRFPath] &= (~0x40);
-			rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset,
-					  bMaskDWord,
-					  (priv->rf_reg_0value[eRFPath] << 16));
-
-			NewOffset = Offset - 15;
-		} else
-			NewOffset = Offset;
+	rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0);
+	if (Offset >= 31) {
+		priv->rf_reg_0value[eRFPath] |= 0x140;
+		rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset,
+				  bMaskDWord,
+				  (priv->rf_reg_0value[eRFPath] << 16));
+		NewOffset = Offset - 30;
+	} else if (Offset >= 16) {
+		priv->rf_reg_0value[eRFPath] |= 0x100;
+		priv->rf_reg_0value[eRFPath] &= (~0x40);
+		rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset,
+				  bMaskDWord,
+				  (priv->rf_reg_0value[eRFPath] << 16));
+		NewOffset = Offset - 15;
 	} else {
 		NewOffset = Offset;
 	}
@@ -113,15 +109,12 @@ static u32 _rtl92e_phy_rf_read(struct net_device *dev,
 	ret = rtl92e_get_bb_reg(dev, pPhyReg->rfLSSIReadBack,
 				bLSSIReadBackData);
 
-	if (priv->rf_chip == RF_8256) {
-		priv->rf_reg_0value[eRFPath] &= 0xebf;
-
-		rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, bMaskDWord,
-				  (priv->rf_reg_0value[eRFPath] << 16));
+	priv->rf_reg_0value[eRFPath] &= 0xebf;
 
-		rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3);
-	}
+	rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, bMaskDWord,
+			  (priv->rf_reg_0value[eRFPath] << 16));
 
+	rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3);
 
 	return ret;
 
-- 
2.39.2


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

* [PATCH 02/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_write
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
  2023-03-25  8:35 ` [PATCH 01/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_read Philipp Hortmann
@ 2023-03-25  8:35 ` Philipp Hortmann
  2023-03-25  8:35 ` [PATCH 03/11] staging: rtl8192e: Remove priv->rf_chip in rtl92e_set_tx_power Philipp Hortmann
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Remove
conditions in function _rtl92e_phy_rf_write as those are dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 .../staging/rtl8192e/rtl8192e/r8192E_phy.c    | 46 +++++++++----------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index c4fd412cf3d6..acd1e1869d78 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -129,24 +129,22 @@ static void _rtl92e_phy_rf_write(struct net_device *dev,
 	struct bb_reg_definition *pPhyReg = &priv->phy_reg_def[eRFPath];
 
 	Offset &= 0x3f;
-	if (priv->rf_chip == RF_8256) {
-		rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0);
 
-		if (Offset >= 31) {
-			priv->rf_reg_0value[eRFPath] |= 0x140;
-			rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset,
-					  bMaskDWord,
-					  (priv->rf_reg_0value[eRFPath] << 16));
-			NewOffset = Offset - 30;
-		} else if (Offset >= 16) {
-			priv->rf_reg_0value[eRFPath] |= 0x100;
-			priv->rf_reg_0value[eRFPath] &= (~0x40);
-			rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset,
-					  bMaskDWord,
-					  (priv->rf_reg_0value[eRFPath] << 16));
-			NewOffset = Offset - 15;
-		} else
-			NewOffset = Offset;
+	rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0);
+
+	if (Offset >= 31) {
+		priv->rf_reg_0value[eRFPath] |= 0x140;
+		rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset,
+				  bMaskDWord,
+				  (priv->rf_reg_0value[eRFPath] << 16));
+		NewOffset = Offset - 30;
+	} else if (Offset >= 16) {
+		priv->rf_reg_0value[eRFPath] |= 0x100;
+		priv->rf_reg_0value[eRFPath] &= (~0x40);
+		rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset,
+				  bMaskDWord,
+				  (priv->rf_reg_0value[eRFPath] << 16));
+		NewOffset = Offset - 15;
 	} else {
 		NewOffset = Offset;
 	}
@@ -158,15 +156,13 @@ static void _rtl92e_phy_rf_write(struct net_device *dev,
 	if (Offset == 0x0)
 		priv->rf_reg_0value[eRFPath] = Data;
 
-	if (priv->rf_chip == RF_8256) {
-		if (Offset != 0) {
-			priv->rf_reg_0value[eRFPath] &= 0xebf;
-			rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset,
-					  bMaskDWord,
-					  (priv->rf_reg_0value[eRFPath] << 16));
-		}
-		rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3);
+	if (Offset != 0) {
+		priv->rf_reg_0value[eRFPath] &= 0xebf;
+		rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset,
+				  bMaskDWord,
+				  (priv->rf_reg_0value[eRFPath] << 16));
 	}
+	rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3);
 }
 
 void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath,
-- 
2.39.2


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

* [PATCH 03/11] staging: rtl8192e: Remove priv->rf_chip in rtl92e_set_tx_power
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
  2023-03-25  8:35 ` [PATCH 01/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_read Philipp Hortmann
  2023-03-25  8:35 ` [PATCH 02/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_write Philipp Hortmann
@ 2023-03-25  8:35 ` Philipp Hortmann
  2023-03-25  8:36 ` [PATCH 04/11] staging: rtl8192e: Remove priv->rf_chip in rtl92e_config_phy Philipp Hortmann
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Remove
condition in function rtl92e_set_tx_power as it is dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index acd1e1869d78..6579c7b81bfd 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -485,19 +485,8 @@ void rtl92e_set_tx_power(struct net_device *dev, u8 channel)
 		powerlevelOFDM24G = priv->tx_pwr_level_ofdm_24g[channel - 1];
 	}
 
-	switch (priv->rf_chip) {
-	case RF_8225:
-		break;
-	case RF_8256:
-		rtl92e_set_cck_tx_power(dev, powerlevel);
-		rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G);
-		break;
-	case RF_8258:
-		break;
-	default:
-		netdev_err(dev, "Invalid RF Chip ID.\n");
-		break;
-	}
+	rtl92e_set_cck_tx_power(dev, powerlevel);
+	rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G);
 }
 
 bool rtl92e_config_phy(struct net_device *dev)
-- 
2.39.2


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

* [PATCH 04/11] staging: rtl8192e: Remove priv->rf_chip in rtl92e_config_phy
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
                   ` (2 preceding siblings ...)
  2023-03-25  8:35 ` [PATCH 03/11] staging: rtl8192e: Remove priv->rf_chip in rtl92e_set_tx_power Philipp Hortmann
@ 2023-03-25  8:36 ` Philipp Hortmann
  2023-03-25  8:36 ` [PATCH 05/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_tx_power_level Philipp Hortmann
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Remove
condition in function rtl92e_config_phy as it is dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 6579c7b81bfd..e35085253e70 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -491,25 +491,10 @@ void rtl92e_set_tx_power(struct net_device *dev, u8 channel)
 
 bool rtl92e_config_phy(struct net_device *dev)
 {
-	struct r8192_priv *priv = rtllib_priv(dev);
 	bool rtStatus = true;
 
-	switch (priv->rf_chip) {
-	case RF_8225:
-		break;
-	case RF_8256:
-		rtStatus = rtl92e_config_rf(dev);
-		break;
-
-	case RF_8258:
-		break;
-	case RF_PSEUDO_11N:
-		break;
+	rtStatus = rtl92e_config_rf(dev);
 
-	default:
-		netdev_err(dev, "Invalid RF Chip ID.\n");
-		break;
-	}
 	return rtStatus;
 }
 
-- 
2.39.2


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

* [PATCH 05/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_tx_power_level
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
                   ` (3 preceding siblings ...)
  2023-03-25  8:36 ` [PATCH 04/11] staging: rtl8192e: Remove priv->rf_chip in rtl92e_config_phy Philipp Hortmann
@ 2023-03-25  8:36 ` Philipp Hortmann
  2023-03-25  8:36 ` [PATCH 06/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_switch_channel_step Philipp Hortmann
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Remove
condition in function _rtl92e_set_tx_power_level as it is dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index e35085253e70..b528b8ab4b2b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -542,21 +542,8 @@ static void _rtl92e_set_tx_power_level(struct net_device *dev, u8 channel)
 	u8	powerlevel = priv->tx_pwr_level_cck[channel - 1];
 	u8	powerlevelOFDM24G = priv->tx_pwr_level_ofdm_24g[channel - 1];
 
-	switch (priv->rf_chip) {
-	case RF_8225:
-		break;
-
-	case RF_8256:
-		rtl92e_set_cck_tx_power(dev, powerlevel);
-		rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G);
-		break;
-
-	case RF_8258:
-		break;
-	default:
-		netdev_warn(dev, "%s(): Invalid RF Chip ID\n", __func__);
-		break;
-	}
+	rtl92e_set_cck_tx_power(dev, powerlevel);
+	rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G);
 }
 
 static u8 _rtl92e_phy_set_sw_chnl_cmd_array(struct net_device *dev,
-- 
2.39.2


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

* [PATCH 06/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_switch_channel_step
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
                   ` (4 preceding siblings ...)
  2023-03-25  8:36 ` [PATCH 05/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_tx_power_level Philipp Hortmann
@ 2023-03-25  8:36 ` Philipp Hortmann
  2023-03-25  8:36 ` [PATCH 07/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_bw_mode_work_item Philipp Hortmann
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Remove
condition in function _rtl92e_phy_switch_channel_step as it is dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 .../staging/rtl8192e/rtl8192e/r8192E_phy.c    | 83 ++++---------------
 1 file changed, 16 insertions(+), 67 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index b528b8ab4b2b..73e426e052b0 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -14,24 +14,6 @@
 
 #include "table.h"
 
-static u32 RF_CHANNEL_TABLE_ZEBRA[] = {
-	0,
-	0x085c,
-	0x08dc,
-	0x095c,
-	0x09dc,
-	0x0a5c,
-	0x0adc,
-	0x0b5c,
-	0x0bdc,
-	0x0c5c,
-	0x0cdc,
-	0x0d5c,
-	0x0ddc,
-	0x0e5c,
-	0x0f72,
-};
-
 /*************************Define local function prototype**********************/
 
 static u32 _rtl92e_phy_rf_fw_read(struct net_device *dev,
@@ -608,58 +590,25 @@ static u8 _rtl92e_phy_switch_channel_step(struct net_device *dev, u8 channel,
 						  0, 0, 0);
 
 		RfDependCmdCnt = 0;
-		switch (priv->rf_chip) {
-		case RF_8225:
-			if (!(channel >= 1 && channel <= 14)) {
-				netdev_err(dev,
-					   "Invalid channel requested for 8225: %d\n",
-					   channel);
-				return false;
-			}
-			_rtl92e_phy_set_sw_chnl_cmd_array(dev,
-							  ieee->RfDependCmd,
-							  RfDependCmdCnt++,
-							  MAX_RFDEPENDCMD_CNT,
-							  CmdID_RF_WriteReg,
-							  rZebra1_Channel,
-							  RF_CHANNEL_TABLE_ZEBRA[channel],
-							  10);
-			_rtl92e_phy_set_sw_chnl_cmd_array(dev,
-							  ieee->RfDependCmd,
-							  RfDependCmdCnt++,
-							  MAX_RFDEPENDCMD_CNT,
-							  CmdID_End, 0, 0, 0);
-			break;
-
-		case RF_8256:
-			if (!(channel >= 1 && channel <= 14)) {
-				netdev_err(dev,
-					   "Invalid channel requested for 8256: %d\n",
-					   channel);
-				return false;
-			}
-			_rtl92e_phy_set_sw_chnl_cmd_array(dev,
-							  ieee->RfDependCmd,
-							  RfDependCmdCnt++,
-							  MAX_RFDEPENDCMD_CNT,
-							  CmdID_RF_WriteReg,
-							  rZebra1_Channel,
-							  channel, 10);
-			_rtl92e_phy_set_sw_chnl_cmd_array(dev,
-							  ieee->RfDependCmd,
-							  RfDependCmdCnt++,
-							  MAX_RFDEPENDCMD_CNT,
-							  CmdID_End, 0, 0, 0);
-			break;
-
-		case RF_8258:
-			break;
 
-		default:
-			netdev_warn(dev, "Unknown RF Chip ID\n");
+		if (!(channel >= 1 && channel <= 14)) {
+			netdev_err(dev,
+				   "Invalid channel requested for 8256: %d\n",
+				   channel);
 			return false;
 		}
-
+		_rtl92e_phy_set_sw_chnl_cmd_array(dev,
+						  ieee->RfDependCmd,
+						  RfDependCmdCnt++,
+						  MAX_RFDEPENDCMD_CNT,
+						  CmdID_RF_WriteReg,
+						  rZebra1_Channel,
+						  channel, 10);
+		_rtl92e_phy_set_sw_chnl_cmd_array(dev,
+						  ieee->RfDependCmd,
+						  RfDependCmdCnt++,
+						  MAX_RFDEPENDCMD_CNT,
+						  CmdID_End, 0, 0, 0);
 
 		do {
 			switch (*stage) {
-- 
2.39.2


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

* [PATCH 07/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_bw_mode_work_item
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
                   ` (5 preceding siblings ...)
  2023-03-25  8:36 ` [PATCH 06/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_switch_channel_step Philipp Hortmann
@ 2023-03-25  8:36 ` Philipp Hortmann
  2023-03-25  8:36 ` [PATCH 08/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_rf_power_state Philipp Hortmann
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Remove
conditions in function _rtl92e_set_bw_mode_work_item as those are dead
code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 .../staging/rtl8192e/rtl8192e/r8192E_phy.c    | 24 +------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 73e426e052b0..1f0d3654c6a0 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -849,10 +849,6 @@ static void _rtl92e_set_bw_mode_work_item(struct net_device *dev)
 	struct r8192_priv *priv = rtllib_priv(dev);
 	u8 regBwOpMode;
 
-	if (priv->rf_chip == RF_PSEUDO_11N) {
-		priv->set_bw_mode_in_progress = false;
-		return;
-	}
 	if (!priv->up) {
 		netdev_err(dev, "%s(): Driver is not initialized\n", __func__);
 		return;
@@ -918,25 +914,7 @@ static void _rtl92e_set_bw_mode_work_item(struct net_device *dev)
 
 	}
 
-	switch (priv->rf_chip) {
-	case RF_8225:
-		break;
-
-	case RF_8256:
-		rtl92e_set_bandwidth(dev, priv->current_chnl_bw);
-		break;
-
-	case RF_8258:
-		break;
-
-	case RF_PSEUDO_11N:
-		break;
-
-	default:
-		netdev_info(dev, "%s(): Unknown RFChipID: %d\n", __func__,
-			    priv->rf_chip);
-		break;
-	}
+	rtl92e_set_bandwidth(dev, priv->current_chnl_bw);
 
 	atomic_dec(&(priv->rtllib->atm_swbw));
 	priv->set_bw_mode_in_progress = false;
-- 
2.39.2


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

* [PATCH 08/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_rf_power_state
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
                   ` (6 preceding siblings ...)
  2023-03-25  8:36 ` [PATCH 07/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_bw_mode_work_item Philipp Hortmann
@ 2023-03-25  8:36 ` Philipp Hortmann
  2023-03-25  8:36 ` [PATCH 09/11] staging: rtl8192e: Remove rf_chip in _rtl92e_get_supported_wireless_mode Philipp Hortmann
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Remove
conditions in function _rtl92e_set_rf_power_state as those are dead
code. Removed unnecessary blank lines to shorten code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 .../staging/rtl8192e/rtl8192e/r8192E_phy.c    | 186 +++++++-----------
 1 file changed, 76 insertions(+), 110 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 1f0d3654c6a0..b1c297d2ae36 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -1040,129 +1040,95 @@ static bool _rtl92e_set_rf_power_state(struct net_device *dev,
 		return false;
 	priv->set_rf_pwr_state_in_progress = true;
 
-	switch (priv->rf_chip) {
-	case RF_8256:
-		switch (rf_power_state) {
-		case rf_on:
-			if ((priv->rtllib->rf_power_state == rf_off) &&
-			     RT_IN_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC)) {
-				bool rtstatus;
-				u32 InitilizeCount = 3;
-
-				do {
-					InitilizeCount--;
-					rtstatus = rtl92e_enable_nic(dev);
-				} while (!rtstatus && (InitilizeCount > 0));
-
-				if (!rtstatus) {
-					netdev_err(dev,
-						   "%s(): Failed to initialize Adapter.\n",
-						   __func__);
-					priv->set_rf_pwr_state_in_progress = false;
-					return false;
-				}
-
-				RT_CLEAR_PS_LEVEL(psc,
-						  RT_RF_OFF_LEVL_HALT_NIC);
-			} else {
-				rtl92e_writeb(dev, ANAPAR, 0x37);
-				mdelay(1);
-				rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1,
-						 0x4, 0x1);
-				priv->hw_rf_off_action = 0;
-
-				rtl92e_set_bb_reg(dev, rFPGA0_XA_RFInterfaceOE,
-						  BIT4, 0x1);
-				rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4,
-						  0x300, 0x3);
-				rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1,
-						  0x18, 0x3);
-				rtl92e_set_bb_reg(dev, rOFDM0_TRxPathEnable,
-						  0x3, 0x3);
-				rtl92e_set_bb_reg(dev, rOFDM1_TRxPathEnable,
-						  0x3, 0x3);
-				rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1,
-						  0x60, 0x3);
-
+	switch (rf_power_state) {
+	case rf_on:
+		if ((priv->rtllib->rf_power_state == rf_off) &&
+		     RT_IN_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC)) {
+			bool rtstatus;
+			u32 InitilizeCount = 3;
+
+			do {
+				InitilizeCount--;
+				rtstatus = rtl92e_enable_nic(dev);
+			} while (!rtstatus && (InitilizeCount > 0));
+			if (!rtstatus) {
+				netdev_err(dev,
+					   "%s(): Failed to initialize Adapter.\n",
+					   __func__);
+				priv->set_rf_pwr_state_in_progress = false;
+				return false;
 			}
-
+			RT_CLEAR_PS_LEVEL(psc,
+					  RT_RF_OFF_LEVL_HALT_NIC);
+		} else {
+			rtl92e_writeb(dev, ANAPAR, 0x37);
+			mdelay(1);
+			rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1,
+					 0x4, 0x1);
+			priv->hw_rf_off_action = 0;
+			rtl92e_set_bb_reg(dev, rFPGA0_XA_RFInterfaceOE,
+					  BIT4, 0x1);
+			rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4,
+					  0x300, 0x3);
+			rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1,
+					  0x18, 0x3);
+			rtl92e_set_bb_reg(dev, rOFDM0_TRxPathEnable,
+					  0x3, 0x3);
+			rtl92e_set_bb_reg(dev, rOFDM1_TRxPathEnable,
+					  0x3, 0x3);
+			rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1,
+					  0x60, 0x3);
+		}
+		break;
+	case rf_sleep:
+		if (priv->rtllib->rf_power_state == rf_off)
 			break;
-
-		case rf_sleep:
-			if (priv->rtllib->rf_power_state == rf_off)
+		for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) {
+			ring = &priv->tx_ring[QueueID];
+			if (skb_queue_len(&ring->queue) == 0) {
+				QueueID++;
+				continue;
+			} else {
+				udelay(10);
+				i++;
+			}
+			if (i >= MAX_DOZE_WAITING_TIMES_9x)
 				break;
-
-
-			for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) {
-				ring = &priv->tx_ring[QueueID];
-
-				if (skb_queue_len(&ring->queue) == 0) {
-					QueueID++;
-					continue;
-				} else {
-					udelay(10);
-					i++;
-				}
-
-				if (i >= MAX_DOZE_WAITING_TIMES_9x)
-					break;
+		}
+		rtl92e_set_rf_off(dev);
+		break;
+	case rf_off:
+		for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) {
+			ring = &priv->tx_ring[QueueID];
+			if (skb_queue_len(&ring->queue) == 0) {
+				QueueID++;
+				continue;
+			} else {
+				udelay(10);
+				i++;
 			}
+			if (i >= MAX_DOZE_WAITING_TIMES_9x)
+				break;
+		}
+		if (psc->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC &&
+		    !RT_IN_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC)) {
+			rtl92e_disable_nic(dev);
+			RT_SET_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC);
+		} else if (!(psc->RegRfPsLevel &
+			   RT_RF_OFF_LEVL_HALT_NIC)) {
 			rtl92e_set_rf_off(dev);
-			break;
-
-		case rf_off:
-			for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) {
-				ring = &priv->tx_ring[QueueID];
-
-				if (skb_queue_len(&ring->queue) == 0) {
-					QueueID++;
-					continue;
-				} else {
-					udelay(10);
-					i++;
-				}
-
-				if (i >= MAX_DOZE_WAITING_TIMES_9x)
-					break;
-			}
-
-			if (psc->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC &&
-			    !RT_IN_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC)) {
-				rtl92e_disable_nic(dev);
-				RT_SET_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC);
-			} else if (!(psc->RegRfPsLevel &
-				   RT_RF_OFF_LEVL_HALT_NIC)) {
-				rtl92e_set_rf_off(dev);
-			}
-
-			break;
-
-		default:
-			bResult = false;
-			netdev_warn(dev,
-				    "%s(): Unknown state requested: 0x%X.\n",
-				    __func__, rf_power_state);
-			break;
 		}
-
 		break;
-
 	default:
-		netdev_warn(dev, "%s(): Unknown RF type\n", __func__);
+		bResult = false;
+		netdev_warn(dev,
+			    "%s(): Unknown state requested: 0x%X.\n",
+			    __func__, rf_power_state);
 		break;
 	}
 
 	if (bResult) {
 		priv->rtllib->rf_power_state = rf_power_state;
-
-		switch (priv->rf_chip) {
-		case RF_8256:
-			break;
-
-		default:
-			netdev_warn(dev, "%s(): Unknown RF type\n", __func__);
-			break;
-		}
 	}
 
 	priv->set_rf_pwr_state_in_progress = false;
-- 
2.39.2


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

* [PATCH 09/11] staging: rtl8192e: Remove rf_chip in _rtl92e_get_supported_wireless_mode
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
                   ` (7 preceding siblings ...)
  2023-03-25  8:36 ` [PATCH 08/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_rf_power_state Philipp Hortmann
@ 2023-03-25  8:36 ` Philipp Hortmann
  2023-03-25  8:37 ` [PATCH 10/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_get_channel_map Philipp Hortmann
  2023-03-25  8:37 ` [PATCH 11/11] staging: rtl8192e: Remove priv->rf_chip Philipp Hortmann
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Remove
condition in function _rtl92e_get_supported_wireless_mode as it is dead
code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 3244aef12c05..8e4e939d7617 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -595,23 +595,9 @@ static void _rtl92e_refresh_support_rate(struct r8192_priv *priv)
 
 static u8 _rtl92e_get_supported_wireless_mode(struct net_device *dev)
 {
-	struct r8192_priv *priv = rtllib_priv(dev);
 	u8 ret = 0;
 
-	switch (priv->rf_chip) {
-	case RF_8225:
-	case RF_8256:
-	case RF_6052:
-	case RF_PSEUDO_11N:
-		ret = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B);
-		break;
-	case RF_8258:
-		ret = (WIRELESS_MODE_A | WIRELESS_MODE_N_5G);
-		break;
-	default:
-		ret = WIRELESS_MODE_B;
-		break;
-	}
+	ret = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B);
 	return ret;
 }
 
-- 
2.39.2


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

* [PATCH 10/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_get_channel_map
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
                   ` (8 preceding siblings ...)
  2023-03-25  8:36 ` [PATCH 09/11] staging: rtl8192e: Remove rf_chip in _rtl92e_get_supported_wireless_mode Philipp Hortmann
@ 2023-03-25  8:37 ` Philipp Hortmann
  2023-03-25  8:37 ` [PATCH 11/11] staging: rtl8192e: Remove priv->rf_chip Philipp Hortmann
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and never changed. Remove
condition in function _rtl92e_get_channel_map as it is dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 8e4e939d7617..ecc3f0c6c267 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -895,13 +895,6 @@ static short _rtl92e_get_channel_map(struct net_device *dev)
 
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256) &&
-						(priv->rf_chip != RF_6052)) {
-		netdev_err(dev, "%s: unknown rf chip, can't set channel map\n",
-			   __func__);
-		return -1;
-	}
-
 	if (priv->chnl_plan >= COUNTRY_CODE_MAX) {
 		netdev_info(dev,
 			    "rtl819x_init:Error channel plan! Set to default.\n");
-- 
2.39.2


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

* [PATCH 11/11] staging: rtl8192e: Remove priv->rf_chip
  2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
                   ` (9 preceding siblings ...)
  2023-03-25  8:37 ` [PATCH 10/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_get_channel_map Philipp Hortmann
@ 2023-03-25  8:37 ` Philipp Hortmann
  10 siblings, 0 replies; 12+ messages in thread
From: Philipp Hortmann @ 2023-03-25  8:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

priv->rf_chip is initialized to RF_8256 and not used. Remove
initialization, variable and enum as it is dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c |  2 --
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h   | 10 ----------
 2 files changed, 12 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 1e7be321721b..a67927f0c5e3 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -432,8 +432,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)
 
 	rtl92e_init_adaptive_rate(dev);
 
-	priv->rf_chip = RF_8256;
-
 	if (priv->reg_chnl_plan == 0xf)
 		priv->chnl_plan = priv->eeprom_chnl_plan;
 	else
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
index c8816c44ca51..68ec0aeb2dd9 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
@@ -129,15 +129,6 @@ enum dcmg_txcmd_op {
 	TXCMD_XXXX_CTRL,
 };
 
-enum rt_rf_type_819xu {
-	RF_TYPE_MIN = 0,
-	RF_8225,
-	RF_8256,
-	RF_8258,
-	RF_6052 = 4,
-	RF_PSEUDO_11N = 5,
-};
-
 enum rt_customer_id {
 	RT_CID_DEFAULT	  = 0,
 	RT_CID_819x_CAMEO       = 6,
@@ -221,7 +212,6 @@ struct r8192_priv {
 
 	enum rt_customer_id customer_id;
 
-	enum rt_rf_type_819xu rf_chip;
 	enum ht_channel_width current_chnl_bw;
 	struct bb_reg_definition phy_reg_def[4];
 	struct rate_adaptive rate_adaptive;
-- 
2.39.2


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

end of thread, other threads:[~2023-03-25  8:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-25  8:34 [PATCH 00/11] staging: rtl8192e: Remove variable priv->rf_chip from driver Philipp Hortmann
2023-03-25  8:35 ` [PATCH 01/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_read Philipp Hortmann
2023-03-25  8:35 ` [PATCH 02/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_write Philipp Hortmann
2023-03-25  8:35 ` [PATCH 03/11] staging: rtl8192e: Remove priv->rf_chip in rtl92e_set_tx_power Philipp Hortmann
2023-03-25  8:36 ` [PATCH 04/11] staging: rtl8192e: Remove priv->rf_chip in rtl92e_config_phy Philipp Hortmann
2023-03-25  8:36 ` [PATCH 05/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_tx_power_level Philipp Hortmann
2023-03-25  8:36 ` [PATCH 06/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_switch_channel_step Philipp Hortmann
2023-03-25  8:36 ` [PATCH 07/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_bw_mode_work_item Philipp Hortmann
2023-03-25  8:36 ` [PATCH 08/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_rf_power_state Philipp Hortmann
2023-03-25  8:36 ` [PATCH 09/11] staging: rtl8192e: Remove rf_chip in _rtl92e_get_supported_wireless_mode Philipp Hortmann
2023-03-25  8:37 ` [PATCH 10/11] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_get_channel_map Philipp Hortmann
2023-03-25  8:37 ` [PATCH 11/11] staging: rtl8192e: Remove priv->rf_chip Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).