All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] staging: r8188eu: power management cleanup
@ 2021-09-11 14:15 Martin Kaiser
  2021-09-11 14:15 ` [PATCH 01/12] staging: r8188eu: btcoex_rfon is always false Martin Kaiser
                   ` (13 more replies)
  0 siblings, 14 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove some unused parts of the power management code.

Tested with Edimax EW-7811Un V2 on an ARM32 embedded system.

Martin Kaiser (12):
  staging: r8188eu: btcoex_rfon is always false
  staging: r8188eu: setting HW_VAR_SET_RPWM does nothing
  staging: r8188eu: remove write-only variable cpwm
  staging: r8188eu: remove write-only variable tog
  staging: r8188eu: remove rtw_set_rpwm
  staging: r8188eu: remove unused power state defines
  staging: r8188eu: _free_pwrlock is empty
  staging: r8188eu: remove unused pwrctrl definitions
  staging: r8188eu: remove unused enum and array
  staging: r8188eu: rtw_set_ips_deny is not used
  staging: r8188eu: remove unused variable cpwm_tog
  staging: r8188eu: remove unused variable b_hw_radio_off

 .../realtek/rtl8192cu/include/rtw_pwrctrl.h   |   1 -
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    |  69 ------------
 drivers/staging/r8188eu/hal/usb_halinit.c     |   2 -
 drivers/staging/r8188eu/include/hal_intf.h    |   1 -
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 102 ------------------
 drivers/staging/r8188eu/os_dep/os_intfs.c     |   2 -
 6 files changed, 177 deletions(-)

-- 
2.20.1


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

* [PATCH 01/12] staging: r8188eu: btcoex_rfon is always false
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 14:15 ` [PATCH 02/12] staging: r8188eu: setting HW_VAR_SET_RPWM does nothing Martin Kaiser
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

btcoex_rfon is always false in this driver. Remove the variable and code
that will never be executed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 7 -------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 2 files changed, 8 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 353b7bd850d9..f9ee917895c7 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -200,11 +200,6 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
 
 	pslv = PS_STATE(pslv);
 
-	if (pwrpriv->btcoex_rfon) {
-		if (pslv < PS_STATE_S4)
-			pslv = PS_STATE_S3;
-	}
-
 	if (pwrpriv->rpwm == pslv)
 		return;
 
@@ -441,8 +436,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 
 	pwrctrlpriv->tog = 0x80;
 
-	pwrctrlpriv->btcoex_rfon = false;
-
 	timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0);
 }
 
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 8446dfb50f34..6a0efb010d06 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -188,7 +188,6 @@ struct pwrctrl_priv {
 	u8	power_mgnt;
 	u8	bFwCurrentInPSMode;
 	u32	DelayLPSLastTimeStamp;
-	u8	btcoex_rfon;
 	s32		pnp_current_pwr_state;
 	u8		pnp_bstop_trx;
 
-- 
2.20.1


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

* [PATCH 02/12] staging: r8188eu: setting HW_VAR_SET_RPWM does nothing
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
  2021-09-11 14:15 ` [PATCH 01/12] staging: r8188eu: btcoex_rfon is always false Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 14:15 ` [PATCH 03/12] staging: r8188eu: remove write-only variable cpwm Martin Kaiser
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Setting the HW_VAR_SET_RPWM "hardware variable" is an empty operation.

Remove the call to set HW_VAR_SET_RPWM, the calculation of the value to be
set and the definition of HW_VAR_SET_RPWM itself.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c | 5 -----
 drivers/staging/r8188eu/hal/usb_halinit.c  | 2 --
 drivers/staging/r8188eu/include/hal_intf.h | 1 -
 3 files changed, 8 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index f9ee917895c7..daae91f82e97 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -195,7 +195,6 @@ static void pwr_state_check_handler(struct timer_list *t)
  */
 void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
 {
-	u8	rpwm;
 	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
 
 	pslv = PS_STATE(pslv);
@@ -215,12 +214,8 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
 			return;
 	}
 
-	rpwm = pslv | pwrpriv->tog;
-
 	pwrpriv->rpwm = pslv;
 
-	rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&rpwm));
-
 	pwrpriv->tog += 0x80;
 	pwrpriv->cpwm = pslv;
 
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index c5347c5459d6..62d9e656e1db 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -1742,8 +1742,6 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val)
 			rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, threshold);
 		}
 		break;
-	case HW_VAR_SET_RPWM:
-		break;
 	case HW_VAR_H2C_FW_PWRMODE:
 		{
 			u8 psmode = (*(u8 *)val);
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index c1e120593574..192d79604d12 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -63,7 +63,6 @@ enum hw_variables {
 	HW_VAR_AMPDU_MIN_SPACE,
 	HW_VAR_AMPDU_FACTOR,
 	HW_VAR_RXDMA_AGG_PG_TH,
-	HW_VAR_SET_RPWM,
 	HW_VAR_H2C_FW_PWRMODE,
 	HW_VAR_H2C_FW_JOINBSSRPT,
 	HW_VAR_FWLPS_RF_ON,
-- 
2.20.1


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

* [PATCH 03/12] staging: r8188eu: remove write-only variable cpwm
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
  2021-09-11 14:15 ` [PATCH 01/12] staging: r8188eu: btcoex_rfon is always false Martin Kaiser
  2021-09-11 14:15 ` [PATCH 02/12] staging: r8188eu: setting HW_VAR_SET_RPWM does nothing Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 14:15 ` [PATCH 04/12] staging: r8188eu: remove write-only variable tog Martin Kaiser
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

cpwm in struct pwrctrl_priv is never read. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 5 -----
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 2 --
 2 files changed, 7 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index daae91f82e97..2a0ee3aac700 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -204,8 +204,6 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
 
 	if ((padapter->bSurpriseRemoved) ||
 	    (!padapter->hw_init_completed)) {
-		pwrpriv->cpwm = PS_STATE_S4;
-
 		return;
 	}
 
@@ -217,8 +215,6 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
 	pwrpriv->rpwm = pslv;
 
 	pwrpriv->tog += 0x80;
-	pwrpriv->cpwm = pslv;
-
 }
 
 static u8 PS_RDY_CHECK(struct adapter *padapter)
@@ -423,7 +419,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 	pwrctrlpriv->bFwCurrentInPSMode = false;
 
 	pwrctrlpriv->rpwm = 0;
-	pwrctrlpriv->cpwm = PS_STATE_S4;
 
 	pwrctrlpriv->pwr_mode = PS_MODE_ACTIVE;
 	pwrctrlpriv->smart_ps = padapter->registrypriv.smart_ps;
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 6a0efb010d06..c5804a48072b 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -152,8 +152,6 @@ enum { /*  for ips_mode */
 struct pwrctrl_priv {
 	struct semaphore lock;
 	volatile u8 rpwm; /*  requested power state for fw */
-	volatile u8 cpwm; /*  fw current power state. updated when
-			   * 1. read from HCPWM 2. driver lowers power level */
 	volatile u8 tog; /*  toggling */
 	volatile u8 cpwm_tog; /*  toggling */
 
-- 
2.20.1


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

* [PATCH 04/12] staging: r8188eu: remove write-only variable tog
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (2 preceding siblings ...)
  2021-09-11 14:15 ` [PATCH 03/12] staging: r8188eu: remove write-only variable cpwm Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 14:15 ` [PATCH 05/12] staging: r8188eu: remove rtw_set_rpwm Martin Kaiser
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

tog in struct pwrctrl_priv is never read. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 4 ----
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 2 files changed, 5 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 2a0ee3aac700..86841093caa8 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -213,8 +213,6 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
 	}
 
 	pwrpriv->rpwm = pslv;
-
-	pwrpriv->tog += 0x80;
 }
 
 static u8 PS_RDY_CHECK(struct adapter *padapter)
