public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 0/4] staging: rtl8192e: Remove NULL checks of function pointers - struct rtllib_device
@ 2023-02-25 18:20 Philipp Hortmann
  2023-02-25 18:20 ` [PATCH 1/4] staging: rtl8192e: Remove checks of pointer to handle_a.. and handle_b Philipp Hortmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Philipp Hortmann @ 2023-02-25 18:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

Remove NULL checks of function pointers from struct rtllib_device. This
checks are unnecessary because the function pointers are set right when
the driver is loaded.

Here the flow when function pointers are set: 
.probe	= _rtl92e_pci_probe
In _rtl92e_pci_probe the function _rtl92e_init is called. In the second
line of _rtl92e_init is _rtl92e_init_priv_handler called that sets all
the required function calls.

Tested with rtl8192e
Transferred this patch over wlan connection of rtl8192e

This patch series requires the patch series:
"[PATCH 0/2] staging: rtl8192e: Remove struct rtl819x_ops that has no entries"

Philipp Hortmann (4):
  staging: rtl8192e: Remove checks of pointer to handle_a.. and
    handle_b..
  staging: rtl8192e: Remove checks of pointer to LeisureP.. and
    start_se..
  staging: rtl8192e: Remove checks of pointer to stop_send.. and
    rtllib_..
  staging: rtl8192e: Remove checks of pointer to rtllib.. and
    ScanOpera..

 drivers/staging/rtl8192e/rtl8192e/rtl_core.c |  3 +--
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c   |  8 ++-----
 drivers/staging/rtl8192e/rtllib_rx.c         |  7 ++----
 drivers/staging/rtl8192e/rtllib_softmac.c    | 24 +++++++-------------
 drivers/staging/rtl8192e/rtllib_softmac_wx.c |  9 +++-----
 5 files changed, 16 insertions(+), 35 deletions(-)

-- 
2.39.2


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

* [PATCH 1/4] staging: rtl8192e: Remove checks of pointer to handle_a.. and handle_b..
  2023-02-25 18:20 [PATCH 0/4] staging: rtl8192e: Remove NULL checks of function pointers - struct rtllib_device Philipp Hortmann
@ 2023-02-25 18:20 ` Philipp Hortmann
  2023-02-25 18:20 ` [PATCH 2/4] staging: rtl8192e: Remove checks of pointer to LeisureP.. and start_se Philipp Hortmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Philipp Hortmann @ 2023-02-25 18:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

Function pointers of handle_assoc_response and handle_beacon is set while
executing the probe function. Therefore a NULL pointer check is not
required. Remove checks as it is dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtllib_rx.c      | 4 +---
 drivers/staging/rtl8192e/rtllib_softmac.c | 6 ++----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 669e74a67190..35b36f7c0f28 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -2689,9 +2689,7 @@ static inline void rtllib_process_probe_response(
 	    is_same_network(&ieee->current_network, network,
 	    (network->ssid_len ? 1 : 0)) &&
 	    (ieee->state == RTLLIB_LINKED)) {
-		if (ieee->handle_beacon != NULL)
-			ieee->handle_beacon(ieee->dev, beacon,
-					    &ieee->current_network);
+		ieee->handle_beacon(ieee->dev, beacon, &ieee->current_network);
 	}
 free_network:
 	kfree(network);
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 2552aa089700..d697089e0cad 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -2241,10 +2241,8 @@ rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb,
 				memcpy(ieee->ht_info->PeerHTInfoBuf,
 				       network->bssht.bd_ht_info_buf,
 				       network->bssht.bd_ht_info_len);
-				if (ieee->handle_assoc_response != NULL)
-					ieee->handle_assoc_response(ieee->dev,
-						 (struct rtllib_assoc_response_frame *)header,
-						 network);
+				ieee->handle_assoc_response(ieee->dev,
+					(struct rtllib_assoc_response_frame *)header, network);
 			}
 			kfree(network);
 
-- 
2.39.2


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

* [PATCH 2/4] staging: rtl8192e: Remove checks of pointer to LeisureP.. and start_se..
  2023-02-25 18:20 [PATCH 0/4] staging: rtl8192e: Remove NULL checks of function pointers - struct rtllib_device Philipp Hortmann
  2023-02-25 18:20 ` [PATCH 1/4] staging: rtl8192e: Remove checks of pointer to handle_a.. and handle_b Philipp Hortmann
