Skip to contentSkip to conversation

net/tg3: simplify conditional

PATCH Applied Nicolas Kaiser 3 participants 3 messages Oct 8, 2010 – Oct 9, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/tg3: simplify conditional

Simplify: ((a && !b) || (!a && b)) => (a != b)

---
 drivers/net/tg3.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/tg3.c +1 -2
index 16e1a95..714f0fb 100644
@@ -9967,8 +9967,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
 
 		if (!(phydev->supported & SUPPORTED_Pause) ||
 		    (!(phydev->supported & SUPPORTED_Asym_Pause) &&
-		     ((epause->rx_pause && !epause->tx_pause) ||
-		      (!epause->rx_pause && epause->tx_pause))))
+		     (epause->rx_pause != epause->tx_pause)))
 			return -EINVAL;
 
 		tp->link_config.flowctrl = 0;
Signature · 1 line
1.7.2.2
#1 lore raw
Quoted 12 lines · Nicolas Kaiser

Simplify: ((a && !b) || (!a && b)) => (a != b)

---
 drivers/net/tg3.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/tg3.c +0 -0
index 16e1a95..714f0fb 100644

drivers/net/tg3.c static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam · line 9973

Quoted 9 lines
drivers/net/tg3.c +1 -2
@@ -9967,8 +9967,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
 
 		if (!(phydev->supported & SUPPORTED_Pause) ||
 		    (!(phydev->supported & SUPPORTED_Asym_Pause) &&
-		     ((epause->rx_pause && !epause->tx_pause) ||
-		      (!epause->rx_pause && epause->tx_pause))))
+		     (epause->rx_pause != epause->tx_pause)))
 			return -EINVAL;
 
 		tp->link_config.flowctrl = 0;

Looks good to me.

maintainer Applied
#2 lore raw

From: "Matt Carlson" <[email protected]>
Date: Fri, 8 Oct 2010 10:43:12 -0700

Quoted 4 lines · Nicolas Kaiser
Quoted 3 lines

Simplify: ((a && !b) || (!a && b)) => (a != b)

...

Quoted 1 line

Looks good to me.

Applied.

Matt, you can give an "Acked-by: " tag to indicate your approval of a patch in the future :-)

Thanks.