linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] wifi: rtlwifi: more cleanup for struct rtl_hal
@ 2023-11-13 14:47 Dmitry Antipov
  2023-11-13 14:47 ` [PATCH 2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start() Dmitry Antipov
  2023-11-17  3:05 ` [PATCH 1/2] wifi: rtlwifi: more cleanup for struct rtl_hal Ping-Ke Shih
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Antipov @ 2023-11-13 14:47 UTC (permalink / raw)
  To: Ping-Ke Shih; +Cc: Kalle Valo, linux-wireless, lvc-project, Dmitry Antipov

Following commit d1e6b020c32d ("wifi: rtlwifi: cleanup struct rtl_hal"),
remove unused 'hal_coex_8723', 'current_bandtypebackup', 'master_of_dmsp'
and 'slave_of_dmsp' members of 'struct rtl_hal' as well. Compile tested
only.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 drivers/net/wireless/realtek/rtlwifi/wifi.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 171a461cd812..33c3e001266f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -1605,7 +1605,6 @@ struct rtl_hal {
 	bool being_init_adapter;
 	bool mac_func_enable;
 	bool pre_edcca_enable;
-	struct bt_coexist_8723 hal_coex_8723;
 
 	enum intf_type interface;
 	u16 hw_type;		/*92c or 92d or 92s and so on */
@@ -1660,7 +1659,6 @@ struct rtl_hal {
 	/* Dual mac */
 	enum macphy_mode macphymode;
 	enum band_type current_bandtype;	/* 0:2.4G, 1:5G */
-	enum band_type current_bandtypebackup;
 	enum band_type bandset;
 	/* dual MAC 0--Mac0 1--Mac1 */
 	u32 interfaceindex;
@@ -1678,8 +1676,6 @@ struct rtl_hal {
 	bool load_imrandiqk_setting_for2g;
 
 	bool disable_amsdu_8k;
-	bool master_of_dmsp;
-	bool slave_of_dmsp;
 
 	/*for wowlan*/
 	bool enter_pnp_sleep;
-- 
2.41.0


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

* [PATCH 2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start()
  2023-11-13 14:47 [PATCH 1/2] wifi: rtlwifi: more cleanup for struct rtl_hal Dmitry Antipov
@ 2023-11-13 14:47 ` Dmitry Antipov
  2023-11-17  3:37   ` Ping-Ke Shih
  2023-11-22 15:02   ` Kalle Valo
  2023-11-17  3:05 ` [PATCH 1/2] wifi: rtlwifi: more cleanup for struct rtl_hal Ping-Ke Shih
  1 sibling, 2 replies; 5+ messages in thread
From: Dmitry Antipov @ 2023-11-13 14:47 UTC (permalink / raw)
  To: Ping-Ke Shih; +Cc: Kalle Valo, linux-wireless, lvc-project, Dmitry Antipov

Since 'drv_priv' is an in-place member allocated at the end of
'struct ieee80211_sta', it can't be NULL and so relevant checks
in 'rtl_action_proc()' and 'rtl_tx_agg_start()' may be dropped.
Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 drivers/net/wireless/realtek/rtlwifi/base.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
index 7ce37fb4fdbf..1a8d715b7c07 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -1402,10 +1402,6 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
 
 				sta_entry =
 					(struct rtl_sta_info *)sta->drv_priv;
-				if (!sta_entry) {
-					rcu_read_unlock();
-					return true;
-				}
 				capab =
 				  le16_to_cpu(mgmt->u.action.u.addba_req.capab);
 				tid = (capab &
@@ -1760,8 +1756,6 @@ int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		return -EINVAL;
 
 	sta_entry = (struct rtl_sta_info *)sta->drv_priv;
-	if (!sta_entry)
-		return -ENXIO;
 	tid_data = &sta_entry->tids[tid];
 
 	rtl_dbg(rtlpriv, COMP_SEND, DBG_DMESG,
@@ -1818,8 +1812,6 @@ int rtl_rx_agg_start(struct ieee80211_hw *hw,
 	}
 
 	sta_entry = (struct rtl_sta_info *)sta->drv_priv;
-	if (!sta_entry)
-		return -ENXIO;
 	tid_data = &sta_entry->tids[tid];
 
 	rtl_dbg(rtlpriv, COMP_RECV, DBG_DMESG,
-- 
2.41.0


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

* RE: [PATCH 1/2] wifi: rtlwifi: more cleanup for struct rtl_hal
  2023-11-13 14:47 [PATCH 1/2] wifi: rtlwifi: more cleanup for struct rtl_hal Dmitry Antipov
  2023-11-13 14:47 ` [PATCH 2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start() Dmitry Antipov
@ 2023-11-17  3:05 ` Ping-Ke Shih
  1 sibling, 0 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2023-11-17  3:05 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Kalle Valo, linux-wireless, lvc-project



> -----Original Message-----
> From: Dmitry Antipov <dmantipov@yandex.ru>
> Sent: Monday, November 13, 2023 10:47 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org; lvc-project@linuxtesting.org; Dmitry
> Antipov <dmantipov@yandex.ru>
> Subject: [PATCH 1/2] wifi: rtlwifi: more cleanup for struct rtl_hal
> 
> Following commit d1e6b020c32d ("wifi: rtlwifi: cleanup struct rtl_hal"),
> remove unused 'hal_coex_8723', 'current_bandtypebackup', 'master_of_dmsp'
> and 'slave_of_dmsp' members of 'struct rtl_hal' as well. Compile tested
> only.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
>  drivers/net/wireless/realtek/rtlwifi/wifi.h | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
> index 171a461cd812..33c3e001266f 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
> +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
> @@ -1605,7 +1605,6 @@ struct rtl_hal {
>         bool being_init_adapter;
>         bool mac_func_enable;
>         bool pre_edcca_enable;
> -       struct bt_coexist_8723 hal_coex_8723;

In drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c, it does a global
static variable:
   static struct bt_coexist_8723 hal_coex_8723;

That's not a good practice. It would be better to use the field you are removing.
To prevent wasting space, we can dynamically allocate the space when 8723AE
is presented only.

Note, I don't have this old module 8723AE, so even you achieve the patch, 
I can't test it on a real hardware. 



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

* RE: [PATCH 2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start()
  2023-11-13 14:47 ` [PATCH 2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start() Dmitry Antipov
@ 2023-11-17  3:37   ` Ping-Ke Shih
  2023-11-22 15:02   ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2023-11-17  3:37 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Kalle Valo, linux-wireless, lvc-project



> -----Original Message-----
> From: Dmitry Antipov <dmantipov@yandex.ru>
> Sent: Monday, November 13, 2023 10:48 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org; lvc-project@linuxtesting.org; Dmitry
> Antipov <dmantipov@yandex.ru>
> Subject: [PATCH 2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start()
> 
> Since 'drv_priv' is an in-place member allocated at the end of
> 'struct ieee80211_sta', it can't be NULL and so relevant checks
> in 'rtl_action_proc()' and 'rtl_tx_agg_start()' may be dropped.
> Compile tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

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



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

* Re: [PATCH 2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start()
  2023-11-13 14:47 ` [PATCH 2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start() Dmitry Antipov
  2023-11-17  3:37   ` Ping-Ke Shih
@ 2023-11-22 15:02   ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2023-11-22 15:02 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Ping-Ke Shih, linux-wireless, lvc-project, Dmitry Antipov

Dmitry Antipov <dmantipov@yandex.ru> wrote:

> Since 'drv_priv' is an in-place member allocated at the end of
> 'struct ieee80211_sta', it can't be NULL and so relevant checks
> in 'rtl_action_proc()' and 'rtl_tx_agg_start()' may be dropped.
> Compile tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

2c4e9acbe3a5 wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20231113144734.197359-2-dmantipov@yandex.ru/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2023-11-22 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 14:47 [PATCH 1/2] wifi: rtlwifi: more cleanup for struct rtl_hal Dmitry Antipov
2023-11-13 14:47 ` [PATCH 2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start() Dmitry Antipov
2023-11-17  3:37   ` Ping-Ke Shih
2023-11-22 15:02   ` Kalle Valo
2023-11-17  3:05 ` [PATCH 1/2] wifi: rtlwifi: more cleanup for struct rtl_hal Ping-Ke Shih

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