staging: rtl8723bs: coding style and refactoring cleanups
v6 cover staging: rtl8723bs: coding style and refactoring cleanups
This patch series performs minor refactoring and coding style cleanups across the rtl8723bs driver, addressing checkpatch.pl warnings.
---
Changelog:
v5 -> v6: Split LinkDetectInfo renaming and adddress checkpatch issues in separate patches.
v4 -> v5: Rebased onto current staging-testing.
v3 -> v4: Updated rename scope, cleaned up formatting, comments, and parentheses.
v2 -> v3: Resubmitted as a versioned series to avoid threading confusion. v1 -> v2: Fixed incorrect commit messages.
Khushal Chitturi (4):
staging: rtl8723bs: rename LinkDetectInfo and clean up related code
staging: rtl8723bs: convert traffic status variables to bool
staging: rtl8723bs: simplify boolean expressions
staging: rtl8723bs: fix line length and alignment issues
drivers/staging/rtl8723bs/core/rtw_cmd.c | 104 ++++++------ .../staging/rtl8723bs/core/rtw_ioctl_set.c | 66 ++++---- drivers/staging/rtl8723bs/core/rtw_mlme.c | 21 ++- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 10 +- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 2 +- drivers/staging/rtl8723bs/core/rtw_recv.c | 4 +- drivers/staging/rtl8723bs/core/rtw_xmit.c | 149 +++++++++++------- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 6 +- .../staging/rtl8723bs/hal/rtl8723bs_xmit.c | 4 +- drivers/staging/rtl8723bs/include/rtw_mlme.h | 31 ++-- .../staging/rtl8723bs/include/rtw_mlme_ext.h | 2 +- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 16 +- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 8 +- 13 files changed, 230 insertions(+), 193 deletions(-)
Signature · 1 line
2.52.0
PATCH v6 1/4 staging: rtl8723bs: rename LinkDetectInfo and clean up related code
This patch renames LinkDetectInfo instance to link_detect_info and update the fields of rt_link_detect_t to follow kernel naming conventions. Local variables in traffic_status_watchdog were also updated for consistency.
---
Changelog:
v5 -> v6: Limited the changes to LinkDetectInfo renaming. v4 -> v5: Rebased onto current staging-testing.
v3 -> v4: Narrow rename scope to affect link detection, and adjusted formatting.
v2 -> v3: Resubmitted as a versioned series.
v1 -> v2: Corrected commit messages.
drivers/staging/rtl8723bs/core/rtw_cmd.c | 102 ++++++++++-------- .../staging/rtl8723bs/core/rtw_ioctl_set.c | 9 +- drivers/staging/rtl8723bs/core/rtw_mlme.c | 16 +-- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 10 +- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 2 +- drivers/staging/rtl8723bs/core/rtw_recv.c | 4 +- drivers/staging/rtl8723bs/core/rtw_xmit.c | 2 +- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 6 +- .../staging/rtl8723bs/hal/rtl8723bs_xmit.c | 4 +- drivers/staging/rtl8723bs/include/rtw_mlme.h | 31 +++--- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 +- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 8 +- 12 files changed, 105 insertions(+), 91 deletions(-)
drivers/staging/rtl8723bs/core/rtw_cmd.c +55 -47
@@ -1130,12 +1130,16 @@ static void collect_traffic_statistics(struct adapter *padapter)u8 traffic_status_watchdog (struct adapter *padapter,u8 from_timer) { -u8 bEnterPS = false; -u16 BusyThresholdHigh =25 ; -u16 BusyThresholdLow =10 ; -u16 BusyThreshold = BusyThresholdHigh; -u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false; -u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false; +u8 should_enter_ps = false; +u16 busy_threshold_high =25 ; +u16 busy_threshold_low =10 ; +u16 busy_threshold = busy_threshold_high; +u8 busy_traffic = false; +u8 tx_busy_traffic = false; +u8 rx_busy_traffic = false; +u8 higher_busy_traffic = false; +u8 higher_busy_rx_traffic = false; +u8 higher_busy_tx_traffic = false;struct mlme_priv *pmlmepriv = &padapter->mlmepriv;collect_traffic_statistics (padapter);
@@ -1145,57 +1149,61 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)/* */ if ((check_fwstate (pmlmepriv, _FW_LINKED))/*&& !MgntInitAdapterInProgress(pMgntInfo)*/ ) { -/* if we raise bBusyTraffic in last watchdog, using lower threshold. */ -if (pmlmepriv->LinkDetectInfo.bBusyTraffic) - BusyThreshold = BusyThresholdLow; +/* if we raise busy_traffic in last watchdog, using lower threshold. */ +if (pmlmepriv->link_detect_info.busy_traffic) + busy_threshold = busy_threshold_low; -if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold || - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold) { - bBusyTraffic = true; +if (pmlmepriv->link_detect_info.num_rx_ok_in_period > busy_threshold || + pmlmepriv->link_detect_info.num_tx_ok_in_period > busy_threshold) { + busy_traffic = true; -if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) - bRxBusyTraffic = true; +if (pmlmepriv->link_detect_info.num_rx_ok_in_period > + pmlmepriv->link_detect_info.num_tx_ok_in_period) + rx_busy_traffic = true;else - bTxBusyTraffic = true; + tx_busy_traffic = true; }/* Higher Tx/Rx data. */ -if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod >4000 || - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod >4000 ) { - bHigherBusyTraffic = true; +if (pmlmepriv->link_detect_info.num_rx_ok_in_period >4000 || + pmlmepriv->link_detect_info.num_tx_ok_in_period >4000 ) { + higher_busy_traffic = true; -if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) - bHigherBusyRxTraffic = true; +if (pmlmepriv->link_detect_info.num_rx_ok_in_period > + pmlmepriv->link_detect_info.num_tx_ok_in_period) + higher_busy_rx_traffic = true;else - bHigherBusyTxTraffic = true; + higher_busy_tx_traffic = true; }/* check traffic for powersaving. */ -if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) >8 ) || - (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod >2 )) { - bEnterPS = false; +if ((pmlmepriv->link_detect_info.num_rx_unicast_ok_in_period + + pmlmepriv->link_detect_info.num_tx_ok_in_period) >8 || + pmlmepriv->link_detect_info.num_rx_unicast_ok_in_period >2 ) { + should_enter_ps = false; -if (bBusyTraffic) { -if (pmlmepriv->LinkDetectInfo.TrafficTransitionCount <=4 ) - pmlmepriv->LinkDetectInfo.TrafficTransitionCount =4 ; +if (busy_traffic) { +if (pmlmepriv->link_detect_info.traffic_transition_count <=4 ) + pmlmepriv->link_detect_info.traffic_transition_count =4 ; - pmlmepriv->LinkDetectInfo.TrafficTransitionCount++; + pmlmepriv->link_detect_info.traffic_transition_count++; -if (pmlmepriv->LinkDetectInfo.TrafficTransitionCount >30 /*TrafficTransitionLevel*/ ) - pmlmepriv->LinkDetectInfo.TrafficTransitionCount =30 ; +/* Check if traffic transition count exceeds the threshold */ +if (pmlmepriv->link_detect_info.traffic_transition_count >30 ) + pmlmepriv->link_detect_info.traffic_transition_count =30 ; } }else { -if (pmlmepriv->LinkDetectInfo.TrafficTransitionCount >=2 ) - pmlmepriv->LinkDetectInfo.TrafficTransitionCount -=2 ; +if (pmlmepriv->link_detect_info.traffic_transition_count >=2 ) + pmlmepriv->link_detect_info.traffic_transition_count -=2 ;else - pmlmepriv->LinkDetectInfo.TrafficTransitionCount =0 ; + pmlmepriv->link_detect_info.traffic_transition_count =0 ; -if (pmlmepriv->LinkDetectInfo.TrafficTransitionCount ==0 ) - bEnterPS = true; +if (pmlmepriv->link_detect_info.traffic_transition_count ==0 ) + should_enter_ps = true; }/* LeisurePS only work in infra mode. */ -if (bEnterPS) { +if (should_enter_ps) {if (!from_timer)LPS_Enter (padapter,"TRAFFIC_IDLE" ); }else {
@@ -1215,17 +1223,17 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)LPS_Leave (padapter,"NON_LINKED" ); } - pmlmepriv->LinkDetectInfo.NumRxOkInPeriod =0 ; - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod =0 ; - pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod =0 ; - pmlmepriv->LinkDetectInfo.bBusyTraffic = bBusyTraffic; - pmlmepriv->LinkDetectInfo.bTxBusyTraffic = bTxBusyTraffic; - pmlmepriv->LinkDetectInfo.bRxBusyTraffic = bRxBusyTraffic; - pmlmepriv->LinkDetectInfo.bHigherBusyTraffic = bHigherBusyTraffic; - pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic = bHigherBusyRxTraffic; - pmlmepriv->LinkDetectInfo.bHigherBusyTxTraffic = bHigherBusyTxTraffic; - -return bEnterPS; + pmlmepriv->link_detect_info.num_rx_ok_in_period =0 ; + pmlmepriv->link_detect_info.num_tx_ok_in_period =0 ; + pmlmepriv->link_detect_info.num_rx_unicast_ok_in_period =0 ; + pmlmepriv->link_detect_info.busy_traffic = busy_traffic; + pmlmepriv->link_detect_info.tx_busy_traffic = tx_busy_traffic; + pmlmepriv->link_detect_info.rx_busy_traffic = rx_busy_traffic; + pmlmepriv->link_detect_info.higher_busy_traffic = higher_busy_traffic; + pmlmepriv->link_detect_info.higher_busy_rx_traffic = higher_busy_rx_traffic; + pmlmepriv->link_detect_info.higher_busy_tx_traffic = higher_busy_tx_traffic; + +return should_enter_ps; }static void dynamic_chk_wk_hdl (struct adapter *padapter)
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c +4 -5
@@ -61,7 +61,7 @@ u8 rtw_do_join(struct adapter *padapter)/* when set_ssid/set_bssid for rtw_do_join(), but scanning queue is empty */ /* we try to issue sitesurvey firstly */ -if (pmlmepriv->LinkDetectInfo.bBusyTraffic == false +if (pmlmepriv->link_detect_info.busy_traffic == false ||rtw_to_roam (padapter) >0 ) {/* submit site_survey_cmd */
@@ -113,9 +113,8 @@ u8 rtw_do_join(struct adapter *padapter)/* when set_ssid/set_bssid for rtw_do_join(), but there are no desired bss in scanning queue */ /* we try to issue sitesurvey firstly */ -if (pmlmepriv->LinkDetectInfo.bBusyTraffic == false - ||rtw_to_roam (padapter) >0 - ) { +if (pmlmepriv->link_detect_info.busy_traffic == false || +rtw_to_roam (padapter) >0 ) { ret =rtw_sitesurvey_cmd (padapter, &pmlmepriv->assoc_ssid,1 ,NULL ,0 );if (ret != _SUCCESS) pmlmepriv->to_join = false;
@@ -380,7 +379,7 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s }if ((check_fwstate (pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true) || - (pmlmepriv->LinkDetectInfo.bBusyTraffic == true)) { + (pmlmepriv->link_detect_info.busy_traffic == true)) {/* Scan or linking is in progress, do nothing. */ res = true;
drivers/staging/rtl8723bs/core/rtw_mlme.c +8 -8
@@ -1185,8 +1185,8 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)spin_lock_bh (&pmlmepriv->lock); - pmlmepriv->LinkDetectInfo.TrafficTransitionCount =0 ; - pmlmepriv->LinkDetectInfo.LowPowerTransitionCount =0 ; + pmlmepriv->link_detect_info.traffic_transition_count =0 ; + pmlmepriv->link_detect_info.low_power_transition_count =0 ;if (pnetwork->join_res >0 ) {spin_lock_bh (&pmlmepriv->scanned_queue.lock);
@@ -1627,7 +1627,7 @@ static void rtw_auto_scan_handler(struct adapter *padapter)if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING)) goto exit; -if (pmlmepriv->LinkDetectInfo.bBusyTraffic) +if (pmlmepriv->link_detect_info.busy_traffic) goto exit; }
@@ -1655,12 +1655,12 @@ void rtw_dynamic_check_timer_handler(struct adapter *adapter)if ((adapter_to_pwrctl (adapter)->fw_current_in_ps_mode) && !(hal_btcoex_IsBtControlLps (adapter)) ) { -u8 bEnterPS; +u8 should_enter_ps;linked_status_chk (adapter); - bEnterPS =traffic_status_watchdog (adapter,1 ); -if (bEnterPS) { + should_enter_ps =traffic_status_watchdog (adapter,1 ); +if (should_enter_ps) {/* rtw_lps_ctrl_wk_cmd(adapter, LPS_CTRL_ENTER, 1); */ rtw_hal_dm_watchdog_in_lps (adapter); }else {
@@ -2517,8 +2517,8 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfrstruct pkt_attrib *pattrib = &pxmitframe->attrib;s32 bmcst =is_multicast_ether_addr (pattrib->ra); -/* if (bmcst || (padapter->mlmepriv.LinkDetectInfo.bTxBusyTraffic == false)) */ -if (bmcst || (padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod <100 )) +/* if (bmcst || (padapter->mlmepriv.link_detect_info.tx_busy_traffic == false)) */ +if (bmcst || padapter->mlmepriv.link_detect_info.num_tx_ok_in_period <100 )return ; priority = pattrib->priority;
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +5 -5
@@ -1522,7 +1522,7 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame)if (ignore_received_deauth ==0 )receive_disconnect (padapter,GetAddr3Ptr (pframe), reason); - pmlmepriv->LinkDetectInfo.bBusyTraffic = false; + pmlmepriv->link_detect_info.busy_traffic = false;return _SUCCESS; }
@@ -1574,7 +1574,7 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame)receive_disconnect (padapter,GetAddr3Ptr (pframe), reason); - pmlmepriv->LinkDetectInfo.bBusyTraffic = false; + pmlmepriv->link_detect_info.busy_traffic = false;return _SUCCESS; }
@@ -4776,9 +4776,9 @@ static void rtw_mlmeext_disconnect(struct adapter *padapter)timer_delete_sync (&pmlmeext->link_timer); -/* pmlmepriv->LinkDetectInfo.TrafficBusyState = false; */ - pmlmepriv->LinkDetectInfo.TrafficTransitionCount =0 ; - pmlmepriv->LinkDetectInfo.LowPowerTransitionCount =0 ; +/* pmlmepriv->link_detect_info.TrafficBusyState = false; */ + pmlmepriv->link_detect_info.traffic_transition_count =0 ; + pmlmepriv->link_detect_info.low_power_transition_count =0 ; }
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +1 -1
@@ -210,7 +210,7 @@ void traffic_check_for_leave_lps(struct adapter *padapter, u8 tx, u32 tx_packets } }else {/* from rx path */ -if (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod >4 /*2*/ ) { +if (pmlmepriv->link_detect_info.num_rx_unicast_ok_in_period >4 /*2*/ ) {if (adapter_to_pwrctl (padapter)->bLeisurePs && (adapter_to_pwrctl (padapter)->pwr_mode !=PS_MODE_ACTIVE ) && !(hal_btcoex_IsBtControlLps (padapter)))
drivers/staging/rtl8723bs/core/rtw_recv.c +2 -2
@@ -680,10 +680,10 @@ static void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, sz =get_recvframe_len (prframe); precvpriv->rx_bytes += sz; - padapter->mlmepriv.LinkDetectInfo.NumRxOkInPeriod++; + padapter->mlmepriv.link_detect_info.num_rx_ok_in_period++;if ((!is_broadcast_ether_addr (pattrib->dst)) && (!is_multicast_ether_addr (pattrib->dst))) - padapter->mlmepriv.LinkDetectInfo.NumRxUnicastOkInPeriod++; + padapter->mlmepriv.link_detect_info.num_rx_unicast_ok_in_period++;if (sta) psta = sta;
drivers/staging/rtl8723bs/core/rtw_xmit.c +1 -1
@@ -1390,7 +1390,7 @@ void rtw_count_tx_stats(struct adapter *padapter, struct xmit_frame *pxmitframe,if ((pxmitframe->frame_tag &0x0f ) ==DATA_FRAMETAG ) { pkt_num = pxmitframe->agg_num; - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod += pkt_num; + pmlmepriv->link_detect_info.num_tx_ok_in_period += pkt_num; pxmitpriv->tx_pkts += pkt_num;
drivers/staging/rtl8723bs/hal/hal_btcoex.c +3 -3
@@ -167,7 +167,7 @@ static u8 halbtcoutsrc_IsWifiBusy(struct adapter *padapter)if (check_fwstate (pmlmepriv,WIFI_ASOC_STATE ) == true) {if (check_fwstate (pmlmepriv,WIFI_AP_STATE ) == true)return true; -if (pmlmepriv->LinkDetectInfo.bBusyTraffic) +if (pmlmepriv->link_detect_info.busy_traffic)return true; }
@@ -364,9 +364,9 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf)case BTC_GET_U4_WIFI_TRAFFIC_DIRECTION : {struct rt_link_detect_t *plinkinfo; - plinkinfo = &padapter->mlmepriv.LinkDetectInfo; + plinkinfo = &padapter->mlmepriv.link_detect_info; -if (plinkinfo->NumTxOkInPeriod > plinkinfo->NumRxOkInPeriod) +if (plinkinfo->num_tx_ok_in_period > plinkinfo->num_rx_ok_in_period) *pU4Tmp =BTC_WIFI_TRAFFIC_TX ;else *pU4Tmp =BTC_WIFI_TRAFFIC_RX ;
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +2 -2
@@ -202,7 +202,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitprivif ( (check_pending_xmitbuf (pxmitpriv)) && - (padapter->mlmepriv.LinkDetectInfo.bHigherBusyTxTraffic) + (padapter->mlmepriv.link_detect_info.higher_busy_tx_traffic) ) {if ((phwxmit->accnt >0 ) && (phwxmit->accnt <5 )) { err =-2 ;
@@ -482,7 +482,7 @@ s32 rtl8723bs_hal_xmit( (pxmitframe->attrib.ether_type != 0x888e) && (pxmitframe->attrib.dhcp_pkt != 1) ) { -if (padapter->mlmepriv.LinkDetectInfo.bBusyTraffic) +if (padapter->mlmepriv.link_detect_info.busy_traffic)rtw_issue_addbareq_cmd (padapter, pxmitframe); }
drivers/staging/rtl8723bs/include/rtw_mlme.h +19 -12
@@ -93,18 +93,25 @@ struct sitesurvey_ctrl { };struct rt_link_detect_t { -u32 NumTxOkInPeriod; -u32 NumRxOkInPeriod; -u32 NumRxUnicastOkInPeriod; -bool bBusyTraffic; -bool bTxBusyTraffic; -bool bRxBusyTraffic; -bool bHigherBusyTraffic;/* For interrupt migration purpose. */ -bool bHigherBusyRxTraffic;/* We may disable Tx interrupt according as Rx traffic. */ -bool bHigherBusyTxTraffic;/* We may disable Tx interrupt according as Tx traffic. */ +u32 num_tx_ok_in_period; +u32 num_rx_ok_in_period; +u32 num_rx_unicast_ok_in_period; +bool busy_traffic; +bool tx_busy_traffic; +bool rx_busy_traffic; + +/* For interrupt migration purpose. */ +bool higher_busy_traffic; + +/* We may disable Tx interrupt according as Rx traffic. */ +bool higher_busy_rx_traffic; + +/* We may disable Tx interrupt according as Tx traffic. */ +bool higher_busy_tx_traffic; +/* u8 TrafficBusyState; */ -u8 TrafficTransitionCount; -u32 LowPowerTransitionCount; +u8 traffic_transition_count; +u32 low_power_transition_count; };/* used for mlme_priv.roam_flags */
@@ -171,7 +178,7 @@ struct mlme_priv {struct ht_priv htpriv; -struct rt_link_detect_t LinkDetectInfo; +struct rt_link_detect_t link_detect_info;struct timer_list dynamic_chk_timer;/* dynamic/periodic check timer */ u8 acm_mask;/* for wmm acm mask */
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +1 -1
@@ -1232,7 +1232,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy goto check_need_indicate_scan_done; } -if (pmlmepriv->LinkDetectInfo.bBusyTraffic == true) { +if (pmlmepriv->link_detect_info.busy_traffic == true) {static unsigned long lastscantime;unsigned long passtime;
drivers/staging/rtl8723bs/os_dep/os_intfs.c +4 -4
@@ -606,11 +606,11 @@ void rtw_reset_drv_sw(struct adapter *padapter) padapter->xmitpriv.tx_pkts =0 ; padapter->recvpriv.rx_pkts =0 ; - pmlmepriv->LinkDetectInfo.bBusyTraffic = false; + pmlmepriv->link_detect_info.busy_traffic = false; -/* pmlmepriv->LinkDetectInfo.TrafficBusyState = false; */ - pmlmepriv->LinkDetectInfo.TrafficTransitionCount =0 ; - pmlmepriv->LinkDetectInfo.LowPowerTransitionCount =0 ; +/* pmlmepriv->link_detect_info.TrafficBusyState = false; */ + pmlmepriv->link_detect_info.traffic_transition_count =0 ; + pmlmepriv->link_detect_info.low_power_transition_count =0 ;_clr_fwstate_ (pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING);
Signature · 1 line
2.52.0
Greg KH
maintainerRe: [PATCH v6 1/4] staging: rtl8723bs: rename LinkDetectInfo and clean up related code
Quoted 4 lines · Khushal Chitturi
This patch renames LinkDetectInfo instance to
link_detect_infoand update the fields ofrt_link_detect_tto follow kernel naming conventions. Local variables intraffic_status_watchdogwere also updated for consistency.
Please only do one logical thing per patch. This is way too many renames to try to verify you got it all correct here, would you like to have to review this? :)
Quoted 3 lines
Signed-off-by Khushal Chitturi <[email protected]>---
No need for a blank line after your signed-off-by line.
Quoted 2 lines
Changelog:
v5 -> v6: Limited the changes to LinkDetectInfo renaming.
No, you also changed the local variables. Don't make fake claims in changelog versions :(
thanks,
greg k-h
PATCH v6 2/4 staging: rtl8723bs: convert traffic status variables to bool
In reply to Khushal ChitturiThis patch replaces u8 variables in traffic_status_watchdog() and its callers with bool to reflect their usage.
---
Changelog:
v5 -> v6: Add new patch to convert traffic_status_watchdog variables from u8 to bool
drivers/staging/rtl8723bs/core/rtw_cmd.c | 16 ++++++++-------- drivers/staging/rtl8723bs/core/rtw_mlme.c | 7 +++---- drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-)
drivers/staging/rtl8723bs/core/rtw_cmd.c +8 -8
@@ -1128,18 +1128,18 @@ static void collect_traffic_statistics(struct adapter *padapter) pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes *8 /2 /1024 /1024 ); } -u8 traffic_status_watchdog (struct adapter *padapter,u8 from_timer) +bool traffic_status_watchdog (struct adapter *padapter,u8 from_timer) { -u8 should_enter_ps = false; +bool should_enter_ps = false;u16 busy_threshold_high =25 ;u16 busy_threshold_low =10 ;u16 busy_threshold = busy_threshold_high; -u8 busy_traffic = false; -u8 tx_busy_traffic = false; -u8 rx_busy_traffic = false; -u8 higher_busy_traffic = false; -u8 higher_busy_rx_traffic = false; -u8 higher_busy_tx_traffic = false; +bool busy_traffic = false; +bool tx_busy_traffic = false; +bool rx_busy_traffic = false; +bool higher_busy_traffic = false; +bool higher_busy_rx_traffic = false; +bool higher_busy_tx_traffic = false;struct mlme_priv *pmlmepriv = &padapter->mlmepriv;collect_traffic_statistics (padapter);
drivers/staging/rtl8723bs/core/rtw_mlme.c +3 -4
@@ -1652,10 +1652,9 @@ void rtw_dynamic_check_timer_handler(struct adapter *adapter)if (adapter->net_closed)return ; -if ((adapter_to_pwrctl (adapter)->fw_current_in_ps_mode) - && !(hal_btcoex_IsBtControlLps (adapter)) - ) { -u8 should_enter_ps; +if (adapter_to_pwrctl (adapter)->fw_current_in_ps_mode && + !hal_btcoex_IsBtControlLps (adapter)) { +bool should_enter_ps;linked_status_chk (adapter);
drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +1 -1
@@ -615,7 +615,7 @@ extern void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addrextern void update_TSF (struct mlme_ext_priv *pmlmeext,u8 *pframe,uint len);extern void correct_TSF (struct adapter *padapter,struct mlme_ext_priv *pmlmeext);extern void adaptive_early_32k (struct mlme_ext_priv *pmlmeext,u8 *pframe,uint len); -extern u8 traffic_status_watchdog (struct adapter *padapter,u8 from_timer); +extern bool traffic_status_watchdog (struct adapter *padapter,u8 from_timer);int rtw_chk_start_clnt_join (struct adapter *padapter,u8 *ch,u8 *bw,u8 *offset);
Signature · 1 line
2.52.0
PATCH v6 3/4 staging: rtl8723bs: simplify boolean expressions
In reply to Khushal ChitturiSimplify boolean expressions across rtl8723bs to comply with the kernel coding style.
---
Changelog:
v5 -> v6: Extend boolean simplification to ioctl_cfg80211.c and rtw_ioctl_set.c
v4 -> v5: Rebased onto current staging-testing.
v3 -> v4: Fixed alignment and removed extra parentheses.
v2 -> v3: Resubmitted as a versioned series to avoid threading confusion. v1 -> v2: Corrected commit messages.
.../staging/rtl8723bs/core/rtw_ioctl_set.c | 63 +++++++++---------- drivers/staging/rtl8723bs/core/rtw_xmit.c | 40 ++++++------ .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 14 ++--- 3 files changed, 58 insertions(+), 59 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c +30 -33
@@ -61,14 +61,11 @@ u8 rtw_do_join(struct adapter *padapter)/* when set_ssid/set_bssid for rtw_do_join(), but scanning queue is empty */ /* we try to issue sitesurvey firstly */ -if (pmlmepriv->link_detect_info.busy_traffic == false - ||rtw_to_roam (padapter) >0 - ) { +if (!pmlmepriv->link_detect_info.busy_traffic ||rtw_to_roam (padapter) >0 ) {/* submit site_survey_cmd */ ret =rtw_sitesurvey_cmd (padapter, &pmlmepriv->assoc_ssid,1 ,NULL ,0 );if (ret != _SUCCESS) pmlmepriv->to_join = false; - }else { pmlmepriv->to_join = false; ret = _FAIL;
@@ -84,7 +81,7 @@ u8 rtw_do_join(struct adapter *padapter) pmlmepriv->to_join = false;_set_timer (&pmlmepriv->assoc_timer,MAX_JOIN_TIMEOUT ); }else { -if (check_fwstate (pmlmepriv,WIFI_ADHOC_STATE ) == true) { +if (check_fwstate (pmlmepriv,WIFI_ADHOC_STATE )) {/* submit createbss_cmd to change to a ADHOC_MASTER */ /* pmlmepriv->lock has been acquired by caller... */
@@ -113,7 +110,7 @@ u8 rtw_do_join(struct adapter *padapter)/* when set_ssid/set_bssid for rtw_do_join(), but there are no desired bss in scanning queue */ /* we try to issue sitesurvey firstly */ -if (pmlmepriv->link_detect_info.busy_traffic == false || +if (!pmlmepriv->link_detect_info.busy_traffic ||rtw_to_roam (padapter) >0 ) { ret =rtw_sitesurvey_cmd (padapter, &pmlmepriv->assoc_ssid,1 ,NULL ,0 );if (ret != _SUCCESS)
@@ -143,32 +140,32 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)netdev_dbg (padapter->pnetdev,"set ssid [%s] fw_state = 0x%08x\n" , ssid->ssid,get_fwstate (pmlmepriv)); -if (padapter->hw_init_completed == false) { +if (!padapter->hw_init_completed) { status = _FAIL; goto exit; }spin_lock_bh (&pmlmepriv->lock); -if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY) == true) +if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY)) goto handle_tkip_countermeasure; -else if (check_fwstate (pmlmepriv, _FW_UNDER_LINKING) == true) +else if (check_fwstate (pmlmepriv, _FW_UNDER_LINKING)) goto release_mlme_lock; -if (check_fwstate (pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE ) == true) { +if (check_fwstate (pmlmepriv, _FW_LINKED |WIFI_ADHOC_MASTER_STATE )) {if ((pmlmepriv->assoc_ssid.ssid_length == ssid->ssid_length) && (!memcmp (&pmlmepriv->assoc_ssid.ssid, ssid->ssid, ssid->ssid_length))) { -if (check_fwstate (pmlmepriv,WIFI_STATION_STATE ) == false) { -if (rtw_is_same_ibss (padapter, pnetwork) == false) { +if (!check_fwstate (pmlmepriv,WIFI_STATION_STATE )) { +if (!rtw_is_same_ibss (padapter, pnetwork)) {/* if in WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE, create bss or rejoin again */ rtw_disassoc_cmd (padapter,0 , true); -if (check_fwstate (pmlmepriv, _FW_LINKED) == true) +if (check_fwstate (pmlmepriv, _FW_LINKED))rtw_indicate_disconnect (padapter);rtw_free_assoc_resources (padapter,1 ); -if (check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE ) == true) { +if (check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE )) {_clr_fwstate_ (pmlmepriv,WIFI_ADHOC_MASTER_STATE );set_fwstate (pmlmepriv,WIFI_ADHOC_STATE ); }
@@ -181,12 +178,12 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) }else {rtw_disassoc_cmd (padapter,0 , true); -if (check_fwstate (pmlmepriv, _FW_LINKED) == true) +if (check_fwstate (pmlmepriv, _FW_LINKED))rtw_indicate_disconnect (padapter);rtw_free_assoc_resources (padapter,1 ); -if (check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE ) == true) { +if (check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE )) {_clr_fwstate_ (pmlmepriv,WIFI_ADHOC_MASTER_STATE );set_fwstate (pmlmepriv,WIFI_ADHOC_STATE ); }
@@ -199,7 +196,7 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) goto release_mlme_lock; } -if (rtw_validate_ssid (ssid) == false) { +if (!rtw_validate_ssid (ssid)) { status = _FAIL; goto release_mlme_lock; }
@@ -207,7 +204,7 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)memcpy (&pmlmepriv->assoc_ssid, ssid,sizeof (struct ndis_802_11_ssid )); pmlmepriv->assoc_by_bssid = false; -if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY) == true) +if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY)) pmlmepriv->to_join = true;else status =rtw_do_join (padapter);
@@ -227,10 +224,10 @@ u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_1bool ssid_valid = true;struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -if (!ssid ||rtw_validate_ssid (ssid) == false) +if (!ssid || !rtw_validate_ssid (ssid)) ssid_valid = false; -if (!bssid ||rtw_validate_bssid (bssid) == false) +if (!bssid || !rtw_validate_bssid (bssid)) bssid_valid = false;if (!ssid_valid && !bssid_valid) {
@@ -238,7 +235,7 @@ u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_1 goto exit; } -if (padapter->hw_init_completed == false) { +if (!padapter->hw_init_completed) { status = _FAIL; goto exit; }
@@ -248,9 +245,9 @@ u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_1netdev_dbg (padapter->pnetdev,FUNC_ADPT_FMT " fw_state = 0x%08x\n" ,FUNC_ADPT_ARG (padapter),get_fwstate (pmlmepriv)); -if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY) == true) +if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY)) goto handle_tkip_countermeasure; -else if (check_fwstate (pmlmepriv, _FW_UNDER_LINKING) == true) +else if (check_fwstate (pmlmepriv, _FW_UNDER_LINKING)) goto release_mlme_lock; handle_tkip_countermeasure:
@@ -271,7 +268,7 @@ u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_1 pmlmepriv->assoc_by_bssid = false; } -if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY) == true) +if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY)) pmlmepriv->to_join = true;else status =rtw_do_join (padapter);
@@ -300,15 +297,15 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,spin_lock_bh (&pmlmepriv->lock); -if ((check_fwstate (pmlmepriv, _FW_LINKED) == true) || (*pold_state == Ndis802_11IBSS)) +if (check_fwstate (pmlmepriv, _FW_LINKED) || *pold_state == Ndis802_11IBSS)rtw_disassoc_cmd (padapter,0 , true); -if ((check_fwstate (pmlmepriv, _FW_LINKED) == true) || - (check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE ) == true)) +if (check_fwstate (pmlmepriv, _FW_LINKED) || +check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE ))rtw_free_assoc_resources (padapter,1 ); -if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) { -if (check_fwstate (pmlmepriv, _FW_LINKED) == true) +if (*pold_state == Ndis802_11Infrastructure || *pold_state == Ndis802_11IBSS) { +if (check_fwstate (pmlmepriv, _FW_LINKED))rtw_indicate_disconnect (padapter);/* will clr Linked_state; before this function, we must have checked whether issue dis-assoc_cmd or not */ }
@@ -351,7 +348,7 @@ u8 rtw_set_802_11_disassociate(struct adapter *padapter)spin_lock_bh (&pmlmepriv->lock); -if (check_fwstate (pmlmepriv, _FW_LINKED) == true) { +if (check_fwstate (pmlmepriv, _FW_LINKED)) {rtw_disassoc_cmd (padapter,0 , true);rtw_indicate_disconnect (padapter);/* modify for CONFIG_IEEE80211W, none 11w can use it */
@@ -373,13 +370,13 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s res = false; goto exit; } -if (padapter->hw_init_completed == false) { +if (!padapter->hw_init_completed) { res = false; goto exit; } -if ((check_fwstate (pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true) || - (pmlmepriv->link_detect_info.busy_traffic == true)) { +if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING) || + pmlmepriv->link_detect_info.busy_traffic) {/* Scan or linking is in progress, do nothing. */ res = true;
drivers/staging/rtl8723bs/core/rtw_xmit.c +21 -19
@@ -384,8 +384,9 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * }else {while (true) {/* IOT action */ -if ((pmlmeinfo->assoc_AP_vendor ==HT_IOT_PEER_ATHEROS ) && (pattrib->ampdu_en == true) && - (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) { +if (pmlmeinfo->assoc_AP_vendor ==HT_IOT_PEER_ATHEROS && + pattrib->ampdu_en && + padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) { pattrib->vcs_mode =CTS_TO_SELF ;break ; }
@@ -420,7 +421,7 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame */* to do list: check MIMO power save condition. */ /* check AMPDU aggregation for TXOP */ -if (pattrib->ampdu_en == true) { +if (pattrib->ampdu_en) { pattrib->vcs_mode =RTS_CTS ;break ; }
@@ -482,10 +483,10 @@ static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *pmemset (pattrib->dot11tkiptxmickey.skey,0 ,16 ); pattrib->mac_id = psta->mac_id; -if (psta->ieee8021x_blocked == true) { +if (psta->ieee8021x_blocked) { pattrib->encrypt =0 ; -if ((pattrib->ether_type !=0x888e ) && (check_fwstate (pmlmepriv,WIFI_MP_STATE ) == false)) { +if (pattrib->ether_type !=0x888e && !check_fwstate (pmlmepriv,WIFI_MP_STATE )) { res = _FAIL; goto exit; }
@@ -639,8 +640,8 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pmemcpy (pattrib->dst, ðerhdr.h_dest,ETH_ALEN );memcpy (pattrib->src, ðerhdr.h_source,ETH_ALEN ); -if ((check_fwstate (pmlmepriv,WIFI_ADHOC_STATE ) == true) || - (check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE ) == true)) { +if (check_fwstate (pmlmepriv,WIFI_ADHOC_STATE ) || +check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE )) {memcpy (pattrib->ra, pattrib->dst,ETH_ALEN );memcpy (pattrib->ta, pattrib->src,ETH_ALEN ); }else if (check_fwstate (pmlmepriv,WIFI_STATION_STATE )) {
@@ -704,7 +705,8 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pif (!psta) {/* if we cannot get psta => drop the pkt */ res = _FAIL; goto exit; - }else if ((check_fwstate (pmlmepriv,WIFI_AP_STATE ) == true) && (!(psta->state & _FW_LINKED))) { + }else if (check_fwstate (pmlmepriv,WIFI_AP_STATE ) && + !(psta->state & _FW_LINKED)) { res = _FAIL; goto exit; }
@@ -881,7 +883,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattrSetFrameSubType (fctrl, pattrib->subtype);if (pattrib->subtype &WIFI_DATA_TYPE ) { -if (check_fwstate (pmlmepriv,WIFI_STATION_STATE ) == true) { +if (check_fwstate (pmlmepriv,WIFI_STATION_STATE )) {/* to_ds = 1, fr_ds = 0; */ {
@@ -895,7 +897,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattrif (pqospriv->qos_option) qos_option = true; - }else if (check_fwstate (pmlmepriv,WIFI_AP_STATE ) == true) { + }else if (check_fwstate (pmlmepriv,WIFI_AP_STATE )) {/* to_ds = 0, fr_ds = 1; */ SetFrDs (fctrl);memcpy (pwlanhdr->addr1, pattrib->dst,ETH_ALEN );
@@ -904,8 +906,8 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattrif (pattrib->qos_en) qos_option = true; - }else if ((check_fwstate (pmlmepriv,WIFI_ADHOC_STATE ) == true) || - (check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE ) == true)) { + }else if (check_fwstate (pmlmepriv,WIFI_ADHOC_STATE ) || +check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE )) {memcpy (pwlanhdr->addr1, pattrib->dst,ETH_ALEN );memcpy (pwlanhdr->addr2, pattrib->src,ETH_ALEN );memcpy (pwlanhdr->addr3,get_bssid (pmlmepriv),ETH_ALEN );
@@ -963,7 +965,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr pattrib->ampdu_en = true;/* re-check if enable ampdu by BA_starting_seqctrl */ -if (pattrib->ampdu_en == true) { +if (pattrib->ampdu_en) {u16 tx_seq; tx_seq = psta->BA_starting_seqctrl[pattrib->priority &0x0f ];
@@ -1114,7 +1116,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct frg_inx++; -if (bmcst || (rtw_endofpktfile (&pktfile) == true)) { +if (bmcst ||rtw_endofpktfile (&pktfile)) { pattrib->nr_frags = frg_inx; pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len +
@@ -1140,7 +1142,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, structxmitframe_swencrypt (padapter, pxmitframe); -if (bmcst == false) +if (!bmcst)update_attrib_vcs_info (padapter, pxmitframe);else pattrib->vcs_mode =NONE_VCS ;
@@ -1977,14 +1979,14 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt)do_queue_select (padapter, &pxmitframe->attrib);spin_lock_bh (&pxmitpriv->lock); -if (xmitframe_enqueue_for_sleeping_sta (padapter, pxmitframe) == true) { +if (xmitframe_enqueue_for_sleeping_sta (padapter, pxmitframe)) {spin_unlock_bh (&pxmitpriv->lock);return 1 ; }spin_unlock_bh (&pxmitpriv->lock);/* pre_xmitframe */ -if (rtw_hal_xmit (padapter, pxmitframe) == false) +if (!rtw_hal_xmit (padapter, pxmitframe))return 1 ;return 0 ;
@@ -2028,7 +2030,7 @@ signed int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xsigned int bmcst =is_multicast_ether_addr (pattrib->ra);bool update_tim = false; -if (check_fwstate (pmlmepriv,WIFI_AP_STATE ) == false) +if (!check_fwstate (pmlmepriv,WIFI_AP_STATE ))return ret; psta =rtw_get_stainfo (&padapter->stapriv, pattrib->ra);if (pattrib->psta != psta)
@@ -2153,7 +2155,7 @@ static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struc ret =xmitframe_enqueue_for_sleeping_sta (padapter, pxmitframe); -if (true == ret) { +if (ret) { ptxservq =rtw_get_sta_pending (padapter, psta, pattrib->priority, (u8 *)(&ac_index)); ptxservq->qcnt--;
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +7 -7
@@ -1072,7 +1072,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, rtw_wdev->iftype = type; -if (rtw_set_802_11_infrastructure_mode (padapter, networkType) == false) { +if (!rtw_set_802_11_infrastructure_mode (padapter, networkType)) { rtw_wdev->iftype = old_type; ret = -EPERM ; goto exit;
@@ -1283,7 +1283,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy }spin_unlock_bh (&pmlmepriv->lock); -if (_status == false) +if (!_status) ret =-1 ; check_need_indicate_scan_done:
@@ -1585,7 +1585,7 @@ static int cfg80211_rtw_join_ibss(struct wiphy *wiphy, struct net_device *ndev, ret =rtw_cfg80211_set_auth_type (psecuritypriv,NL80211_AUTHTYPE_OPEN_SYSTEM );rtw_set_802_11_authentication_mode (padapter, psecuritypriv->ndisauthtype); -if (rtw_set_802_11_ssid (padapter, &ndis_ssid) == false) { +if (!rtw_set_802_11_ssid (padapter, &ndis_ssid)) { ret =-1 ; goto exit; }
@@ -1611,7 +1611,7 @@ static int cfg80211_rtw_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) rtw_wdev->iftype =NL80211_IFTYPE_STATION ; -if (rtw_set_802_11_infrastructure_mode (padapter, Ndis802_11Infrastructure) == false) { +if (!rtw_set_802_11_infrastructure_mode (padapter, Ndis802_11Infrastructure)) { rtw_wdev->iftype = old_type; ret = -EPERM ; goto leave_ibss;
@@ -1764,7 +1764,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,/* rtw_set_802_11_encryption_mode(padapter, padapter->securitypriv.ndisencryptstatus); */ -if (rtw_set_802_11_connect (padapter, (u8 *)sme->bssid, &ndis_ssid) == false) { +if (!rtw_set_802_11_connect (padapter, (u8 *)sme->bssid, &ndis_ssid)) { ret =-1 ; goto exit; }
@@ -2070,7 +2070,7 @@ static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, strucu32 len = skb->len;u8 category, action; -if (rtw_action_frame_parse (buf, len, &category, &action) == false) +if (!rtw_action_frame_parse (buf, len, &category, &action)) goto fail;/* starting alloc mgmt frame to dump it */
@@ -2551,7 +2551,7 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,/* indicate ack before issue frame to avoid racing with rsp frame */ rtw_cfg80211_mgmt_tx_status (padapter, *cookie, buf, len, ack,GFP_KERNEL ); -if (rtw_action_frame_parse (buf, len, &category, &action) == false) +if (!rtw_action_frame_parse (buf, len, &category, &action)) goto exit;rtw_ps_deny (padapter,PS_DENY_MGNT_TX );
Signature · 1 line
2.52.0
Greg KH
maintainerRe: [PATCH v6 3/4] staging: rtl8723bs: simplify boolean expressions
Quoted 27 lines · Khushal Chitturi
Simplify boolean expressions across rtl8723bs to comply with the kernel coding style.
Signed-off-by Khushal Chitturi <[email protected]>---
Changelog:
v5 -> v6: Extend boolean simplification toioctl_cfg80211.candrtw_ioctl_set.c
v4 -> v5: Rebased onto current staging-testing.
v3 -> v4: Fixed alignment and removed extra parentheses.
v2 -> v3: Resubmitted as a versioned series to avoid threading confusion. v1 -> v2: Corrected commit messages..../staging/rtl8723bs/core/rtw_ioctl_set.c | 63 +++++++++---------- drivers/staging/rtl8723bs/core/rtw_xmit.c | 40 ++++++------ .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 14 ++--- 3 files changed, 58 insertions(+), 59 deletions(-)drivers/staging/rtl8723bs/core/rtw_ioctl_set.c +0
-0@@ -61,14 +61,11 @@ u8 rtw_do_join(struct adapter *padapter)/* when set_ssid/set_bssid for rtw_do_join(), but scanning queue is empty */ /* we try to issue sitesurvey firstly */
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c u8 rtw_do_join(struct adapter *padapter) · line 69
Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c +1
-4-if (pmlmepriv->link_detect_info.busy_traffic == false - ||rtw_to_roam (padapter) >0 - ) { +if (!pmlmepriv->link_detect_info.busy_traffic ||rtw_to_roam (padapter) >0 ) {/* submit site_survey_cmd */ ret =rtw_sitesurvey_cmd (padapter, &pmlmepriv->assoc_ssid,1 ,NULL ,0 );if (ret != _SUCCESS) pmlmepriv->to_join = false; - }else {
You also removed blank lines without mentioning it :(
Again, please only do one logical thing per change.
thanks,
greg k-h
PATCH v6 4/4 staging: rtl8723bs: fix line length and alignment issues
In reply to Khushal ChitturiFix multiple coding style issues in rtw_xmit.c to comply with the kernel coding style by splitting expressions and adjusting alignment.
This patch resolves checkpatch.pl warnings caused by line length exceeding 100 columns and alignment matching the open parenthesis.
---
Changelog:
v5 -> v6: No changes.
v4 -> v5: Rebased onto current staging-testing.
v3 -> v4: Adjusted comment formatting.
v2 -> v3: Resubmitted as a versioned series to resolve threading confusion. v1 -> v2: No changes.
drivers/staging/rtl8723bs/core/rtw_xmit.c | 107 +++++++++++++--------- 1 file changed, 66 insertions(+), 41 deletions(-)
drivers/staging/rtl8723bs/core/rtw_xmit.c +66 -41
@@ -126,10 +126,14 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) pxmitbuf->buf_tag =XMITBUF_DATA ;/* Tx buf allocation may fail sometimes, so sleep and retry. */ - res =rtw_os_xmit_resource_alloc (padapter, pxmitbuf, (MAX_XMITBUF_SZ +XMITBUF_ALIGN_SZ ), true); + res =rtw_os_xmit_resource_alloc (padapter, pxmitbuf, + (MAX_XMITBUF_SZ +XMITBUF_ALIGN_SZ ), + true);if (res == _FAIL) {msleep (10 ); - res =rtw_os_xmit_resource_alloc (padapter, pxmitbuf, (MAX_XMITBUF_SZ +XMITBUF_ALIGN_SZ ), true); + res =rtw_os_xmit_resource_alloc (padapter, pxmitbuf, + (MAX_XMITBUF_SZ +XMITBUF_ALIGN_SZ ), + true);if (res == _FAIL) goto exit; }
@@ -208,7 +212,9 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) pxmitbuf->padapter = padapter; pxmitbuf->buf_tag =XMITBUF_MGNT ; - res =rtw_os_xmit_resource_alloc (padapter, pxmitbuf,MAX_XMIT_EXTBUF_SZ +XMITBUF_ALIGN_SZ , true); + res =rtw_os_xmit_resource_alloc (padapter, pxmitbuf, +MAX_XMIT_EXTBUF_SZ +XMITBUF_ALIGN_SZ , + true);if (res == _FAIL) { res = _FAIL; goto exit;
@@ -291,7 +297,9 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv) }for (i =0 ; i <NR_XMITBUFF ; i++) { -rtw_os_xmit_resource_free (padapter, pxmitbuf, (MAX_XMITBUF_SZ +XMITBUF_ALIGN_SZ ), true); +rtw_os_xmit_resource_free (padapter, pxmitbuf, + (MAX_XMITBUF_SZ +XMITBUF_ALIGN_SZ ), + true); pxmitbuf++; }
@@ -313,7 +321,9 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)/* free xmit extension buff */ pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;for (i =0 ; i <NR_XMIT_EXTBUFF ; i++) { -rtw_os_xmit_resource_free (padapter, pxmitbuf, (MAX_XMIT_EXTBUF_SZ +XMITBUF_ALIGN_SZ ), true); +rtw_os_xmit_resource_free (padapter, pxmitbuf, + (MAX_XMIT_EXTBUF_SZ +XMITBUF_ALIGN_SZ ), + true); pxmitbuf++; }
@@ -366,10 +376,12 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame *else /* no frag */ sz = pattrib->last_txcmdsz; -/* (1) RTS_Threshold is compared to the MPDU, not MSDU. */ -/* (2) If there are more than one frag in this MSDU, only the first frag uses protection frame. */ -/* Other fragments are protected by previous fragment. */ -/* So we only need to check the length of first fragment. */ +/* (1) RTS_Threshold is compared to the MPDU, not MSDU. +* (2) If there are more than one frag in this MSDU, only the +* first frag uses protection frame. Other fragments are +* protected by the previous fragment, so we only need to +* check the length of first fragment. +*/ if (pmlmeext->cur_wireless_mode <WIRELESS_11_24N || padapter->registrypriv.wifi_spec) {if (sz > padapter->registrypriv.rts_thresh) { pattrib->vcs_mode =RTS_CTS ;
@@ -436,7 +448,8 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * pattrib->vcs_mode = padapter->driver_vcs_type; } -static void update_attrib_phy_info (struct adapter *padapter,struct pkt_attrib *pattrib,struct sta_info *psta) +static void update_attrib_phy_info (struct adapter *padapter,struct pkt_attrib *pattrib, +struct sta_info *psta) {struct mlme_ext_priv *mlmeext = &padapter->mlmeextpriv;
@@ -464,7 +477,8 @@ static void update_attrib_phy_info(struct adapter *padapter, struct pkt_attrib * pattrib->ch_offset = psta->htpriv.ch_offset; pattrib->ampdu_en = false; -if (padapter->driver_ampdu_spacing !=0xFF )/* driver control AMPDU Density for peer sta's rx */ +/* driver control AMPDU Density for peer sta's rx */ +if (padapter->driver_ampdu_spacing !=0xFF ) pattrib->ampdu_spacing = padapter->driver_ampdu_spacing;else pattrib->ampdu_spacing = psta->htpriv.rx_ampdu_min_spacing;
@@ -472,7 +486,8 @@ static void update_attrib_phy_info(struct adapter *padapter, struct pkt_attrib * pattrib->retry_ctrl = false; } -static s32 update_attrib_sec_info (struct adapter *padapter,struct pkt_attrib *pattrib,struct sta_info *psta) +static s32 update_attrib_sec_info (struct adapter *padapter,struct pkt_attrib *pattrib, +struct sta_info *psta) {signed int res = _SUCCESS;struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -511,7 +526,8 @@ static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *p }/* For WPS 1.0 WEP, driver should not encrypt EAPOL Packet for WPS handshake. */ -if (((pattrib->encrypt == _WEP40_) || (pattrib->encrypt == _WEP104_)) && (pattrib->ether_type ==0x888e )) +if ((pattrib->encrypt == _WEP40_ || pattrib->encrypt == _WEP104_) && + pattrib->ether_type ==0x888e ) pattrib->encrypt = _NO_PRIVACY_; }
@@ -563,7 +579,7 @@ static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *pmemcpy (pattrib->dot118021x_UncstKey.skey, psta->dot118021x_UncstKey.skey,16 );if (pattrib->encrypt && - ((padapter->securitypriv.sw_encrypt) || (!psecuritypriv->hw_decrypted))) + (padapter->securitypriv.sw_encrypt || !psecuritypriv->hw_decrypted)) pattrib->bswenc = true;else pattrib->bswenc = false;
@@ -655,8 +671,9 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p pattrib->pktlen = pktfile.pkt_len;if (pattrib->ether_type ==ETH_P_IP ) { -/* The following is for DHCP and ARP packet, we use cck1M to tx these packets and let LPS awake some time */ -/* to prevent DHCP protocol fail */ +/* The following is for DHCP and ARP packets, we use cck1M to tx these +* packets and let LPS awake some time to prevent DHCP protocol fail +*/ u8 tmp[24 ];
@@ -665,8 +682,8 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p pattrib->dhcp_pkt =0 ;if (pktfile.pkt_len >282 ) {/* MINIMUM_DHCP_PACKET_SIZE) { */ if (pattrib->ether_type ==ETH_P_IP ) {/* IP header */ -if (((tmp[21 ] ==68 ) && (tmp[23 ] ==67 )) || - ((tmp[21 ] ==67 ) && (tmp[23 ] ==68 ))) { +if ((tmp[21 ] ==68 && tmp[23 ] ==67 ) || + (tmp[21 ] ==67 && tmp[23 ] ==68 )) {/* 68 : UDP BOOTP client */ /* 67 : UDP BOOTP server */ pattrib->dhcp_pkt =1 ;
@@ -778,7 +795,8 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfrif (pattrib->encrypt == _TKIP_) {/* encode mic code */ { -u8 null_key[16 ] = {0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 }; +u8 null_key[16 ] = {0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 , +0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x0 }; pframe = pxmitframe->buf_addr + hw_hdr_offset;
@@ -998,10 +1016,10 @@ s32 rtw_txframes_pending(struct adapter *padapter) {struct xmit_priv *pxmitpriv = &padapter->xmitpriv; -return ((!list_empty (&pxmitpriv->be_pending.queue)) || - (!list_empty (&pxmitpriv->bk_pending.queue)) || - (!list_empty (&pxmitpriv->vi_pending.queue)) || - (!list_empty (&pxmitpriv->vo_pending.queue))); +return !list_empty (&pxmitpriv->be_pending.queue) || + !list_empty (&pxmitpriv->bk_pending.queue) || + !list_empty (&pxmitpriv->vi_pending.queue) || + !list_empty (&pxmitpriv->vo_pending.queue); }/*
@@ -1031,7 +1049,8 @@ u32 rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib)* 5. move frag chunk from pframe to pxmitframe->mem * 6. apply sw-encrypt, if necessary. */ -s32 rtw_xmitframe_coalesce (struct adapter *padapter,struct sk_buff *pkt,struct xmit_frame *pxmitframe) +s32 rtw_xmitframe_coalesce (struct adapter *padapter,struct sk_buff *pkt, +struct xmit_frame *pxmitframe) {struct pkt_file pktfile;
@@ -1152,7 +1171,8 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct }/* broadcast or multicast management pkt use BIP, unicast management pkt use CCMP encryption */ -s32 rtw_mgmt_xmitframe_coalesce (struct adapter *padapter,struct sk_buff *pkt,struct xmit_frame *pxmitframe) +s32 rtw_mgmt_xmitframe_coalesce (struct adapter *padapter,struct sk_buff *pkt, +struct xmit_frame *pxmitframe) {u8 *pframe, *mem_start =NULL , *tmp_buf =NULL ;u8 subtype;
@@ -1235,7 +1255,7 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s }else {/* unicast mgmt frame TX */ /* start to encrypt mgmt frame */ if (subtype ==WIFI_DEAUTH || subtype ==WIFI_DISASSOC || - subtype ==WIFI_REASSOCREQ || subtype ==WIFI_ACTION ) { + subtype ==WIFI_REASSOCREQ || subtype ==WIFI_ACTION ) {if (pattrib->psta) psta = pattrib->psta;else
@@ -1249,11 +1269,11 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s/* according 802.11-2012 standard, these five types are not robust types */ if (subtype ==WIFI_ACTION && - (pframe[WLAN_HDR_A3_LEN ] ==RTW_WLAN_CATEGORY_PUBLIC || - pframe[WLAN_HDR_A3_LEN ] ==RTW_WLAN_CATEGORY_HT || - pframe[WLAN_HDR_A3_LEN ] ==RTW_WLAN_CATEGORY_UNPROTECTED_WNM || - pframe[WLAN_HDR_A3_LEN ] ==RTW_WLAN_CATEGORY_SELF_PROTECTED || - pframe[WLAN_HDR_A3_LEN ] ==RTW_WLAN_CATEGORY_P2P )) + (pframe[WLAN_HDR_A3_LEN ] ==RTW_WLAN_CATEGORY_PUBLIC || + pframe[WLAN_HDR_A3_LEN ] ==RTW_WLAN_CATEGORY_HT || + pframe[WLAN_HDR_A3_LEN ] ==RTW_WLAN_CATEGORY_UNPROTECTED_WNM || + pframe[WLAN_HDR_A3_LEN ] ==RTW_WLAN_CATEGORY_SELF_PROTECTED || + pframe[WLAN_HDR_A3_LEN ] ==RTW_WLAN_CATEGORY_P2P )) goto xmitframe_coalesce_fail;/* before encrypt dump the management packet content */ if (pattrib->encrypt >0 )
@@ -1410,7 +1430,7 @@ void rtw_count_tx_stats(struct adapter *padapter, struct xmit_frame *pxmitframe, }static struct xmit_buf *__rtw_alloc_cmd_xmitbuf (struct xmit_priv *pxmitpriv, -enum cmdbuf_type buf_type) +enum cmdbuf_type buf_type) {struct xmit_buf *pxmitbuf =NULL ;
@@ -1431,7 +1451,7 @@ static struct xmit_buf *__rtw_alloc_cmd_xmitbuf(struct xmit_priv *pxmitpriv, }struct xmit_frame *__rtw_alloc_cmdxmitframe (struct xmit_priv *pxmitpriv, -enum cmdbuf_type buf_type) +enum cmdbuf_type buf_type) {struct xmit_frame *pcmdframe;struct xmit_buf *pxmitbuf;
@@ -1766,7 +1786,8 @@ s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframreturn _SUCCESS; } -struct tx_servq *rtw_get_sta_pending (struct adapter *padapter,struct sta_info *psta,signed int up,u8 *ac) +struct tx_servq *rtw_get_sta_pending (struct adapter *padapter,struct sta_info *psta, +signed int up,u8 *ac) {struct tx_servq *ptxservq =NULL ;
@@ -2020,7 +2041,8 @@ inline bool xmitframe_hiq_filter(struct xmit_frame *xmitframe)return allow; } -signed int xmitframe_enqueue_for_sleeping_sta (struct adapter *padapter,struct xmit_frame *pxmitframe) +signed int xmitframe_enqueue_for_sleeping_sta (struct adapter *padapter, +struct xmit_frame *pxmitframe) {signed int ret = false;struct sta_info *psta =NULL ;
@@ -2115,7 +2137,8 @@ signed int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xif (wmmps_ac) psta->sleepq_ac_len++; -if (((psta->has_legacy_ac) && (!wmmps_ac)) || ((!psta->has_legacy_ac) && (wmmps_ac))) { +if ((psta->has_legacy_ac && !wmmps_ac) || + (!psta->has_legacy_ac && wmmps_ac)) {if (!(pstapriv->tim_bitmap &BIT (psta->aid))) update_tim = true;
@@ -2135,7 +2158,8 @@ signed int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xreturn ret; } -static void dequeue_xmitframes_to_sleeping_queue (struct adapter *padapter,struct sta_info *psta,struct __queue *pframequeue) +static void dequeue_xmitframes_to_sleeping_queue (struct adapter *padapter,struct sta_info *psta, +struct __queue *pframequeue) {signed int ret;struct list_head *plist, *phead, *tmp;
@@ -2156,7 +2180,8 @@ static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struc ret =xmitframe_enqueue_for_sleeping_sta (padapter, pxmitframe);if (ret) { - ptxservq =rtw_get_sta_pending (padapter, psta, pattrib->priority, (u8 *)(&ac_index)); + ptxservq =rtw_get_sta_pending (padapter, psta, pattrib->priority, + (u8 *)(&ac_index)); ptxservq->qcnt--; phwxmits[ac_index].accnt--;
@@ -2461,9 +2486,9 @@ struct xmit_buf *dequeue_pending_xmitbuf_under_survey(struct xmit_priv *pxmitpri type =GetFrameSubType (pxmitbuf->pbuf +TXDESC_OFFSET ); -if ((type ==WIFI_PROBEREQ ) || - (type ==WIFI_DATA_NULL ) || - (type ==WIFI_QOS_DATA_NULL )) { +if (type ==WIFI_PROBEREQ || + type ==WIFI_DATA_NULL || + type ==WIFI_QOS_DATA_NULL ) {list_del_init (&pxmitbuf->list);break ; }
Signature · 1 line
2.52.0