staging: rtl8192e: Remove NULL checks of function pointers - struct rtllib_device
cover staging: rtl8192e: Remove NULL checks of function pointers - struct rtllib_device
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(-)
Signature · 1 line
2.39.2
PATCH 1/4 staging: rtl8192e: Remove checks of pointer to handle_a.. and handle_b..
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.
--- drivers/staging/rtl8192e/rtllib_rx.c | 4 +--- drivers/staging/rtl8192e/rtllib_softmac.c | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +1 -3
@@ -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);
drivers/staging/rtl8192e/rtllib_softmac.c +2 -4
@@ -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);
Signature · 1 line
2.39.2
PATCH 2/4 staging: rtl8192e: Remove checks of pointer to LeisureP.. and start_se..
In reply to Philipp HortmannFunction 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.
--- 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(-)
drivers/staging/rtl8192e/rtllib_rx.c +1 -2
@@ -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); } } }
drivers/staging/rtl8192e/rtllib_softmac.c +1 -2
@@ -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); }
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1 -2
@@ -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 );
Signature · 1 line
2.39.2
PATCH 3/4 staging: rtl8192e: Remove checks of pointer to stop_send.. and rtllib_..
In reply to Philipp HortmannFunction 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.
--- drivers/staging/rtl8192e/rtllib_softmac.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/staging/rtl8192e/rtllib_softmac.c +3 -6
@@ -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 ; }
Signature · 1 line
2.39.2
PATCH 4/4 staging: rtl8192e: Remove checks of pointer to rtllib.. and ScanOpera..
In reply to Philipp HortmannFunction 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.
--- 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(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -2
@@ -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);
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +2 -6
@@ -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 {
drivers/staging/rtl8192e/rtllib_softmac.c +2 -4
@@ -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);
drivers/staging/rtl8192e/rtllib_softmac_wx.c +2 -4
@@ -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);
Signature · 1 line
2.39.2