Skip to contentSkip to conversation

staging: rtl8723bs: coding style cleanups

PATCH In review Jose A. Perez de Azpillaga 3 participants 13 messages Mar 3 – Mar 4 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8723bs: coding style cleanups

This series cleans up various checkpatch.pl issues in rtw_pwrctrl.c

Jose A. Perez de Azpillaga (4):
staging: rtl8723bs: remove redundant blank lines
staging: rtl8723bs: format operators and logical continuations
staging: rtl8723bs: curly brace consistency
staging: rtl8723bs: fix indentation, line length and declarations

 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 90 +++++++++-----------
 1 file changed, 42 insertions(+), 48 deletions(-)

--
2.53.0

#1 lore raw

PATCH 1/4 staging: rtl8723bs: remove redundant blank lines

Remove multiple blank lines and unnecessary blank lines before closing braces.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 14 --------------
 1 file changed, 14 deletions(-)
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +0 -14
index 666e241704d9..7d2af0f1be52 100644
@@ -29,14 +29,12 @@ void _ips_enter(struct adapter *padapter)
 		pwrpriv->rf_pwrstate = rf_off;
 	}
 	pwrpriv->bips_processing = false;
-
 }
 
 void ips_enter(struct adapter *padapter)
 {
 	struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
 
-
 	hal_btcoex_IpsNotify(padapter, pwrpriv->ips_mode_req);
 
 	mutex_lock(&pwrpriv->lock);
@@ -131,7 +129,6 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
 	return ret;
 }
 
-
 /*
  * ATTENTION:
  *rtw_ps_processor() doesn't handle LPS.
@@ -184,8 +181,6 @@ void traffic_check_for_leave_lps(struct adapter *padapter, u8 tx, u32 tx_packets
 	u8 bLeaveLPS = false;
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
-
-
 	if (tx) { /* from tx */
 		xmit_cnt += tx_packets;
 
@@ -240,12 +235,10 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
 		if (pwrpriv->rpwm == pslv ||
 		    (pwrpriv->rpwm >= PS_STATE_S2 && pslv >= PS_STATE_S2))
 			return;
-
 	}
 
 	if ((padapter->bSurpriseRemoved) || !(padapter->hw_init_completed)) {
 		pwrpriv->cpwm = PS_STATE_S4;
-
 		return;
 	}
 
@@ -342,7 +335,6 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
 		if (ps_mode == PS_MODE_ACTIVE)
 			return;
 
-
 	mutex_lock(&pwrpriv->lock);
 
 	/* if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) */
@@ -404,7 +396,6 @@ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
 	u8 bAwake = false;
 	s32 err = 0;
 
-
 	start_time = jiffies;
 	while (1) {
 		rtw_hal_get_hwreg(padapter, HW_VAR_FWLPS_RF_ON, &bAwake);
@@ -606,7 +597,6 @@ void cpwm_int_hdl(struct adapter *padapter, struct reportpwrstate_parm *preportp
 
 exit:
 	mutex_unlock(&pwrpriv->lock);
-
 }
 
 static void cpwm_event_callback(struct work_struct *work)
@@ -626,7 +616,6 @@ static void rpwmtimeout_workitem_callback(struct work_struct *work)
 	struct dvobj_priv *dvobj;
 	struct pwrctrl_priv *pwrpriv;
 
-
 	pwrpriv = container_of(work, struct pwrctrl_priv, rpwmtimeoutwi);
 	dvobj = pwrctl_to_dvobj(pwrpriv);
 	padapter = dvobj->if1;
@@ -683,7 +672,6 @@ static inline void unregister_task_alive(struct pwrctrl_priv *pwrctrl, u32 tag)
 	pwrctrl->alives &= ~tag;
 }
 