@@ -424,8 +422,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 	pwrctrlpriv->smart_ps = padapter->registrypriv.smart_ps;
 	pwrctrlpriv->bcn_ant_mode = 0;
 
-	pwrctrlpriv->tog = 0x80;
-
 	timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0);
 }
 
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index c5804a48072b..5be67644ba5f 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -152,7 +152,6 @@ enum { /*  for ips_mode */
 struct pwrctrl_priv {
 	struct semaphore lock;
 	volatile u8 rpwm; /*  requested power state for fw */
-	volatile u8 tog; /*  toggling */
 	volatile u8 cpwm_tog; /*  toggling */
 
 	u8	pwr_mode;
-- 
2.20.1


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

* [PATCH 05/12] staging: r8188eu: remove rtw_set_rpwm
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (3 preceding siblings ...)
  2021-09-11 14:15 ` [PATCH 04/12] staging: r8188eu: remove write-only variable tog Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 18:33   ` Michael Straube
  2021-09-11 14:15 ` [PATCH 06/12] staging: r8188eu: remove unused power state defines Martin Kaiser
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

After we dropped the call to set HW_VAR_SET_RPWM, the rtw_set_rpwm
function doesn't do anything useful.

Remove the function and the rpwm component of struct pwrctrl_priv,
which is not used outside of rtw_set_rpwm.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 .../realtek/rtl8192cu/include/rtw_pwrctrl.h   |  1 -
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 34 -------------------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h |  2 --
 3 files changed, 37 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h b/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h
index a4cb292e1aea..303df55c521a 100644
--- a/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h
+++ b/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h
@@ -309,7 +309,6 @@ extern void cpwm_int_hdl(PADAPTER padapter, struct reportpwrstate_parm *preportp
 #endif
 
 extern void rtw_set_ps_mode(_adapter * padapter, u8 ps_mode, u8 smart_ps);
-extern void rtw_set_rpwm(_adapter * padapter, u8 val8);
 extern void LeaveAllPowerSaveMode(PADAPTER Adapter);
 #ifdef CONFIG_IPS
 void _ips_enter(_adapter * padapter);
diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 86841093caa8..5b4cd8e738db 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -186,35 +186,6 @@ static void pwr_state_check_handler(struct timer_list *t)
 	rtw_ps_cmd(padapter);
 }
 
-/*
- *
- * Parameters
- *	padapter
- *	pslv			power state level, only could be PS_STATE_S0 ~ PS_STATE_S4
- *
- */
-void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
-{
-	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
-
-	pslv = PS_STATE(pslv);
-
-	if (pwrpriv->rpwm == pslv)
-		return;
-
-	if ((padapter->bSurpriseRemoved) ||
-	    (!padapter->hw_init_completed)) {
-		return;
-	}
-
-	if (padapter->bDriverStopped) {
-		if (pslv < PS_STATE_S2)
-			return;
-	}
-
-	pwrpriv->rpwm = pslv;
-}
-
 static u8 PS_RDY_CHECK(struct adapter *padapter)
 {
 	u32 curr_time, delta_time;
@@ -264,7 +235,6 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
 		if (pwdinfo->opp_ps == 0) {
 			DBG_88E("rtw_set_ps_mode: Leave 802.11 power save\n");
 			pwrpriv->pwr_mode = ps_mode;
-			rtw_set_rpwm(padapter, PS_STATE_S4);
 			rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode));
 			pwrpriv->bFwCurrentInPSMode = false;
 		}
@@ -280,8 +250,6 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
 			/*  Set CTWindow after LPS */
 			if (pwdinfo->opp_ps == 1)
 				p2p_ps_wk_cmd(padapter, P2P_PS_ENABLE, 0);
-
-			rtw_set_rpwm(padapter, PS_STATE_S2);
 		}
 	}
 
@@ -416,8 +384,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 
 	pwrctrlpriv->bFwCurrentInPSMode = false;
 
-	pwrctrlpriv->rpwm = 0;
-
 	pwrctrlpriv->pwr_mode = PS_MODE_ACTIVE;
 	pwrctrlpriv->smart_ps = padapter->registrypriv.smart_ps;
 	pwrctrlpriv->bcn_ant_mode = 0;
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 5be67644ba5f..08d821575755 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -151,7 +151,6 @@ enum { /*  for ips_mode */
 
 struct pwrctrl_priv {
 	struct semaphore lock;
-	volatile u8 rpwm; /*  requested power state for fw */
 	volatile u8 cpwm_tog; /*  toggling */
 
 	u8	pwr_mode;
@@ -234,7 +233,6 @@ void rtw_free_pwrctrl_priv(struct adapter *adapter);
 
 void rtw_set_ps_mode(struct adapter *adapter, u8 ps_mode, u8 smart_ps,
 		     u8 bcn_ant_mode);
-void rtw_set_rpwm(struct adapter *adapter, u8 val8);
 void LeaveAllPowerSaveMode(struct adapter *adapter);
 void ips_enter(struct adapter *padapter);
 int ips_leave(struct adapter *padapter);
-- 
2.20.1


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

* [PATCH 06/12] staging: r8188eu: remove unused power state defines
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (4 preceding siblings ...)
  2021-09-11 14:15 ` [PATCH 05/12] staging: r8188eu: remove rtw_set_rpwm Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 14:15 ` [PATCH 07/12] staging: r8188eu: _free_pwrlock is empty Martin Kaiser
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove some unused defines and macros related to power states.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 36 -------------------
 1 file changed, 36 deletions(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 08d821575755..bd05d1dfe77e 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -39,42 +39,6 @@ enum power_mgnt {
 	PS_MODE_NUM
 };
 
-/*
-	BIT[2:0] = HW state
-	BIT[3] = Protocol PS state,   0: register active state,
-				      1: register sleep state
-	BIT[4] = sub-state
-*/
-
-#define PS_DPS			BIT(0)
-#define PS_LCLK			(PS_DPS)
-#define PS_RF_OFF		BIT(1)
-#define PS_ALL_ON		BIT(2)
-#define PS_ST_ACTIVE		BIT(3)
-
-#define PS_ISR_ENABLE		BIT(4)
-#define PS_IMR_ENABLE		BIT(5)
-#define PS_ACK			BIT(6)
-#define PS_TOGGLE		BIT(7)
-
-#define PS_STATE_MASK		(0x0F)
-#define PS_STATE_HW_MASK	(0x07)
-#define PS_SEQ_MASK		(0xc0)
-
-#define PS_STATE(x)		(PS_STATE_MASK & (x))
-#define PS_STATE_HW(x)		(PS_STATE_HW_MASK & (x))
-#define PS_SEQ(x)		(PS_SEQ_MASK & (x))
-
-#define PS_STATE_S0		(PS_DPS)
-#define PS_STATE_S1		(PS_LCLK)
-#define PS_STATE_S2		(PS_RF_OFF)
-#define PS_STATE_S3		(PS_ALL_ON)
-#define PS_STATE_S4		((PS_ST_ACTIVE) | (PS_ALL_ON))
-
-#define PS_IS_RF_ON(x)	((x) & (PS_ALL_ON))
-#define PS_IS_ACTIVE(x)	((x) & (PS_ST_ACTIVE))
-#define CLR_PS_STATE(x)	((x) = ((x) & (0xF0)))
-
 struct reportpwrstate_parm {
 	unsigned char mode;
 	unsigned char state; /* the CPWM value */
-- 
2.20.1


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

* [PATCH 07/12] staging: r8188eu: _free_pwrlock is empty
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (5 preceding siblings ...)
  2021-09-11 14:15 ` [PATCH 06/12] staging: r8188eu: remove unused power state defines Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 14:15 ` [PATCH 08/12] staging: r8188eu: remove unused pwrctrl definitions Martin Kaiser
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove the empty _free_pwrlock function and rtw_free_pwrctrl_priv,
which is just a wrapper around _free_pwrlock.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 8 --------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 4 ----
 drivers/staging/r8188eu/os_dep/os_intfs.c     | 2 --
 3 files changed, 14 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 5b4cd8e738db..0c4ca90a534f 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -391,14 +391,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 	timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0);
 }
 
-void rtw_free_pwrctrl_priv(struct adapter *adapter)
-{
-	struct pwrctrl_priv *pwrctrlpriv = &adapter->pwrctrlpriv;
-
-	_free_pwrlock(&pwrctrlpriv->lock);
-
-}
-
 inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms)
 {
 	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index bd05d1dfe77e..d89a11062fea 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -50,10 +50,6 @@ static inline void _init_pwrlock(struct semaphore  *plock)
 	sema_init(plock, 1);
 }
 
-static inline void _free_pwrlock(struct semaphore  *plock)
-{
-}
-
 static inline void _enter_pwrlock(struct semaphore  *plock)
 {
 	_rtw_down_sema(plock);
diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index 306377fe8bfc..3367c7cfc033 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -933,8 +933,6 @@ u8 rtw_free_drv_sw(struct adapter *padapter)
 
 	_rtw_free_recv_priv(&padapter->recvpriv);
 
-	rtw_free_pwrctrl_priv(padapter);
-
 	rtl8188e_free_hal_data(padapter);
 
 	/* free the old_pnetdev */
-- 
2.20.1


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

* [PATCH 08/12] staging: r8188eu: remove unused pwrctrl definitions
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (6 preceding siblings ...)
  2021-09-11 14:15 ` [PATCH 07/12] staging: r8188eu: _free_pwrlock is empty Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 14:15 ` [PATCH 09/12] staging: r8188eu: remove unused enum and array Martin Kaiser
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove a bunch of unused defines and macros and an unused struct
from rtw_pwrctrl.h.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 44 -------------------
 1 file changed, 44 deletions(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index d89a11062fea..97102c1ec553 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -7,18 +7,6 @@
 #include "osdep_service.h"
 #include "drv_types.h"
 
-#define FW_PWR0		0
-#define FW_PWR1		1
-#define FW_PWR2		2
-#define FW_PWR3		3
-#define HW_PWR0		7
-#define HW_PWR1		6
-#define HW_PWR2		2
-#define HW_PWR3		0
-#define HW_PWR4		8
-
-#define FW_PWRMSK	0x7
-
 #define XMIT_ALIVE	BIT(0)
 #define RECV_ALIVE	BIT(1)
 #define CMD_ALIVE	BIT(2)
@@ -39,12 +27,6 @@ enum power_mgnt {
 	PS_MODE_NUM
 };
 
-struct reportpwrstate_parm {
-	unsigned char mode;
-	unsigned char state; /* the CPWM value */
-	unsigned short rsvd;
-};
-
 static inline void _init_pwrlock(struct semaphore  *plock)
 {
 	sema_init(plock, 1);
@@ -62,10 +44,6 @@ static inline void _exit_pwrlock(struct semaphore  *plock)
 
 #define LPS_DELAY_TIME	1*HZ /*  1 sec */
 
-#define EXE_PWR_NONE	0x01
-#define EXE_PWR_IPS		0x02
-#define EXE_PWR_LPS		0x04
-
 /*  RF state. */
 enum rt_rf_power_state {
 	rf_on,		/*  RF is on after RFSleep or RFOff */
@@ -75,26 +53,6 @@ enum rt_rf_power_state {
 	rf_max
 };
 
-/*  RF Off Level for IPS or HW/SW radio off */
-#define	RT_RF_OFF_LEVL_ASPM		BIT(0)	/* PCI ASPM */
-#define	RT_RF_OFF_LEVL_CLK_REQ		BIT(1)	/* PCI clock request */
-#define	RT_RF_OFF_LEVL_PCI_D3		BIT(2)	/* PCI D3 mode */
-#define	RT_RF_OFF_LEVL_HALT_NIC		BIT(3)	/* NIC halt, re-init hw param*/
-#define	RT_RF_OFF_LEVL_FREE_FW		BIT(4)	/* FW free, re-download the FW*/
-#define	RT_RF_OFF_LEVL_FW_32K		BIT(5)	/* FW in 32k */
-#define	RT_RF_PS_LEVEL_ALWAYS_ASPM	BIT(6)	/* Always enable ASPM and Clock
-						 * Req in initialization. */
-#define	RT_RF_LPS_DISALBE_2R		BIT(30)	/* When LPS is on, disable 2R
-						 * if no packet is RX or TX. */
-#define	RT_RF_LPS_LEVEL_ASPM		BIT(31)	/* LPS with ASPM */
-
-#define	RT_IN_PS_LEVEL(ppsc, _PS_FLAG)				\
-	((ppsc->cur_ps_level & _PS_FLAG) ? true : false)
-#define	RT_CLEAR_PS_LEVEL(ppsc, _PS_FLAG)			\
-	(ppsc->cur_ps_level &= (~(_PS_FLAG)))
-#define	RT_SET_PS_LEVEL(ppsc, _PS_FLAG)				\
-	(ppsc->cur_ps_level |= _PS_FLAG)
-
 enum _PS_BBRegBackup_ {
 	PSBBREG_RF0 = 0,
 	PSBBREG_RF1,
@@ -210,8 +168,6 @@ int _rtw_pwr_wakeup(struct adapter *adapter, u32 ips_defer_ms,
 		    const char *caller);
 #define rtw_pwr_wakeup(adapter)						\
 	 _rtw_pwr_wakeup(adapter, RTW_PWR_STATE_CHK_INTERVAL, __func__)
-#define rtw_pwr_wakeup_ex(adapter, ips_deffer_ms)			\
-	 _rtw_pwr_wakeup(adapter, ips_deffer_ms, __func__)
 int rtw_pm_set_ips(struct adapter *adapter, u8 mode);
 int rtw_pm_set_lps(struct adapter *adapter, u8 mode);
 
-- 
2.20.1


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

* [PATCH 09/12] staging: r8188eu: remove unused enum and array
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (7 preceding siblings ...)
  2021-09-11 14:15 ` [PATCH 08/12] staging: r8188eu: remove unused pwrctrl definitions Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 14:15 ` [PATCH 10/12] staging: r8188eu: rtw_set_ips_deny is not used Martin Kaiser
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

PS_BBRegBackup in struct pwrctrl_priv is not used. Remove this component
and the related enum _PS_BBRegBackup_.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 97102c1ec553..bb0c9866fd61 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -53,14 +53,6 @@ enum rt_rf_power_state {
 	rf_max
 };
 
-enum _PS_BBRegBackup_ {
-	PSBBREG_RF0 = 0,
-	PSBBREG_RF1,
-	PSBBREG_RF2,
-	PSBBREG_AFE0,
-	PSBBREG_TOTALCNT
-};
-
 enum { /*  for ips_mode */
 	IPS_NONE = 0,
 	IPS_NORMAL,
@@ -126,7 +118,6 @@ struct pwrctrl_priv {
 	u8		bHWPwrPindetect;
 	u8		bkeepfwalive;
 	u8		brfoffbyhw;
-	unsigned long PS_BBRegBackup[PSBBREG_TOTALCNT];
 };
 
 #define rtw_get_ips_mode_req(pwrctrlpriv) \
-- 
2.20.1


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

* [PATCH 10/12] staging: r8188eu: rtw_set_ips_deny is not used
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (8 preceding siblings ...)
  2021-09-11 14:15 ` [PATCH 09/12] staging: r8188eu: remove unused enum and array Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 14:15 ` [PATCH 11/12] staging: r8188eu: remove unused variable cpwm_tog Martin Kaiser
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove the rtw_set_ips_deny function since it's not used.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 6 ------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 2 files changed, 7 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 0c4ca90a534f..cf3673be5ac6 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -391,12 +391,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 	timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0);
 }
 
-inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms)
-{
-	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
-	pwrpriv->ips_deny_time = jiffies + rtw_ms_to_systime(ms);
-}
-
 /*
 * rtw_pwr_wakeup - Wake the NIC up from: 1)IPS. 2)USB autosuspend
 * @adapter: pointer to struct adapter structure
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index bb0c9866fd61..54a3e6461f47 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -154,7 +154,6 @@ s32 LPS_RF_ON_check(struct adapter *adapter, u32 delay_ms);
 void LPS_Enter(struct adapter *adapter);
 void LPS_Leave(struct adapter *adapter);
 
-void rtw_set_ips_deny(struct adapter *adapter, u32 ms);
 int _rtw_pwr_wakeup(struct adapter *adapter, u32 ips_defer_ms,
 		    const char *caller);
 #define rtw_pwr_wakeup(adapter)						\
-- 
2.20.1


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

* [PATCH 11/12] staging: r8188eu: remove unused variable cpwm_tog
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (9 preceding siblings ...)
  2021-09-11 14:15 ` [PATCH 10/12] staging: r8188eu: rtw_set_ips_deny is not used Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-11 14:15 ` [PATCH 12/12] staging: r8188eu: remove unused variable b_hw_radio_off Martin Kaiser
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

cpwm_tog in struct pwrctrl_priv is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 54a3e6461f47..db049fdd1bdb 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -61,7 +61,6 @@ enum { /*  for ips_mode */
 
 struct pwrctrl_priv {
 	struct semaphore lock;
-	volatile u8 cpwm_tog; /*  toggling */
 
 	u8	pwr_mode;
 	u8	smart_ps;
-- 
2.20.1


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

* [PATCH 12/12] staging: r8188eu: remove unused variable b_hw_radio_off
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (10 preceding siblings ...)
  2021-09-11 14:15 ` [PATCH 11/12] staging: r8188eu: remove unused variable cpwm_tog Martin Kaiser
@ 2021-09-11 14:15 ` Martin Kaiser
  2021-09-13 16:21 ` [PATCH 00/12] staging: r8188eu: power management cleanup Greg Kroah-Hartman
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
  13 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 14:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

b_hw_radio_off in struct pwrctrl_priv is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index db049fdd1bdb..69ea7925feef 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -70,7 +70,6 @@ struct pwrctrl_priv {
 	struct work_struct cpwm_event;
 	u8	bpower_saving;
 
-	u8	b_hw_radio_off;
 	u8	reg_rfoff;
 	u8	reg_pdnmode; /* powerdown mode */
 	u32	rfoff_reason;
-- 
2.20.1


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

* Re: [PATCH 05/12] staging: r8188eu: remove rtw_set_rpwm
  2021-09-11 14:15 ` [PATCH 05/12] staging: r8188eu: remove rtw_set_rpwm Martin Kaiser
@ 2021-09-11 18:33   ` Michael Straube
  2021-09-11 20:13     ` Martin Kaiser
  0 siblings, 1 reply; 29+ messages in thread
From: Michael Straube @ 2021-09-11 18:33 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, linux-staging, linux-kernel

On 9/11/21 16:15, Martin Kaiser wrote:
> After we dropped the call to set HW_VAR_SET_RPWM, the rtw_set_rpwm
> function doesn't do anything useful.
> 
> Remove the function and the rpwm component of struct pwrctrl_priv,
> which is not used outside of rtw_set_rpwm.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>   .../realtek/rtl8192cu/include/rtw_pwrctrl.h   |  1 -
>   drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 34 -------------------
>   drivers/staging/r8188eu/include/rtw_pwrctrl.h |  2 --
>   3 files changed, 37 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h b/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h
> index a4cb292e1aea..303df55c521a 100644
> --- a/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h
> +++ b/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h
> @@ -309,7 +309,6 @@ extern void cpwm_int_hdl(PADAPTER padapter, struct reportpwrstate_parm *preportp
>   #endif
>

The patch does not apply to staging-testing.

Looks to me that the change in

.../realtek/rtl8192cu/include/rtw_pwrctrl.h

made it into this patch by accident?

Thanks,
Michael

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

* Re: [PATCH 05/12] staging: r8188eu: remove rtw_set_rpwm
  2021-09-11 18:33   ` Michael Straube
@ 2021-09-11 20:13     ` Martin Kaiser
  0 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-11 20:13 UTC (permalink / raw)
  To: Michael Straube
  Cc: Greg Kroah-Hartman, Larry Finger, Phillip Potter, linux-staging,
	linux-kernel

Thus wrote Michael Straube (straube.linux@gmail.com):

> On 9/11/21 16:15, Martin Kaiser wrote:
> > After we dropped the call to set HW_VAR_SET_RPWM, the rtw_set_rpwm
> > function doesn't do anything useful.

> > Remove the function and the rpwm component of struct pwrctrl_priv,
> > which is not used outside of rtw_set_rpwm.

> > Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> > ---
> >   .../realtek/rtl8192cu/include/rtw_pwrctrl.h   |  1 -
> >   drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 34 -------------------
> >   drivers/staging/r8188eu/include/rtw_pwrctrl.h |  2 --
> >   3 files changed, 37 deletions(-)

> > diff --git a/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h b/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h
> > index a4cb292e1aea..303df55c521a 100644
> > --- a/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h
> > +++ b/drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h
> > @@ -309,7 +309,6 @@ extern void cpwm_int_hdl(PADAPTER padapter, struct reportpwrstate_parm *preportp
> >   #endif


> The patch does not apply to staging-testing.

> Looks to me that the change in

> .../realtek/rtl8192cu/include/rtw_pwrctrl.h

> made it into this patch by accident?

thanks for spotting this, Michael. I'll send a v2 on Monday.

Best regards,
Martin

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

* Re: [PATCH 00/12] staging: r8188eu: power management cleanup
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (11 preceding siblings ...)
  2021-09-11 14:15 ` [PATCH 12/12] staging: r8188eu: remove unused variable b_hw_radio_off Martin Kaiser
@ 2021-09-13 16:21 ` Greg Kroah-Hartman
  2021-09-13 19:37   ` Martin Kaiser
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
  13 siblings, 1 reply; 29+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-13 16:21 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel

On Sat, Sep 11, 2021 at 04:15:09PM +0200, Martin Kaiser wrote:
> Remove some unused parts of the power management code.
> 
> Tested with Edimax EW-7811Un V2 on an ARM32 embedded system.
> 
> Martin Kaiser (12):
>   staging: r8188eu: btcoex_rfon is always false
>   staging: r8188eu: setting HW_VAR_SET_RPWM does nothing
>   staging: r8188eu: remove write-only variable cpwm
>   staging: r8188eu: remove write-only variable tog
>   staging: r8188eu: remove rtw_set_rpwm
>   staging: r8188eu: remove unused power state defines
>   staging: r8188eu: _free_pwrlock is empty
>   staging: r8188eu: remove unused pwrctrl definitions
>   staging: r8188eu: remove unused enum and array
>   staging: r8188eu: rtw_set_ips_deny is not used
>   staging: r8188eu: remove unused variable cpwm_tog
>   staging: r8188eu: remove unused variable b_hw_radio_off

I applied a subset of these.  Please rebase and resend the reset.

thanks,

greg k-h

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

* [PATCH v2 0/8] staging: r8188eu: power management cleanup
  2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
                   ` (12 preceding siblings ...)
  2021-09-13 16:21 ` [PATCH 00/12] staging: r8188eu: power management cleanup Greg Kroah-Hartman
@ 2021-09-13 18:51 ` Martin Kaiser
  2021-09-13 18:51   ` [PATCH v2 1/8] staging: r8188eu: remove rtw_set_rpwm Martin Kaiser
                     ` (8 more replies)
  13 siblings, 9 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-13 18:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove some unused parts of the power management code.

Tested with Edimax EW-7811Un V2 on an ARM32 embedded system.

v2:
- rebased against today's staging-testing branch
- fixed one patch that changed files outside of the r8188eu driver

Martin Kaiser (8):
  staging: r8188eu: remove rtw_set_rpwm
  staging: r8188eu: remove unused power state defines
  staging: r8188eu: _free_pwrlock is empty
  staging: r8188eu: remove unused pwrctrl definitions
  staging: r8188eu: remove unused enum and array
  staging: r8188eu: rtw_set_ips_deny is not used
  staging: r8188eu: remove unused variable cpwm_tog
  staging: r8188eu: remove unused variable b_hw_radio_off

 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 48 ---------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 98 -------------------
 drivers/staging/r8188eu/os_dep/os_intfs.c     |  2 -
 3 files changed, 148 deletions(-)

-- 
2.20.1


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

* [PATCH v2 1/8] staging: r8188eu: remove rtw_set_rpwm
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
@ 2021-09-13 18:51   ` Martin Kaiser
  2021-09-13 18:51   ` [PATCH v2 2/8] staging: r8188eu: remove unused power state defines Martin Kaiser
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-13 18:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

After we dropped the call to set HW_VAR_SET_RPWM, the rtw_set_rpwm
function doesn't do anything useful.

Remove the function and the rpwm component of struct pwrctrl_priv,
which is not used outside of rtw_set_rpwm.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2:
- rebased against today's staging-testing branch
- removed changes to files outside of the r8188eu driver

 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 34 -------------------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h |  2 --
 2 files changed, 36 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 9f77e75ea1bb..3adcf0f3d012 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -166,35 +166,6 @@ static void pwr_state_check_handler(struct timer_list *t)
 	rtw_ps_cmd(padapter);
 }
 
-/*
- *
- * Parameters
- *	padapter
- *	pslv			power state level, only could be PS_STATE_S0 ~ PS_STATE_S4
- *
- */
-void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
-{
-	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
-
-	pslv = PS_STATE(pslv);
-
-	if (pwrpriv->rpwm == pslv)
-		return;
-
-	if ((padapter->bSurpriseRemoved) ||
-	    (!padapter->hw_init_completed)) {
-		return;
-	}
-
-	if (padapter->bDriverStopped) {
-		if (pslv < PS_STATE_S2)
-			return;
-	}
-
-	pwrpriv->rpwm = pslv;
-}
-
 static u8 PS_RDY_CHECK(struct adapter *padapter)
 {
 	u32 curr_time, delta_time;
@@ -244,7 +215,6 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
 		if (pwdinfo->opp_ps == 0) {
 			DBG_88E("rtw_set_ps_mode: Leave 802.11 power save\n");
 			pwrpriv->pwr_mode = ps_mode;
-			rtw_set_rpwm(padapter, PS_STATE_S4);
 			rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode));
 			pwrpriv->bFwCurrentInPSMode = false;
 		}
@@ -260,8 +230,6 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
 			/*  Set CTWindow after LPS */
 			if (pwdinfo->opp_ps == 1)
 				p2p_ps_wk_cmd(padapter, P2P_PS_ENABLE, 0);
-
-			rtw_set_rpwm(padapter, PS_STATE_S2);
 		}
 	}
 
@@ -396,8 +364,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 
 	pwrctrlpriv->bFwCurrentInPSMode = false;
 
-	pwrctrlpriv->rpwm = 0;
-
 	pwrctrlpriv->pwr_mode = PS_MODE_ACTIVE;
 	pwrctrlpriv->smart_ps = padapter->registrypriv.smart_ps;
 	pwrctrlpriv->bcn_ant_mode = 0;
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 6c515e35de4f..4f657bc0d8e7 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -151,7 +151,6 @@ enum { /*  for ips_mode */
 
 struct pwrctrl_priv {
 	struct semaphore lock;
-	volatile u8 rpwm; /*  requested power state for fw */
 	volatile u8 cpwm_tog; /*  toggling */
 
 	u8	pwr_mode;
@@ -233,7 +232,6 @@ void rtw_free_pwrctrl_priv(struct adapter *adapter);
 
 void rtw_set_ps_mode(struct adapter *adapter, u8 ps_mode, u8 smart_ps,
 		     u8 bcn_ant_mode);
-void rtw_set_rpwm(struct adapter *adapter, u8 val8);
 void LeaveAllPowerSaveMode(struct adapter *adapter);
 void ips_enter(struct adapter *padapter);
 int ips_leave(struct adapter *padapter);
-- 
2.20.1


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

* [PATCH v2 2/8] staging: r8188eu: remove unused power state defines
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
  2021-09-13 18:51   ` [PATCH v2 1/8] staging: r8188eu: remove rtw_set_rpwm Martin Kaiser
@ 2021-09-13 18:51   ` Martin Kaiser
  2021-09-13 18:51   ` [PATCH v2 3/8] staging: r8188eu: _free_pwrlock is empty Martin Kaiser
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-13 18:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove some unused defines and macros related to power states.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 36 -------------------
 1 file changed, 36 deletions(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 4f657bc0d8e7..463eb9845e0b 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -39,42 +39,6 @@ enum power_mgnt {
 	PS_MODE_NUM
 };
 
-/*
-	BIT[2:0] = HW state
-	BIT[3] = Protocol PS state,   0: register active state,
-				      1: register sleep state
-	BIT[4] = sub-state
-*/
-
-#define PS_DPS			BIT(0)
-#define PS_LCLK			(PS_DPS)
-#define PS_RF_OFF		BIT(1)
-#define PS_ALL_ON		BIT(2)
-#define PS_ST_ACTIVE		BIT(3)
-
-#define PS_ISR_ENABLE		BIT(4)
-#define PS_IMR_ENABLE		BIT(5)
-#define PS_ACK			BIT(6)
-#define PS_TOGGLE		BIT(7)
-
-#define PS_STATE_MASK		(0x0F)
-#define PS_STATE_HW_MASK	(0x07)
-#define PS_SEQ_MASK		(0xc0)
-
-#define PS_STATE(x)		(PS_STATE_MASK & (x))
-#define PS_STATE_HW(x)		(PS_STATE_HW_MASK & (x))
-#define PS_SEQ(x)		(PS_SEQ_MASK & (x))
-
-#define PS_STATE_S0		(PS_DPS)
-#define PS_STATE_S1		(PS_LCLK)
-#define PS_STATE_S2		(PS_RF_OFF)
-#define PS_STATE_S3		(PS_ALL_ON)
-#define PS_STATE_S4		((PS_ST_ACTIVE) | (PS_ALL_ON))
-
-#define PS_IS_RF_ON(x)	((x) & (PS_ALL_ON))
-#define PS_IS_ACTIVE(x)	((x) & (PS_ST_ACTIVE))
-#define CLR_PS_STATE(x)	((x) = ((x) & (0xF0)))
-
 struct reportpwrstate_parm {
 	unsigned char mode;
 	unsigned char state; /* the CPWM value */
-- 
2.20.1


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

* [PATCH v2 3/8] staging: r8188eu: _free_pwrlock is empty
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
  2021-09-13 18:51   ` [PATCH v2 1/8] staging: r8188eu: remove rtw_set_rpwm Martin Kaiser
  2021-09-13 18:51   ` [PATCH v2 2/8] staging: r8188eu: remove unused power state defines Martin Kaiser
@ 2021-09-13 18:51   ` Martin Kaiser
  2021-09-13 19:38     ` Michael Straube
  2021-09-13 18:51   ` [PATCH v2 4/8] staging: r8188eu: remove unused pwrctrl definitions Martin Kaiser
                     ` (5 subsequent siblings)
  8 siblings, 1 reply; 29+ messages in thread
From: Martin Kaiser @ 2021-09-13 18:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove the empty _free_pwrlock function and rtw_free_pwrctrl_priv,
which is just a wrapper around _free_pwrlock.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 8 --------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 4 ----
 drivers/staging/r8188eu/os_dep/os_intfs.c     | 2 --
 3 files changed, 14 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 3adcf0f3d012..4500d60c3777 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -371,14 +371,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 	timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0);
 }
 
-void rtw_free_pwrctrl_priv(struct adapter *adapter)
-{
-	struct pwrctrl_priv *pwrctrlpriv = &adapter->pwrctrlpriv;
-
-	_free_pwrlock(&pwrctrlpriv->lock);
-
-}
-
 inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms)
 {
 	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 463eb9845e0b..edbb852b1288 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -50,10 +50,6 @@ static inline void _init_pwrlock(struct semaphore  *plock)
 	sema_init(plock, 1);
 }
 
-static inline void _free_pwrlock(struct semaphore  *plock)
-{
-}
-
 static inline void _enter_pwrlock(struct semaphore  *plock)
 {
 	_rtw_down_sema(plock);
diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index 306377fe8bfc..3367c7cfc033 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -933,8 +933,6 @@ u8 rtw_free_drv_sw(struct adapter *padapter)
 
 	_rtw_free_recv_priv(&padapter->recvpriv);
 
-	rtw_free_pwrctrl_priv(padapter);
-
 	rtl8188e_free_hal_data(padapter);
 
 	/* free the old_pnetdev */
-- 
2.20.1


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

* [PATCH v2 4/8] staging: r8188eu: remove unused pwrctrl definitions
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
                     ` (2 preceding siblings ...)
  2021-09-13 18:51   ` [PATCH v2 3/8] staging: r8188eu: _free_pwrlock is empty Martin Kaiser
@ 2021-09-13 18:51   ` Martin Kaiser
  2021-09-13 18:51   ` [PATCH v2 5/8] staging: r8188eu: remove unused enum and array Martin Kaiser
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-13 18:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove a bunch of unused defines and macros and an unused struct
from rtw_pwrctrl.h.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 44 -------------------
 1 file changed, 44 deletions(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index edbb852b1288..fd9c054e2d5a 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -7,18 +7,6 @@
 #include "osdep_service.h"
 #include "drv_types.h"
 
-#define FW_PWR0		0
-#define FW_PWR1		1
-#define FW_PWR2		2
-#define FW_PWR3		3
-#define HW_PWR0		7
-#define HW_PWR1		6
-#define HW_PWR2		2
-#define HW_PWR3		0
-#define HW_PWR4		8
-
-#define FW_PWRMSK	0x7
-
 #define XMIT_ALIVE	BIT(0)
 #define RECV_ALIVE	BIT(1)
 #define CMD_ALIVE	BIT(2)
@@ -39,12 +27,6 @@ enum power_mgnt {
 	PS_MODE_NUM
 };
 
-struct reportpwrstate_parm {
-	unsigned char mode;
-	unsigned char state; /* the CPWM value */
-	unsigned short rsvd;
-};
-
 static inline void _init_pwrlock(struct semaphore  *plock)
 {
 	sema_init(plock, 1);
@@ -62,10 +44,6 @@ static inline void _exit_pwrlock(struct semaphore  *plock)
 
 #define LPS_DELAY_TIME	1*HZ /*  1 sec */
 
-#define EXE_PWR_NONE	0x01
-#define EXE_PWR_IPS		0x02
-#define EXE_PWR_LPS		0x04
-
 /*  RF state. */
 enum rt_rf_power_state {
 	rf_on,		/*  RF is on after RFSleep or RFOff */
@@ -75,26 +53,6 @@ enum rt_rf_power_state {
 	rf_max
 };
 
-/*  RF Off Level for IPS or HW/SW radio off */
-#define	RT_RF_OFF_LEVL_ASPM		BIT(0)	/* PCI ASPM */
-#define	RT_RF_OFF_LEVL_CLK_REQ		BIT(1)	/* PCI clock request */
-#define	RT_RF_OFF_LEVL_PCI_D3		BIT(2)	/* PCI D3 mode */
-#define	RT_RF_OFF_LEVL_HALT_NIC		BIT(3)	/* NIC halt, re-init hw param*/
-#define	RT_RF_OFF_LEVL_FREE_FW		BIT(4)	/* FW free, re-download the FW*/
-#define	RT_RF_OFF_LEVL_FW_32K		BIT(5)	/* FW in 32k */
-#define	RT_RF_PS_LEVEL_ALWAYS_ASPM	BIT(6)	/* Always enable ASPM and Clock
-						 * Req in initialization. */
-#define	RT_RF_LPS_DISALBE_2R		BIT(30)	/* When LPS is on, disable 2R
-						 * if no packet is RX or TX. */
-#define	RT_RF_LPS_LEVEL_ASPM		BIT(31)	/* LPS with ASPM */
-
-#define	RT_IN_PS_LEVEL(ppsc, _PS_FLAG)				\
-	((ppsc->cur_ps_level & _PS_FLAG) ? true : false)
-#define	RT_CLEAR_PS_LEVEL(ppsc, _PS_FLAG)			\
-	(ppsc->cur_ps_level &= (~(_PS_FLAG)))
-#define	RT_SET_PS_LEVEL(ppsc, _PS_FLAG)				\
-	(ppsc->cur_ps_level |= _PS_FLAG)
-
 enum _PS_BBRegBackup_ {
 	PSBBREG_RF0 = 0,
 	PSBBREG_RF1,
@@ -209,8 +167,6 @@ int _rtw_pwr_wakeup(struct adapter *adapter, u32 ips_defer_ms,
 		    const char *caller);
 #define rtw_pwr_wakeup(adapter)						\
 	 _rtw_pwr_wakeup(adapter, RTW_PWR_STATE_CHK_INTERVAL, __func__)
-#define rtw_pwr_wakeup_ex(adapter, ips_deffer_ms)			\
-	 _rtw_pwr_wakeup(adapter, ips_deffer_ms, __func__)
 int rtw_pm_set_ips(struct adapter *adapter, u8 mode);
 int rtw_pm_set_lps(struct adapter *adapter, u8 mode);
 
-- 
2.20.1


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

* [PATCH v2 5/8] staging: r8188eu: remove unused enum and array
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
                     ` (3 preceding siblings ...)
  2021-09-13 18:51   ` [PATCH v2 4/8] staging: r8188eu: remove unused pwrctrl definitions Martin Kaiser
@ 2021-09-13 18:51   ` Martin Kaiser
  2021-09-13 18:51   ` [PATCH v2 6/8] staging: r8188eu: rtw_set_ips_deny is not used Martin Kaiser
                     ` (3 subsequent siblings)
  8 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-13 18:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

PS_BBRegBackup in struct pwrctrl_priv is not used. Remove this component
and the related enum _PS_BBRegBackup_.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index fd9c054e2d5a..c4f5cca8df08 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -53,14 +53,6 @@ enum rt_rf_power_state {
 	rf_max
 };
 
-enum _PS_BBRegBackup_ {
-	PSBBREG_RF0 = 0,
-	PSBBREG_RF1,
-	PSBBREG_RF2,
-	PSBBREG_AFE0,
-	PSBBREG_TOTALCNT
-};
-
 enum { /*  for ips_mode */
 	IPS_NONE = 0,
 	IPS_NORMAL,
@@ -125,7 +117,6 @@ struct pwrctrl_priv {
 	u8		bHWPowerdown;/* if support hw power down */
 	u8		bkeepfwalive;
 	u8		brfoffbyhw;
-	unsigned long PS_BBRegBackup[PSBBREG_TOTALCNT];
 };
 
 #define rtw_get_ips_mode_req(pwrctrlpriv) \
-- 
2.20.1


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

* [PATCH v2 6/8] staging: r8188eu: rtw_set_ips_deny is not used
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
                     ` (4 preceding siblings ...)
  2021-09-13 18:51   ` [PATCH v2 5/8] staging: r8188eu: remove unused enum and array Martin Kaiser
@ 2021-09-13 18:51   ` Martin Kaiser
  2021-09-13 18:51   ` [PATCH v2 7/8] staging: r8188eu: remove unused variable cpwm_tog Martin Kaiser
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-13 18:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove the rtw_set_ips_deny function since it's not used.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 6 ------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 2 files changed, 7 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 4500d60c3777..d901ac7aea4d 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -371,12 +371,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 	timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0);
 }
 
-inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms)
-{
-	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
-	pwrpriv->ips_deny_time = jiffies + rtw_ms_to_systime(ms);
-}
-
 /*
 * rtw_pwr_wakeup - Wake the NIC up from: 1)IPS. 2)USB autosuspend
 * @adapter: pointer to struct adapter structure
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index c4f5cca8df08..9e4b4eef4d27 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -153,7 +153,6 @@ s32 LPS_RF_ON_check(struct adapter *adapter, u32 delay_ms);
 void LPS_Enter(struct adapter *adapter);
 void LPS_Leave(struct adapter *adapter);
 
-void rtw_set_ips_deny(struct adapter *adapter, u32 ms);
 int _rtw_pwr_wakeup(struct adapter *adapter, u32 ips_defer_ms,
 		    const char *caller);
 #define rtw_pwr_wakeup(adapter)						\
-- 
2.20.1


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

* [PATCH v2 7/8] staging: r8188eu: remove unused variable cpwm_tog
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
                     ` (5 preceding siblings ...)
  2021-09-13 18:51   ` [PATCH v2 6/8] staging: r8188eu: rtw_set_ips_deny is not used Martin Kaiser
@ 2021-09-13 18:51   ` Martin Kaiser
  2021-09-13 18:51   ` [PATCH v2 8/8] staging: r8188eu: remove unused variable b_hw_radio_off Martin Kaiser
  2021-09-14  9:45   ` [PATCH v2 0/8] staging: r8188eu: power management cleanup Dan Carpenter
  8 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-13 18:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

cpwm_tog in struct pwrctrl_priv is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 9e4b4eef4d27..08d414aa9ef5 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -61,7 +61,6 @@ enum { /*  for ips_mode */
 
 struct pwrctrl_priv {
 	struct semaphore lock;
-	volatile u8 cpwm_tog; /*  toggling */
 
 	u8	pwr_mode;
 	u8	smart_ps;
-- 
2.20.1


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

* [PATCH v2 8/8] staging: r8188eu: remove unused variable b_hw_radio_off
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
                     ` (6 preceding siblings ...)
  2021-09-13 18:51   ` [PATCH v2 7/8] staging: r8188eu: remove unused variable cpwm_tog Martin Kaiser
@ 2021-09-13 18:51   ` Martin Kaiser
  2021-09-14  9:45   ` [PATCH v2 0/8] staging: r8188eu: power management cleanup Dan Carpenter
  8 siblings, 0 replies; 29+ messages in thread
From: Martin Kaiser @ 2021-09-13 18:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

b_hw_radio_off in struct pwrctrl_priv is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 08d414aa9ef5..28e4041acb98 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -70,7 +70,6 @@ struct pwrctrl_priv {
 	struct work_struct cpwm_event;
 	u8	bpower_saving;
 
-	u8	b_hw_radio_off;
 	u8	reg_rfoff;
 	u8	reg_pdnmode; /* powerdown mode */
 	u32	rfoff_reason;
-- 
2.20.1


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

* Re: [PATCH 00/12] staging: r8188eu: power management cleanup
  2021-09-13 16:21 ` [PATCH 00/12] staging: r8188eu: power management cleanup Greg Kroah-Hartman
@ 2021-09-13 19:37   ` Martin Kaiser
  2021-09-14  7:15     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 29+ messages in thread
From: Martin Kaiser @ 2021-09-13 19:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel

Thus wrote Greg Kroah-Hartman (gregkh@linuxfoundation.org):

> On Sat, Sep 11, 2021 at 04:15:09PM +0200, Martin Kaiser wrote:
> > Remove some unused parts of the power management code.

> > Tested with Edimax EW-7811Un V2 on an ARM32 embedded system.

> > Martin Kaiser (12):
> >   staging: r8188eu: btcoex_rfon is always false
> >   staging: r8188eu: setting HW_VAR_SET_RPWM does nothing
> >   staging: r8188eu: remove write-only variable cpwm
> >   staging: r8188eu: remove write-only variable tog
> >   staging: r8188eu: remove rtw_set_rpwm
> >   staging: r8188eu: remove unused power state defines
> >   staging: r8188eu: _free_pwrlock is empty
> >   staging: r8188eu: remove unused pwrctrl definitions
> >   staging: r8188eu: remove unused enum and array
> >   staging: r8188eu: rtw_set_ips_deny is not used
> >   staging: r8188eu: remove unused variable cpwm_tog
> >   staging: r8188eu: remove unused variable b_hw_radio_off

> I applied a subset of these.  Please rebase and resend the reset.

I sent a v2 of this patchset with the outstanding patches as a followup
to this set. I hope that this is generally the right thing to do after
the maintainer applies some patches of a set.

Thanks & best regards,
Martin

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

* Re: [PATCH v2 3/8] staging: r8188eu: _free_pwrlock is empty
  2021-09-13 18:51   ` [PATCH v2 3/8] staging: r8188eu: _free_pwrlock is empty Martin Kaiser
@ 2021-09-13 19:38     ` Michael Straube
  0 siblings, 0 replies; 29+ messages in thread
From: Michael Straube @ 2021-09-13 19:38 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, linux-staging, linux-kernel

Hi Martin,

On 9/13/21 20:51, Martin Kaiser wrote:
> -void rtw_free_pwrctrl_priv(struct adapter *adapter)
> -{
> -	struct pwrctrl_priv *pwrctrlpriv = &adapter->pwrctrlpriv;
> -
> -	_free_pwrlock(&pwrctrlpriv->lock);
> -
> -}

the prototype of rtw_free_pwrctrl_priv can also be removed
from rtw_pwrctrl.h,

Thanks,
Michael

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

* Re: [PATCH 00/12] staging: r8188eu: power management cleanup
  2021-09-13 19:37   ` Martin Kaiser
@ 2021-09-14  7:15     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 29+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-14  7:15 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel

On Mon, Sep 13, 2021 at 09:37:33PM +0200, Martin Kaiser wrote:
> Thus wrote Greg Kroah-Hartman (gregkh@linuxfoundation.org):
> 
> > On Sat, Sep 11, 2021 at 04:15:09PM +0200, Martin Kaiser wrote:
> > > Remove some unused parts of the power management code.
> 
> > > Tested with Edimax EW-7811Un V2 on an ARM32 embedded system.
> 
> > > Martin Kaiser (12):
> > >   staging: r8188eu: btcoex_rfon is always false
> > >   staging: r8188eu: setting HW_VAR_SET_RPWM does nothing
> > >   staging: r8188eu: remove write-only variable cpwm
> > >   staging: r8188eu: remove write-only variable tog
> > >   staging: r8188eu: remove rtw_set_rpwm
> > >   staging: r8188eu: remove unused power state defines
> > >   staging: r8188eu: _free_pwrlock is empty
> > >   staging: r8188eu: remove unused pwrctrl definitions
> > >   staging: r8188eu: remove unused enum and array
> > >   staging: r8188eu: rtw_set_ips_deny is not used
> > >   staging: r8188eu: remove unused variable cpwm_tog
> > >   staging: r8188eu: remove unused variable b_hw_radio_off
> 
> > I applied a subset of these.  Please rebase and resend the reset.
> 
> I sent a v2 of this patchset with the outstanding patches as a followup
> to this set. I hope that this is generally the right thing to do after
> the maintainer applies some patches of a set.

That works, thanks!

greg k-h

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

* Re: [PATCH v2 0/8] staging: r8188eu: power management cleanup
  2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
                     ` (7 preceding siblings ...)
  2021-09-13 18:51   ` [PATCH v2 8/8] staging: r8188eu: remove unused variable b_hw_radio_off Martin Kaiser
@ 2021-09-14  9:45   ` Dan Carpenter
  8 siblings, 0 replies; 29+ messages in thread
From: Dan Carpenter @ 2021-09-14  9:45 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Greg Kroah-Hartman, Larry Finger, Phillip Potter,
	Michael Straube, linux-staging, linux-kernel

On Mon, Sep 13, 2021 at 08:51:02PM +0200, Martin Kaiser wrote:
> Remove some unused parts of the power management code.
> 
> Tested with Edimax EW-7811Un V2 on an ARM32 embedded system.
> 
> v2:
> - rebased against today's staging-testing branch
> - fixed one patch that changed files outside of the r8188eu driver

In future, when you're resending a v2 could you just create a new
thread?  We used to encourage people to send it on the same thread but
these days it's more common to start a new thread.  Also staging doesn't
used patchwork but subsystems which use patchwork prefer new threads or
patchwork gets messed up somehow.

regards,
dan carpenter


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

end of thread, other threads:[~2021-09-14  9:45 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-11 14:15 [PATCH 00/12] staging: r8188eu: power management cleanup Martin Kaiser
2021-09-11 14:15 ` [PATCH 01/12] staging: r8188eu: btcoex_rfon is always false Martin Kaiser
2021-09-11 14:15 ` [PATCH 02/12] staging: r8188eu: setting HW_VAR_SET_RPWM does nothing Martin Kaiser
2021-09-11 14:15 ` [PATCH 03/12] staging: r8188eu: remove write-only variable cpwm Martin Kaiser
2021-09-11 14:15 ` [PATCH 04/12] staging: r8188eu: remove write-only variable tog Martin Kaiser
2021-09-11 14:15 ` [PATCH 05/12] staging: r8188eu: remove rtw_set_rpwm Martin Kaiser
2021-09-11 18:33   ` Michael Straube
2021-09-11 20:13     ` Martin Kaiser
2021-09-11 14:15 ` [PATCH 06/12] staging: r8188eu: remove unused power state defines Martin Kaiser
2021-09-11 14:15 ` [PATCH 07/12] staging: r8188eu: _free_pwrlock is empty Martin Kaiser
2021-09-11 14:15 ` [PATCH 08/12] staging: r8188eu: remove unused pwrctrl definitions Martin Kaiser
2021-09-11 14:15 ` [PATCH 09/12] staging: r8188eu: remove unused enum and array Martin Kaiser
2021-09-11 14:15 ` [PATCH 10/12] staging: r8188eu: rtw_set_ips_deny is not used Martin Kaiser
2021-09-11 14:15 ` [PATCH 11/12] staging: r8188eu: remove unused variable cpwm_tog Martin Kaiser
2021-09-11 14:15 ` [PATCH 12/12] staging: r8188eu: remove unused variable b_hw_radio_off Martin Kaiser
2021-09-13 16:21 ` [PATCH 00/12] staging: r8188eu: power management cleanup Greg Kroah-Hartman
2021-09-13 19:37   ` Martin Kaiser
2021-09-14  7:15     ` Greg Kroah-Hartman
2021-09-13 18:51 ` [PATCH v2 0/8] " Martin Kaiser
2021-09-13 18:51   ` [PATCH v2 1/8] staging: r8188eu: remove rtw_set_rpwm Martin Kaiser
2021-09-13 18:51   ` [PATCH v2 2/8] staging: r8188eu: remove unused power state defines Martin Kaiser
2021-09-13 18:51   ` [PATCH v2 3/8] staging: r8188eu: _free_pwrlock is empty Martin Kaiser
2021-09-13 19:38     ` Michael Straube
2021-09-13 18:51   ` [PATCH v2 4/8] staging: r8188eu: remove unused pwrctrl definitions Martin Kaiser
2021-09-13 18:51   ` [PATCH v2 5/8] staging: r8188eu: remove unused enum and array Martin Kaiser
2021-09-13 18:51   ` [PATCH v2 6/8] staging: r8188eu: rtw_set_ips_deny is not used Martin Kaiser
2021-09-13 18:51   ` [PATCH v2 7/8] staging: r8188eu: remove unused variable cpwm_tog Martin Kaiser
2021-09-13 18:51   ` [PATCH v2 8/8] staging: r8188eu: remove unused variable b_hw_radio_off Martin Kaiser
2021-09-14  9:45   ` [PATCH v2 0/8] staging: r8188eu: power management cleanup Dan Carpenter

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.