Skip to contentSkip to conversation

Simplify expressions in phydm_debug.c

PATCH In review Nishka Dasgupta 2 participants 4 messages Mar 30, 2019 Staging

lore
Share & tools
lore
#0 lore raw

v5 cover Simplify expressions in phydm_debug.c

This patchset removes parentheses from the right-hand side of expressions in phydm_debug.c and also moves an operator to the right hand side to make the code more readable.

Nishka Dasgupta (2):
staging: rtlwifi: phydm: Remove parentheses
staging: rtlwifi: phydm: Simplify status = status & <expression>

 drivers/staging/rtlwifi/phydm/phydm_debug.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
Signature · 3 lines
Changes in v5:
- Make the two patches a patchset.
2.19.1
#1 lore raw

PATCH v5 1/2 staging: rtlwifi: phydm: Remove parentheses

Remove parentheses on right hand side of expression. Issue found with Coccinelle.

---
 drivers/staging/rtlwifi/phydm/phydm_debug.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtlwifi/phydm/phydm_debug.c +5 -5
index 91f2c054d83b..a113e2b63153 100644
@@ -51,20 +51,20 @@ static inline void phydm_check_dmval_txagc(struct phy_dm_struct *dm, u32 used,
 				      (power_index << 16) | (power_index << 8) |
 				      (power_index);
 			for (i = 0; i < ODM_RATEVHTSS2MCS9; i += 4)
-				status = (status &
+				status = status &
 					  phydm_api_set_txagc(
 						  dm, power_index,
 						  (enum odm_rf_radio_path)
 							  dm_value[1],
-						  i, false));
+						  i, false);
 		} else if (dm->support_ic_type & ODM_RTL8197F) {
 			for (i = 0; i <= ODM_RATEMCS15; i++)
-				status = (status &
-					  phydm_api_set_txagc(
+				status = status &
+					 phydm_api_set_txagc(
 						  dm, power_index,
 						  (enum odm_rf_radio_path)
 							  dm_value[1],
-						  i, false));
+						  i, false);
 		}
 
 		if (status)
Signature · 1 line
2.19.1
#2 lore raw

PATCH v5 2/2 staging: rtlwifi: phydm: Simplify `status = status & <expression>`

In reply to Nishka Dasgupta

Simplify occurrences of status = status & <expression> by modifying them to `status &= <expression> to make the code more readable.

---
 drivers/staging/rtlwifi/phydm/phydm_debug.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/rtlwifi/phydm/phydm_debug.c +2 -6
index a113e2b63153..5e0151036542 100644
@@ -51,17 +51,13 @@ static inline void phydm_check_dmval_txagc(struct phy_dm_struct *dm, u32 used,
 				      (power_index << 16) | (power_index << 8) |
 				      (power_index);
 			for (i = 0; i < ODM_RATEVHTSS2MCS9; i += 4)
-				status = status &
-					  phydm_api_set_txagc(
-						  dm, power_index,
+				status &= phydm_api_set_txagc(dm, power_index,
 						  (enum odm_rf_radio_path)
 							  dm_value[1],
 						  i, false);
 		} else if (dm->support_ic_type & ODM_RTL8197F) {
 			for (i = 0; i <= ODM_RATEMCS15; i++)
-				status = status &
-					 phydm_api_set_txagc(
-						  dm, power_index,
+				status &= phydm_api_set_txagc(dm, power_index,
 						  (enum odm_rf_radio_path)
 							  dm_value[1],
 						  i, false);
Signature · 1 line
2.19.1
#3 lore raw

Re: [Outreachy kernel] [PATCH 2/2 v5] staging: rtlwifi: phydm: Simplify `status = status & <expression>`

Quoted 2 lines · Nishka Dasgupta' via outreachy-kernel

Simplify occurrences of status = status & <expression> by modifying them to `status &= <expression> to make the code more readable.

There needs to be three patches. The arguments should be moved up in a separate one. The log message of this one doens't mention that.

julia

Quoted 40 lines
---
 drivers/staging/rtlwifi/phydm/phydm_debug.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/rtlwifi/phydm/phydm_debug.c +2 -7
index a113e2b63153..5e0151036542 100644
@@ -51,17 +51,13 @@ static inline void phydm_check_dmval_txagc(struct phy_dm_struct *dm, u32 used,
 				      (power_index << 16) | (power_index << 8) |
 				      (power_index);
 			for (i = 0; i < ODM_RATEVHTSS2MCS9; i += 4)
-				status = status &
-					  phydm_api_set_txagc(
-						  dm, power_index,
+				status &= phydm_api_set_txagc(dm, power_index,
 						  (enum odm_rf_radio_path)
 							  dm_value[1],
 						  i, false);
 		} else if (dm->support_ic_type & ODM_RTL8197F) {
 			for (i = 0; i <= ODM_RATEMCS15; i++)
-				status = status &
-					 phydm_api_set_txagc(
-						  dm, power_index,
+				status &= phydm_api_set_txagc(dm, power_index,
 						  (enum odm_rf_radio_path)
 							  dm_value[1],
 						  i, false);
--

2.19.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/423db52767ef4efafe5a078aecb1691d4bab9138.1553964092.git.nishka.dasgupta%40yahoo.com.
For more options, visit https://groups.google.com/d/optout.