@ 2023-02-25 18:20 ` Philipp Hortmann
  2023-02-25 18:20 ` [PATCH 3/4] staging: rtl8192e: Remove checks of pointer to stop_send.. and rtllib_ Philipp Hortmann
  2023-02-25 18:20 ` [PATCH 4/4] staging: rtl8192e: Remove checks of pointer to rtllib.. and ScanOpera Philipp Hortmann
  3 siblings, 0 replies; 5+ messages in thread
From: Philipp Hortmann @ 2023-02-25 18:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

Function pointers of LeisurePSLeave and start_send_beacons is set while
executing the probe function. Therefore a NULL pointer check is not
required. Remove checks as it is dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtllib_rx.c         | 3 +--
 drivers/staging/rtl8192e/rtllib_softmac.c    | 3 +--
 drivers/staging/rtl8192e/rtllib_softmac_wx.c | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 35b36f7c0f28..c394c21beefb 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1214,8 +1214,7 @@ static void rtllib_rx_check_leave_lps(struct rtllib_device *ieee, u8 unicast,
 			if (((ieee->link_detect_info.NumRxUnicastOkInPeriod +
 			    ieee->link_detect_info.NumTxOkInPeriod) > 8) ||
 			    (ieee->link_detect_info.NumRxUnicastOkInPeriod > 2)) {
-				if (ieee->LeisurePSLeave)
-					ieee->LeisurePSLeave(ieee->dev);
+				ieee->LeisurePSLeave(ieee->dev);
 			}
 		}
 	}
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index d697089e0cad..b06baf5ff6d4 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -669,8 +669,7 @@ EXPORT_SYMBOL(rtllib_stop_send_beacons);
 
 void rtllib_start_send_beacons(struct rtllib_device *ieee)
 {
-	if (ieee->start_send_beacons)
-		ieee->start_send_beacons(ieee->dev);
+	ieee->start_send_beacons(ieee->dev);
 	if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
 		rtllib_beacons_start(ieee);
 }
diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
index 06f3d75dc102..f90764d1d9ab 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
@@ -340,8 +340,7 @@ void rtllib_wx_sync_scan_wq(void *data)
 
 	chan = ieee->current_network.channel;
 
-	if (ieee->LeisurePSLeave)
-		ieee->LeisurePSLeave(ieee->dev);
+	ieee->LeisurePSLeave(ieee->dev);
 	/* notify AP to be in PS mode */
 	rtllib_sta_ps_send_null_frame(ieee, 1);
 	rtllib_sta_ps_send_null_frame(ieee, 1);
-- 
2.39.2


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

* [PATCH 3/4] staging: rtl8192e: Remove checks of pointer to stop_send.. and rtllib_..
  2023-02-25 18:20 [PATCH 0/4] staging: rtl8192e: Remove NULL checks of function pointers - struct rtllib_device Philipp Hortmann
  2023-02-25 18:20 ` [PATCH 1/4] staging: rtl8192e: Remove checks of pointer to handle_a.. and handle_b Philipp Hortmann
  2023-02-25 18:20 ` [PATCH 2/4] staging: rtl8192e: Remove checks of pointer to LeisureP.. and start_se Philipp Hortmann
@ 2023-02-25 18:20 ` Philipp Hortmann
  2023-02-25 18:20 ` [PATCH 4/4] staging: rtl8192e: Remove checks of pointer to rtllib.. and ScanOpera Philipp Hortmann
  3 siblings, 0 replies; 5+ messages in thread
From: Philipp Hortmann @ 2023-02-25 18:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

Function pointers of stop_send_beacons and rtllib_ips_leave_wq is set
while executing the probe function. Therefore a NULL pointer check is
not required. Remove checks as it is dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtllib_softmac.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index b06baf5ff6d4..7b73c5df5e2a 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -659,8 +659,7 @@ static void rtllib_beacons_stop(struct rtllib_device *ieee)
 
 void rtllib_stop_send_beacons(struct rtllib_device *ieee)
 {
-	if (ieee->stop_send_beacons)
-		ieee->stop_send_beacons(ieee->dev);
+	ieee->stop_send_beacons(ieee->dev);
 	if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
 		rtllib_beacons_stop(ieee);
 }
@@ -728,8 +727,7 @@ EXPORT_SYMBOL(rtllib_act_scanning);
 /* called with ieee->lock held */
 static void rtllib_start_scan(struct rtllib_device *ieee)
 {
-	if (ieee->rtllib_ips_leave_wq != NULL)
-		ieee->rtllib_ips_leave_wq(ieee->dev);
+	ieee->rtllib_ips_leave_wq(ieee->dev);
 
 	if (IS_DOT11D_ENABLE(ieee)) {
 		if (IS_COUNTRY_IE_VALID(ieee))
@@ -1584,8 +1582,7 @@ static void rtllib_associate_procedure_wq(void *data)
 	rtllib_stop_scan(ieee);
 	HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
 	if (ieee->rf_power_state == rf_off) {
-		if (ieee->rtllib_ips_leave_wq != NULL)
-			ieee->rtllib_ips_leave_wq(ieee->dev);
+		ieee->rtllib_ips_leave_wq(ieee->dev);
 		mutex_unlock(&ieee->wx_mutex);
 		return;
 	}
-- 
2.39.2


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

* [PATCH 4/4] staging: rtl8192e: Remove checks of pointer to rtllib.. and ScanOpera..
  2023-02-25 18:20 [PATCH 0/4] staging: rtl8192e: Remove NULL checks of function pointers - struct rtllib_device Philipp Hortmann
                   ` (2 preceding siblings ...)
  2023-02-25 18:20 ` [PATCH 3/4] staging: rtl8192e: Remove checks of pointer to stop_send.. and rtllib_ Philipp Hortmann
@ 2023-02-25 18:20 ` Philipp Hortmann
  3 siblings, 0 replies; 5+ messages in thread
