diff mbox

via-rhine: fix wait-bit inversion.

Message ID 20120401223500.GA28138@electric-eye.fr.zoreil.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Francois Romieu April 1, 2012, 10:35 p.m. UTC
From: Andreas Mohr <andi@lisas.de>

Bug appeared in a384a33bb1c9ec2d99db2046b41f57023fa7d77b
("via-rhine: RHINE_WAIT_FOR macro removal). It can be noticed
during suspend/resume.

Signed-off-by: Andreas Mohr <andi@lisas.de>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: David Lv <DavidLv@viatech.com.cn>
---

 It should be fed to 3.3-stable.

 drivers/net/ethernet/via/via-rhine.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

Comments

David Miller April 2, 2012, 3:10 a.m. UTC | #1
From: Francois Romieu <romieu@fr.zoreil.com>
Date: Mon, 2 Apr 2012 00:35:00 +0200

> From: Andreas Mohr <andi@lisas.de>
> 
> Bug appeared in a384a33bb1c9ec2d99db2046b41f57023fa7d77b
> ("via-rhine: RHINE_WAIT_FOR macro removal). It can be noticed
> during suspend/resume.
> 
> Signed-off-by: Andreas Mohr <andi@lisas.de>
> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
> Cc: David Lv <DavidLv@viatech.com.cn>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Mohr April 2, 2012, 5:43 a.m. UTC | #2
Hi,

On Sun, Apr 01, 2012 at 11:10:44PM -0400, David Miller wrote:
> From: Francois Romieu <romieu@fr.zoreil.com>
> Date: Mon, 2 Apr 2012 00:35:00 +0200
> 
> > From: Andreas Mohr <andi@lisas.de>
> > 
> > Bug appeared in a384a33bb1c9ec2d99db2046b41f57023fa7d77b
> > ("via-rhine: RHINE_WAIT_FOR macro removal). It can be noticed
> > during suspend/resume.
> > 
> > Signed-off-by: Andreas Mohr <andi@lisas.de>
> > Acked-by: Francois Romieu <romieu@fr.zoreil.com>
> > Cc: David Lv <DavidLv@viatech.com.cn>
> 
> Applied and queued up for -stable, thanks.

Fully happy with all "automatisms" (Signed-off-by etc. -
I didn't bother at that time for such a minor step),
thank you for very fast/cooperative handling to all involved parties!

Side note (not mentioned yet): that fix was sufficient to get HEAD
(well, at least f2cedb63df14342) working, too.

Thanks,

Andreas Mohr
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 39b8cf3..fcfa01f 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -503,30 +503,32 @@  static int rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid);
 static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid);
 static void rhine_restart_tx(struct net_device *dev);
 
-static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool high)
+static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool low)
 {
 	void __iomem *ioaddr = rp->base;
 	int i;
 
 	for (i = 0; i < 1024; i++) {
-		if (high ^ !!(ioread8(ioaddr + reg) & mask))
+		bool has_mask_bits = !!(ioread8(ioaddr + reg) & mask);
+
+		if (low ^ has_mask_bits)
 			break;
 		udelay(10);
 	}
 	if (i > 64) {
 		netif_dbg(rp, hw, rp->dev, "%s bit wait (%02x/%02x) cycle "
-			  "count: %04d\n", high ? "high" : "low", reg, mask, i);
+			  "count: %04d\n", low ? "low" : "high", reg, mask, i);
 	}
 }
 
 static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask)
 {
-	rhine_wait_bit(rp, reg, mask, true);
+	rhine_wait_bit(rp, reg, mask, false);
 }
 
 static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask)
 {
-	rhine_wait_bit(rp, reg, mask, false);
+	rhine_wait_bit(rp, reg, mask, true);
 }
 
 static u32 rhine_get_events(struct rhine_private *rp)