Skip to contentSkip to conversation

staging: r8188eu: power management cleanup

PATCH In review Martin Kaiser 4 participants 29 messages Sep 11, 2021 – Sep 14, 2021 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: r8188eu: power management cleanup

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(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/12 staging: r8188eu: btcoex_rfon is always false

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

---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 7 -------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 2 files changed, 8 deletions(-)
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -7
index 353b7bd850d9..f9ee917895c7 100644
@@ -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);
 }
 
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -1
index 8446dfb50f34..6a0efb010d06 100644
@@ -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;
 
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/12 staging: r8188eu: setting HW_VAR_SET_RPWM does nothing

In reply to 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.

---
 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(-)
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -5
index f9ee917895c7..daae91f82e97 100644
@@ -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;
 
drivers/staging/r8188eu/hal/usb_halinit.c +0 -2
index c5347c5459d6..62d9e656e1db 100644
@@ -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);
drivers/staging/r8188eu/include/hal_intf.h +0 -1
index c1e120593574..192d79604d12 100644
@@ -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,
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/12 staging: r8188eu: remove write-only variable cpwm

In reply to Martin Kaiser

cpwm in struct pwrctrl_priv is never read. Remove it.

---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 5 -----
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 2 --
 2 files changed, 7 deletions(-)
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -5
index daae91f82e97..2a0ee3aac700 100644
@@ -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;
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -2
index 6a0efb010d06..c5804a48072b 100644
@@ -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 */
 
Signature · 1 line
2.20.1
#4 lore raw

PATCH 4/12 staging: r8188eu: remove write-only variable tog

In reply to Martin Kaiser

tog in struct pwrctrl_priv is never read. Remove it.

---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 4 ----
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 2 files changed, 5 deletions(-)
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -4
index 2a0ee3aac700..86841093caa8 100644
@@ -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);
 }
 
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -1
index c5804a48072b..5be67644ba5f 100644
@@ -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;
Signature · 1 line
2.20.1
#5 lore raw

PATCH 5/12 staging: r8188eu: remove rtw_set_rpwm

In reply to 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.

---
 .../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(-)
drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h +0 -1
index a4cb292e1aea..303df55c521a 100644
@@ -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);
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -34
index 86841093caa8..5b4cd8e738db 100644
@@ -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;
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -2
index 5be67644ba5f..08d821575755 100644
@@ -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);
Signature · 1 line
2.20.1
#6 lore raw

Re: [PATCH 05/12] staging: r8188eu: remove rtw_set_rpwm

Quoted 18 lines · 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.

---
  .../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(-)
drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h +0 -0
index a4cb292e1aea..303df55c521a 100644

drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h extern void cpwm_int_hdl(PADAPTER padapter, struct reportpwrstate_parm *preportp · line 310

Quoted 2 lines
drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h +0 -0
@@ -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

#7 lore raw

Re: [PATCH 05/12] staging: r8188eu: remove rtw_set_rpwm

Thus wrote Michael Straube ([email protected]):

Quoted 24 lines · Martin Kaiser
Quoted 18 lines

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.

---
  .../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(-)
drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h +0 -0
index a4cb292e1aea..303df55c521a 100644

drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h extern void cpwm_int_hdl(PADAPTER padapter, struct reportpwrstate_parm *preportp · line 309

Quoted 1 line
drivers/net/wireless/realtek/rtl8192cu/include/rtw_pwrctrl.h +0 -0
@@ -309,7 +309,6 @@ extern void cpwm_int_hdl(PADAPTER padapter, struct reportpwrstate_parm *preportp
  #endif

The patch does not apply to staging-testing.

Quoted 5 lines

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

#8 lore raw

PATCH 6/12 staging: r8188eu: remove unused power state defines

In reply to Martin Kaiser

Remove some unused defines and macros related to power states.

---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 36 -------------------
 1 file changed, 36 deletions(-)
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -36
index 08d821575755..bd05d1dfe77e 100644
@@ -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 */
Signature · 1 line
2.20.1
#9 lore raw

PATCH 7/12 staging: r8188eu: _free_pwrlock is empty

In reply to Martin Kaiser

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

---
 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(-)
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -8
index 5b4cd8e738db..0c4ca90a534f 100644
@@ -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;
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -4
index bd05d1dfe77e..d89a11062fea 100644
@@ -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);
drivers/staging/r8188eu/os_dep/os_intfs.c +0 -2
index 306377fe8bfc..3367c7cfc033 100644
@@ -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 */
Signature · 1 line
2.20.1
#10 lore raw

PATCH 8/12 staging: r8188eu: remove unused pwrctrl definitions

In reply to Martin Kaiser

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

---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 44 -------------------
 1 file changed, 44 deletions(-)
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -44
index d89a11062fea..97102c1ec553 100644
@@ -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);
 
Signature · 1 line
2.20.1
#11 lore raw

PATCH 9/12 staging: r8188eu: remove unused enum and array

In reply to Martin Kaiser

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

---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 9 ---------
 1 file changed, 9 deletions(-)
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -9
index 97102c1ec553..bb0c9866fd61 100644
@@ -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) \
Signature · 1 line
2.20.1
#12 lore raw

PATCH 10/12 staging: r8188eu: rtw_set_ips_deny is not used

In reply to Martin Kaiser

Remove the rtw_set_ips_deny function since it's not used.

---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 6 ------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 2 files changed, 7 deletions(-)
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -6
index 0c4ca90a534f..cf3673be5ac6 100644
@@ -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
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -1
index bb0c9866fd61..54a3e6461f47 100644
@@ -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)						\
Signature · 1 line
2.20.1
#13 lore raw

PATCH 11/12 staging: r8188eu: remove unused variable cpwm_tog

In reply to Martin Kaiser

cpwm_tog in struct pwrctrl_priv is not used. Remove it.

---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -1
index 54a3e6461f47..db049fdd1bdb 100644
@@ -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;
Signature · 1 line
2.20.1
#14 lore raw

PATCH 12/12 staging: r8188eu: remove unused variable b_hw_radio_off

In reply to Martin Kaiser

b_hw_radio_off in struct pwrctrl_priv is not used. Remove it.

---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -1
index db049fdd1bdb..69ea7925feef 100644
@@ -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;
Signature · 1 line
2.20.1
#15 lore raw
In reply to Martin Kaiser
Quoted 4 lines · Martin Kaiser

Remove some unused parts of the power management code.

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

Quoted 13 lines

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

#16 lore raw

Thus wrote Greg Kroah-Hartman ([email protected]):

Quoted 19 lines · Martin Kaiser
Quoted 4 lines

Remove some unused parts of the power management code.

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

Quoted 13 lines

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

Quoted 1 line

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

#17 lore raw
Quoted 21 lines · Martin Kaiser

Thus wrote Greg Kroah-Hartman ([email protected]):

Quoted 18 lines · Martin Kaiser
Quoted 17 lines

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

Quoted 5 lines
Quoted 1 line

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

#18 lore raw

v2 cover staging: r8188eu: power management cleanup

In reply to 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(-)
Signature · 1 line
2.20.1
#19 lore raw

PATCH v2 1/8 staging: r8188eu: remove rtw_set_rpwm

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.

---
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(-)
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -34
index 9f77e75ea1bb..3adcf0f3d012 100644
@@ -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;
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -2
index 6c515e35de4f..4f657bc0d8e7 100644
@@ -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);
Signature · 1 line
2.20.1
#20 lore raw

PATCH v2 2/8 staging: r8188eu: remove unused power state defines

In reply to Martin Kaiser

Remove some unused defines and macros related to power states.

---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 36 -------------------
 1 file changed, 36 deletions(-)
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -36
index 4f657bc0d8e7..463eb9845e0b 100644
@@ -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 */
Signature · 1 line
2.20.1
#21 lore raw

PATCH v2 3/8 staging: r8188eu: _free_pwrlock is empty

In reply to Martin Kaiser

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

---
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(-)
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -8
index 3adcf0f3d012..4500d60c3777 100644
@@ -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;
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -4
index 463eb9845e0b..edbb852b1288 100644
@@ -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);
drivers/staging/r8188eu/os_dep/os_intfs.c +0 -2
index 306377fe8bfc..3367c7cfc033 100644
@@ -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 */
Signature · 1 line
2.20.1
#22 lore raw

Re: [PATCH v2 3/8] staging: r8188eu: _free_pwrlock is empty

Hi Martin,

drivers/staging/r8188eu/core/rtw_pwrctrl.c void rtw_init_pwrctrl_priv(struct adapter *padapter) · line 380

Quoted 7 lines · Martin Kaiser
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -7
-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

#23 lore raw

PATCH v2 4/8 staging: r8188eu: remove unused pwrctrl definitions

In reply to Martin Kaiser

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

---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 44 -------------------
 1 file changed, 44 deletions(-)
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -44
index edbb852b1288..fd9c054e2d5a 100644
@@ -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);
 
Signature · 1 line
2.20.1
#24 lore raw

PATCH v2 5/8 staging: r8188eu: remove unused enum and array

In reply to Martin Kaiser

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

---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 9 ---------
 1 file changed, 9 deletions(-)
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -9
index fd9c054e2d5a..c4f5cca8df08 100644
@@ -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) \
Signature · 1 line
2.20.1
#25 lore raw

PATCH v2 6/8 staging: r8188eu: rtw_set_ips_deny is not used

In reply to Martin Kaiser

Remove the rtw_set_ips_deny function since it's not used.

---
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(-)
drivers/staging/r8188eu/core/rtw_pwrctrl.c +0 -6
index 4500d60c3777..d901ac7aea4d 100644
@@ -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
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -1
index c4f5cca8df08..9e4b4eef4d27 100644
@@ -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)						\
Signature · 1 line
2.20.1
#26 lore raw

PATCH v2 7/8 staging: r8188eu: remove unused variable cpwm_tog

In reply to Martin Kaiser

cpwm_tog in struct pwrctrl_priv is not used. Remove it.

---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -1
index 9e4b4eef4d27..08d414aa9ef5 100644
@@ -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;
Signature · 1 line
2.20.1
#27 lore raw

PATCH v2 8/8 staging: r8188eu: remove unused variable b_hw_radio_off

In reply to Martin Kaiser

b_hw_radio_off in struct pwrctrl_priv is not used. Remove it.

---
v2:
- rebased against today's staging-testing branch

 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/include/rtw_pwrctrl.h +0 -1
index 08d414aa9ef5..28e4041acb98 100644
@@ -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;
Signature · 1 line
2.20.1
#28 lore raw
In reply to Martin Kaiser
Quoted 7 lines · 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

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