From: Philipp Hortmann @ 2023-02-25 18:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

Function pointers of rtllib_ips_leave and ScanOperationBackupHandler is
set while executing the probe function. Therefore a NULL pointer check is
not required. Remove checks as it is dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +--
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c   | 8 ++------
 drivers/staging/rtl8192e/rtllib_softmac.c    | 6 ++----
 drivers/staging/rtl8192e/rtllib_softmac_wx.c | 6 ++----
 4 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 718d69b4ce16..47feb4248d25 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -703,8 +703,7 @@ static int _rtl92e_sta_down(struct net_device *dev, bool shutdownrf)
 	if (priv->up == 0)
 		return -1;
 
-	if (priv->rtllib->rtllib_ips_leave)
-		priv->rtllib->rtllib_ips_leave(dev);
+	priv->rtllib->rtllib_ips_leave(dev);
 
 	if (priv->rtllib->state == RTLLIB_LINKED)
 		rtl92e_leisure_ps_leave(dev);
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index bf0030144e5d..cb28288a618b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -432,15 +432,11 @@ static int _rtl92e_wx_set_scan(struct net_device *dev,
 		if (priv->rtllib->rf_power_state != rf_off) {
 			priv->rtllib->actscanning = true;
 
-			if (ieee->ScanOperationBackupHandler)
-				ieee->ScanOperationBackupHandler(ieee->dev,
-							 SCAN_OPT_BACKUP);
+			ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_BACKUP);
 
 			rtllib_start_scan_syncro(priv->rtllib, 0);
 
-			if (ieee->ScanOperationBackupHandler)
-				ieee->ScanOperationBackupHandler(ieee->dev,
-							 SCAN_OPT_RESTORE);
+			ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_RESTORE);
 		}
 		ret = 0;
 	} else {
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 7b73c5df5e2a..4923423aa85b 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -1572,8 +1572,7 @@ static void rtllib_associate_procedure_wq(void *data)
 				     struct rtllib_device,
 				     associate_procedure_wq);
 	rtllib_stop_scan_syncro(ieee);
-	if (ieee->rtllib_ips_leave != NULL)
-		ieee->rtllib_ips_leave(ieee->dev);
+	ieee->rtllib_ips_leave(ieee->dev);
 	mutex_lock(&ieee->wx_mutex);
 
 	if (ieee->data_hard_stop)
@@ -2850,8 +2849,7 @@ void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown)
 	if (shutdown) {
 		ieee->proto_started = 0;
 		ieee->proto_stoppping = 1;
-		if (ieee->rtllib_ips_leave != NULL)
-			ieee->rtllib_ips_leave(ieee->dev);
+		ieee->rtllib_ips_leave(ieee->dev);
 	}
 
 	rtllib_stop_send_beacons(ieee);
diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
index f90764d1d9ab..06f1d6de5cc7 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
@@ -355,8 +355,7 @@ void rtllib_wx_sync_scan_wq(void *data)
 	/* wait for ps packet to be kicked out successfully */
 	msleep(50);
 
-	if (ieee->ScanOperationBackupHandler)
-		ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_BACKUP);
+	ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_BACKUP);
 
 	if (ieee->ht_info->bCurrentHTSupport && ieee->ht_info->enable_ht &&
 	    ieee->ht_info->bCurBW40MHz) {
@@ -381,8 +380,7 @@ void rtllib_wx_sync_scan_wq(void *data)
 		ieee->set_chan(ieee->dev, chan);
 	}
 
-	if (ieee->ScanOperationBackupHandler)
-		ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_RESTORE);
+	ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_RESTORE);
 
 	ieee->state = RTLLIB_LINKED;
 	ieee->link_change(ieee->dev);
-- 
2.39.2


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

end of thread, other threads:[~2023-02-25 18:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-25 18:20 [PATCH 0/4] staging: rtl8192e: Remove NULL checks of function pointers - struct rtllib_device Philipp Hortmann
2023-02-25 18:20 ` [PATCH 1/4] staging: rtl8192e: Remove checks of pointer to handle_a.. and handle_b Philipp Hortmann
2023-02-25 18:20 ` [PATCH 2/4] staging: rtl8192e: Remove checks of pointer to LeisureP.. and start_se Philipp Hortmann
2023-02-25 18:20 ` [PATCH 3/4] staging: rtl8192e: Remove checks of pointer to stop_send.. and rtllib_ Philipp Hortmann
2023-02-25 18:20 ` [PATCH 4/4] staging: rtl8192e: Remove checks of pointer to rtllib.. and ScanOpera Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox