Skip to contentSkip to conversation

staging: Remove unnecessary parentheses

PATCH In review Dorine Tipo 3 participants 4 messages Oct 30, 2023 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: Remove unnecessary parentheses

- Remove the unnecessary parentheses around
'priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII'

The '==' operator has higher precedence than the '&&' and '||' operators. Removing the unnecessary parentheses simplifies the code while maintaining the correct order of operations, making it more readable.

---
 drivers/staging/octeon/ethernet-rgmii.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/octeon/ethernet-rgmii.c +1 -1
index 0c4fac31540a..15d2c84925ba 100644
@@ -148,7 +148,7 @@ int cvm_oct_rgmii_open(struct net_device *dev)
 		 */
 		if ((priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII &&
 		     priv->port  == 0) ||
-		    (priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) {
+		    priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII) {
 			priv->poll = cvm_oct_check_preamble_errors;
 			cvm_oct_check_preamble_errors(dev);
 		}
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Dorine Tipo
drivers/staging/octeon/ethernet-rgmii.c +0 -0
index 0c4fac31540a..15d2c84925ba 100644

drivers/staging/octeon/ethernet-rgmii.c int cvm_oct_rgmii_open(struct net_device *dev) · line 154

Quoted 8 lines
drivers/staging/octeon/ethernet-rgmii.c +1 -1
@@ -148,7 +148,7 @@ int cvm_oct_rgmii_open(struct net_device *dev)
 		 */
 		if ((priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII &&
 		     priv->port  == 0) ||
-		    (priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) {
+		    priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII) {
 			priv->poll = cvm_oct_check_preamble_errors;
 			cvm_oct_check_preamble_errors(dev);
 		}

I'd prefer explicit parens on the right-hand side of || instead (to match the left-hand one).

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
maintainer
#2 lore raw
Quoted 10 lines · Bagas Sanjaya
Quoted 9 lines · Dorine Tipo
drivers/staging/octeon/ethernet-rgmii.c +0 -1
index 0c4fac31540a..15d2c84925ba 100644
@@ -148,7 +148,7 @@ int cvm_oct_rgmii_open(struct net_device *dev)
 		 */
 		if ((priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII &&
 		     priv->port  == 0) ||
-		    (priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) {
Quoted 8 lines

drivers/staging/octeon/ethernet-rgmii.c int cvm_oct_rgmii_open(struct net_device *dev) · line 154

Quoted 5 lines
drivers/staging/octeon/ethernet-rgmii.c +1 -0
+		    priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII) {
 			priv->poll = cvm_oct_check_preamble_errors;
 			cvm_oct_check_preamble_errors(dev);
 		}

I'd prefer explicit parens on the right-hand side of || instead (to match the left-hand one).

Sorry, but as always for this type of change, I will reject it so there's no need to ask for it to be cleaned up any other way.

Dorine, this type of change is constantly rejected on the mailing list that you should be copying all of these patches to. Please search the archives for reasons why.

thanks,

greg k-h

#3 lore raw
Quoted 20 lines · Greg KH
Quoted 10 lines · Bagas Sanjaya
Quoted 9 lines · Dorine Tipo
drivers/staging/octeon/ethernet-rgmii.c +0 -1
index 0c4fac31540a..15d2c84925ba 100644
@@ -148,7 +148,7 @@ int cvm_oct_rgmii_open(struct net_device *dev)
 		 */
 		if ((priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII &&
 		     priv->port  == 0) ||
-		    (priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) {
Quoted 8 lines

drivers/staging/octeon/ethernet-rgmii.c int cvm_oct_rgmii_open(struct net_device *dev) · line 154

Quoted 5 lines
drivers/staging/octeon/ethernet-rgmii.c +1 -0
+		    priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII) {
 			priv->poll = cvm_oct_check_preamble_errors;
 			cvm_oct_check_preamble_errors(dev);
 		}

I'd prefer explicit parens on the right-hand side of || instead (to match the left-hand one).

Quoted 2 lines

Sorry, but as always for this type of change, I will reject it so there's no need to ask for it to be cleaned up any other way.

Oh dear! That's what I mean (keeping the status quo/code unchanged).

Quoted 4 lines

Dorine, this type of change is constantly rejected on the mailing list that you should be copying all of these patches to. Please search the archives for reasons why.

Greg has review discussions on why it is the case ([1] and [2]).

[1]: https://lore.kernel.org/all/Y%[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara