diff mbox series

[1/2] wifi: rtlwifi: cleanup struct rtl_ps_ctl

Message ID 20231011154442.52457-1-dmantipov@yandex.ru
State New
Headers show
Series [1/2] wifi: rtlwifi: cleanup struct rtl_ps_ctl | expand

Commit Message

Dmitry Antipov Oct. 11, 2023, 3:44 p.m. UTC
Remove set but otherwise unused 'sleep_ms', 'last_action',
and 'last_slept' members of 'struct rtl_ps_ctl' (these
seems to be a leftovers from some older code) and adjust
'rtl_swlps_wq_callback()' accordingly.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 drivers/net/wireless/realtek/rtlwifi/ps.c   | 10 ----------
 drivers/net/wireless/realtek/rtlwifi/wifi.h |  3 ---
 2 files changed, 13 deletions(-)

Comments

Ping-Ke Shih Oct. 13, 2023, 8:11 a.m. UTC | #1
> -----Original Message-----
> From: Dmitry Antipov <dmantipov@yandex.ru>
> Sent: Wednesday, October 11, 2023 11:45 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org; Dmitry Antipov <dmantipov@yandex.ru>
> Subject: [PATCH 1/2] wifi: rtlwifi: cleanup struct rtl_ps_ctl
> 
> Remove set but otherwise unused 'sleep_ms', 'last_action',
> and 'last_slept' members of 'struct rtl_ps_ctl' (these
> seems to be a leftovers from some older code) and adjust
> 'rtl_swlps_wq_callback()' accordingly.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
>  drivers/net/wireless/realtek/rtlwifi/ps.c   | 10 ----------
>  drivers/net/wireless/realtek/rtlwifi/wifi.h |  3 ---
>  2 files changed, 13 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.c b/drivers/net/wireless/realtek/rtlwifi/ps.c
> index 629c03271bde..ba61fcec9fae 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/ps.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/ps.c
> @@ -688,16 +688,6 @@ void rtl_swlps_wq_callback(struct work_struct *work)
>         /* we can sleep after ps null send ok */
>         if (rtlpriv->psc.state_inap) {
>                 rtl_swlps_rf_sleep(hw);
> -
> -               if (rtlpriv->psc.state && !ps) {
> -                       rtlpriv->psc.sleep_ms = jiffies_to_msecs(jiffies -
> -                                                rtlpriv->psc.last_action);
> -               }
> -
> -               if (ps)
> -                       rtlpriv->psc.last_slept = jiffies;
> -
> -               rtlpriv->psc.last_action = jiffies;
>                 rtlpriv->psc.state = ps;

'state' is also unused. 

>         }
>  }
> diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
> index 47b4685b6d24..cabf6c82a639 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
> +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
> @@ -2037,14 +2037,11 @@ struct rtl_ps_ctl {
>         bool multi_buffered;
>         u16 nullfunc_seq;
>         unsigned int dtim_counter;
> -       unsigned int sleep_ms;
>         unsigned long last_sleep_jiffies;
>         unsigned long last_awake_jiffies;
>         unsigned long last_delaylps_stamp_jiffies;
>         unsigned long last_dtim;
>         unsigned long last_beacon;
> -       unsigned long last_action;
> -       unsigned long last_slept;
> 
>         /*For P2P PS */
>         struct rtl_p2p_ps_info p2p_ps_info;
> --
> 2.41.0
Ping-Ke Shih Oct. 13, 2023, 9:17 a.m. UTC | #2
> -----Original Message-----
> From: Dmitry Antipov <dmantipov@yandex.ru>
> Sent: Wednesday, October 11, 2023 11:45 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org; Dmitry Antipov <dmantipov@yandex.ru>
> Subject: [PATCH 2/2] wifi: rtlwifi: simplify TX command fill callbacks
> 
> Since 'rtlpriv->cfg->ops->fill_tx_cmddesc()' is always called
> with 'firstseg' and 'lastseg' set to 1 (and the latter is

The 'firstseg' is used to optimize the code if more than one segments.
However, I think rtlwifi will not support multiple segments in the future,
so changes in this patch would be fine. 

> never actually used), all of the relevant chip-specific
> routines may be simplified. Compile tested only.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.c b/drivers/net/wireless/realtek/rtlwifi/ps.c
index 629c03271bde..ba61fcec9fae 100644
--- a/drivers/net/wireless/realtek/rtlwifi/ps.c
+++ b/drivers/net/wireless/realtek/rtlwifi/ps.c
@@ -688,16 +688,6 @@  void rtl_swlps_wq_callback(struct work_struct *work)
 	/* we can sleep after ps null send ok */
 	if (rtlpriv->psc.state_inap) {
 		rtl_swlps_rf_sleep(hw);
-
-		if (rtlpriv->psc.state && !ps) {
-			rtlpriv->psc.sleep_ms = jiffies_to_msecs(jiffies -
-						 rtlpriv->psc.last_action);
-		}
-
-		if (ps)
-			rtlpriv->psc.last_slept = jiffies;
-
-		rtlpriv->psc.last_action = jiffies;
 		rtlpriv->psc.state = ps;
 	}
 }
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 47b4685b6d24..cabf6c82a639 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -2037,14 +2037,11 @@  struct rtl_ps_ctl {
 	bool multi_buffered;
 	u16 nullfunc_seq;
 	unsigned int dtim_counter;
-	unsigned int sleep_ms;
 	unsigned long last_sleep_jiffies;
 	unsigned long last_awake_jiffies;
 	unsigned long last_delaylps_stamp_jiffies;
 	unsigned long last_dtim;
 	unsigned long last_beacon;
-	unsigned long last_action;
-	unsigned long last_slept;
 
 	/*For P2P PS */
 	struct rtl_p2p_ps_info p2p_ps_info;