-
 /*
  * Description:
  *Check if the fw_pwrstate is okay for I/O.
@@ -1020,7 +1008,6 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
 	if (time_before(pwrpriv->ips_deny_time, deny_time))
 		pwrpriv->ips_deny_time = deny_time;
 
-
 	if (pwrpriv->ps_processing)
 		while (pwrpriv->ps_processing && jiffies_to_msecs(jiffies - start) <= 3000)
 			mdelay(10);
@@ -1068,7 +1055,6 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
 	if (time_before(pwrpriv->ips_deny_time, deny_time))
 		pwrpriv->ips_deny_time = deny_time;
 	return ret;
-
 }
 
 int rtw_pm_set_lps(struct adapter *padapter, u8 mode)

--
2.53.0

#2 lore raw

Re: [PATCH 1/4] staging: rtl8723bs: remove redundant blank lines

Quoted 8 lines · Jose A. Perez de Azpillaga

Remove multiple blank lines and unnecessary blank lines before closing braces.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 14 --------------
 1 file changed, 14 deletions(-)

...

drivers/staging/rtl8723bs/core/rtw_pwrctrl.c void _ips_enter(struct adapter *padapter) · line 32

Quoted 5 lines
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +0 -1
 		pwrpriv->rf_pwrstate = rf_off;
 	}
 	pwrpriv->bips_processing = false;
-
 }

Ideally since your deleting that blank line this would be something like this:

		pwr...
	}

	pwrpriv->bips_processing = false;
}

Thanks,

ET

#3 lore raw

Re: [PATCH 1/4] staging: rtl8723bs: remove redundant blank lines

Quoted 6 lines · Ethan Tidmore
Quoted 5 lines · Jose A. Perez de Azpillaga

Remove multiple blank lines and unnecessary blank lines before closing braces.

---

So, when you send v2 you can add my RB to the patches I gave the tag too.

Thanks,

ET

#4 lore raw

Re: [PATCH 1/4] staging: rtl8723bs: remove redundant blank lines

In reply to Ethan Tidmore
Quoted 18 lines · Ethan Tidmore
Quoted 8 lines · Jose A. Perez de Azpillaga

Remove multiple blank lines and unnecessary blank lines before closing braces.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 14 --------------
 1 file changed, 14 deletions(-)

...

drivers/staging/rtl8723bs/core/rtw_pwrctrl.c void _ips_enter(struct adapter *padapter) · line 32

Quoted 5 lines
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +0 -1
 		pwrpriv->rf_pwrstate = rf_off;
 	}
 	pwrpriv->bips_processing = false;
-
 }
Quoted 7 lines

Ideally since your deleting that blank line this would be something like this:

		pwr...
	}

	pwrpriv->bips_processing = false;
}

Sorry, I don't understand what you're trying to say.

regards,
dan carpenter

Reviewed-by on v1 1/4
#5 lore raw

Re: [PATCH 1/4] staging: rtl8723bs: remove redundant blank lines

In reply to Jose A. Perez de Azpillaga
Quoted 5 lines · Jose A. Perez de Azpillaga

Remove multiple blank lines and unnecessary blank lines before closing braces.

---

LGTM.

Ignore my comments about sending a v2, Dan pointed out my... dubious point, and looked back at this patch again and everything looks good.

Thanks,

ET

#6 lore raw

PATCH 2/4 staging: rtl8723bs: format operators and logical continuations

In reply to Jose A. Perez de Azpillaga

Fix spaces around different operators. Move logical continuations to the end of the previous line.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +24 -24
index 7d2af0f1be52..e75dd21b3390 100644
@@ -93,10 +93,10 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
 	if (time_before(jiffies, adapter_to_pwrctl(adapter)->ips_deny_time))
 		goto exit;
 
-	if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR)
-		|| check_fwstate(pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS)
-		|| check_fwstate(pmlmepriv, WIFI_AP_STATE)
-		|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE)
+	if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE | WIFI_SITE_MONITOR) ||
+	    check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS) ||
+	    check_fwstate(pmlmepriv, WIFI_AP_STATE) ||
+	    check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE)
 	)
 		goto exit;
 
@@ -104,10 +104,10 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
 	if (buddy) {
 		struct mlme_priv *b_pmlmepriv = &(buddy->mlmepriv);
 
-		if (check_fwstate(b_pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR)
-			|| check_fwstate(b_pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS)
-			|| check_fwstate(b_pmlmepriv, WIFI_AP_STATE)
-			|| check_fwstate(b_pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE)
+		if (check_fwstate(b_pmlmepriv, WIFI_ASOC_STATE | WIFI_SITE_MONITOR) ||
+		    check_fwstate(b_pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS) ||
+		    check_fwstate(b_pmlmepriv, WIFI_AP_STATE) ||
+		    check_fwstate(b_pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE)
 		)
 			goto exit;
 	}
@@ -155,7 +155,7 @@ void rtw_ps_processor(struct adapter *padapter)
 	if (!rtw_pwr_unassociated_idle(padapter))
 		goto exit;
 
-	if ((pwrpriv->rf_pwrstate == rf_on) && ((pwrpriv->pwr_state_check_cnts%4) == 0)) {
+	if ((pwrpriv->rf_pwrstate == rf_on) && ((pwrpriv->pwr_state_check_cnts % 4) == 0)) {
 		pwrpriv->change_rfpwrstate = rf_off;
 		{
 			ips_enter(padapter);
@@ -189,9 +189,9 @@ void traffic_check_for_leave_lps(struct adapter *padapter, u8 tx, u32 tx_packets
 
 		if (jiffies_to_msecs(jiffies - start_time) > 2000) { /*  2 sec == watch dog timer */
 			if (xmit_cnt > 8) {
-				if (adapter_to_pwrctl(padapter)->bLeisurePs
-				    && (adapter_to_pwrctl(padapter)->pwr_mode != PS_MODE_ACTIVE)
-				    && !(hal_btcoex_IsBtControlLps(padapter))) {
+				if (adapter_to_pwrctl(padapter)->bLeisurePs &&
+				    (adapter_to_pwrctl(padapter)->pwr_mode != PS_MODE_ACTIVE) &&
+				    !(hal_btcoex_IsBtControlLps(padapter))) {
 					bLeaveLPS = true;
 				}
 			}
@@ -202,16 +202,16 @@ void traffic_check_for_leave_lps(struct adapter *padapter, u8 tx, u32 tx_packets
 
 	} else { /*  from rx path */
 		if (pmlmepriv->link_detect_info.num_rx_unicast_ok_in_period > 4) {
-			if (adapter_to_pwrctl(padapter)->bLeisurePs
-			    && (adapter_to_pwrctl(padapter)->pwr_mode != PS_MODE_ACTIVE)
-			    && !(hal_btcoex_IsBtControlLps(padapter)))
+			if (adapter_to_pwrctl(padapter)->bLeisurePs &&
+			    (adapter_to_pwrctl(padapter)->pwr_mode != PS_MODE_ACTIVE) &&
+			    !(hal_btcoex_IsBtControlLps(padapter)))
 				bLeaveLPS = true;
 		}
 	}
 
 	if (bLeaveLPS)
 		/* rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1); */
-		rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, tx?0:1);
+		rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, tx ? 0 : 1);
 }
 
 /*
@@ -306,11 +306,11 @@ static u8 PS_RDY_CHECK(struct adapter *padapter)
 	if (delta_time < LPS_DELAY_TIME)
 		return false;
 
-	if (check_fwstate(pmlmepriv, WIFI_SITE_MONITOR)
-		|| check_fwstate(pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS)
-		|| check_fwstate(pmlmepriv, WIFI_AP_STATE)
-		|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE)
-		|| rtw_is_scan_deny(padapter)
+	if (check_fwstate(pmlmepriv, WIFI_SITE_MONITOR) ||
+	    check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS) ||
+	    check_fwstate(pmlmepriv, WIFI_AP_STATE) ||
+	    check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE) ||
+	    rtw_is_scan_deny(padapter)
 	)
 		return false;
 
@@ -339,9 +339,9 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
 
 	/* if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) */
 	if (ps_mode == PS_MODE_ACTIVE) {
-		if (!(hal_btcoex_IsBtControlLps(padapter))
-				|| (hal_btcoex_IsBtControlLps(padapter)
-					&& !(hal_btcoex_IsLpsOn(padapter)))) {
+		if (!(hal_btcoex_IsBtControlLps(padapter)) ||
+		    (hal_btcoex_IsBtControlLps(padapter) &&
+		    !(hal_btcoex_IsLpsOn(padapter)))) {
 			pwrpriv->pwr_mode = ps_mode;
 			rtw_set_rpwm(padapter, PS_STATE_S4);
 

--
2.53.0

#7 lore raw

Re: [PATCH 2/4] staging: rtl8723bs: format operators and logical continuations

Quoted 7 lines · Jose A. Perez de Azpillaga

Fix spaces around different operators. Move logical continuations to the end of the previous line.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)

LGTM.

One thing to note though is since this is a patch series you'd typically want to have a cover letter describing your changes. And then you'd send it all together using git send-email so they tie together.

Thanks,

ET

Reviewed-by
#8 lore raw

Re: [PATCH 2/4] staging: rtl8723bs: format operators and logical continuations

Quoted 11 lines · Ethan Tidmore
Quoted 7 lines · Jose A. Perez de Azpillaga

Fix spaces around different operators. Move logical continuations to the end of the previous line.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)

LGTM.

Quoted 8 lines

One thing to note though is since this is a patch series you'd typically want to have a cover letter describing your changes. And then you'd send it all together using git send-email so they tie together.

Thanks,

ET

forgot RB.

Thanks,

ET

#9 lore raw

PATCH 3/4 staging: rtl8723bs: curly brace consistency

In reply to Jose A. Perez de Azpillaga

Fix unbalanced braces and improve readability.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +10 -6
index e75dd21b3390..2312fc42a619 100644
@@ -286,8 +286,9 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
 				break;
 			}
 		} while (1);
-	} else
+	} else {
 		pwrpriv->cpwm = pslv;
+	}
 }
 
 static u8 PS_RDY_CHECK(struct adapter *padapter)
@@ -445,8 +446,9 @@ void LPS_Enter(struct adapter *padapter, const char *msg)
 				pwrpriv->bpower_saving = true;
 				rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, padapter->registrypriv.smart_ps, 0, buf);
 			}
-		} else
+		} else {
 			pwrpriv->LpsIdleCount++;
+		}
 	}
 }
 
@@ -750,10 +752,10 @@ void rtw_unregister_task_alive(struct adapter *padapter, u32 task)
 	unregister_task_alive(pwrctrl, task);
 
 	if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && pwrctrl->fw_current_in_ps_mode) {
-		if (pwrctrl->cpwm > pslv)
+		if (pwrctrl->cpwm > pslv) {
 			if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
 				rtw_set_rpwm(padapter, pslv);
-
+		}
 	}
 
 	mutex_unlock(&pwrctrl->lock);
@@ -1073,8 +1075,9 @@ int rtw_pm_set_lps(struct adapter *padapter, u8 mode)
 			pwrctrlpriv->bLeisurePs =
 				pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE;
 		}
-	} else
+	} else {
 		ret = -EINVAL;
+	}
 
 	return ret;
 }
@@ -1090,8 +1093,9 @@ int rtw_pm_set_ips(struct adapter *padapter, u8 mode)
 		rtw_ips_mode_req(pwrctrlpriv, mode);
 		if ((padapter->bSurpriseRemoved == 0) && (rtw_pwr_wakeup(padapter) == _FAIL))
 			return -EFAULT;
-	} else
+	} else {
 		return -EINVAL;
+	}
 
 	return 0;
 }

--
2.53.0

#11 lore raw

PATCH 4/4 staging: rtl8723bs: fix indentation, line length and declarations

In reply to Jose A. Perez de Azpillaga

Fix indentation to match opening parentheses, wrap lines exceeding 100 columns, and add a missing blank line after variable declarations.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +8 -4
index 2312fc42a619..ec5753dafc2c 100644
@@ -113,7 +113,7 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
 	}
 
 	if (pxmit_priv->free_xmitbuf_cnt != NR_XMITBUFF ||
-		pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) {
+	    pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) {
 		netdev_dbg(adapter->pnetdev,
 			   "There are some pkts to transmit\n");
 		netdev_dbg(adapter->pnetdev,
@@ -325,7 +325,8 @@ static u8 PS_RDY_CHECK(struct adapter *padapter)
 	return true;
 }
 
-void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg)
+void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode,
+		     u8 smart_ps, u8 bcn_ant_mode, const char *msg)
 {
 	struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
 
@@ -352,7 +353,8 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
 			hal_btcoex_LpsNotify(padapter, ps_mode);
 		}
 	} else {
-		if ((PS_RDY_CHECK(padapter) && check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE)) ||
+		if ((PS_RDY_CHECK(padapter) &&
+		     check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE)) ||
 		    ((hal_btcoex_IsBtControlLps(padapter)) && (hal_btcoex_IsLpsOn(padapter)))
 			) {
 			u8 pslv;
@@ -444,7 +446,8 @@ void LPS_Enter(struct adapter *padapter, const char *msg)
 			if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) {
 				scnprintf(buf, sizeof(buf), "WIFI-%s", msg);
 				pwrpriv->bpower_saving = true;
-				rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, padapter->registrypriv.smart_ps, 0, buf);
+				rtw_set_ps_mode(padapter, pwrpriv->power_mgnt,
+						padapter->registrypriv.smart_ps, 0, buf);
 			}
 		} else {
 			pwrpriv->LpsIdleCount++;
@@ -981,6 +984,7 @@ void rtw_free_pwrctrl_priv(struct adapter *adapter)
 inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms)
 {
 	struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
+
 	pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ms);
 }
 

--
2.53.0