Skip to content

Commit 3f8c91a

Browse files
andim2davem330
authored andcommitted
via-rhine: fix wait-bit inversion.
Bug appeared in a384a33 ("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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 72331bc commit 3f8c91a

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎drivers/net/ethernet/via/via-rhine.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -503,30 +503,32 @@ static int rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid);
503503
static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid);
504504
static void rhine_restart_tx(struct net_device *dev);
505505

506-
static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool high)
506+
static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool low)
507507
{
508508
void __iomem *ioaddr = rp->base;
509509
int i;
510510

511511
for (i = 0; i < 1024; i++) {
512-
if (high ^ !!(ioread8(ioaddr + reg) & mask))
512+
bool has_mask_bits = !!(ioread8(ioaddr + reg) & mask);
513+
514+
if (low ^ has_mask_bits)
513515
break;
514516
udelay(10);
515517
}
516518
if (i > 64) {
517519
netif_dbg(rp, hw, rp->dev, "%s bit wait (%02x/%02x) cycle "
518-
"count: %04d\n", high ? "high" : "low", reg, mask, i);
520+
"count: %04d\n", low ? "low" : "high", reg, mask, i);
519521
}
520522
}
521523

522524
static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask)
523525
{
524-
rhine_wait_bit(rp, reg, mask, true);
526+
rhine_wait_bit(rp, reg, mask, false);
525527
}
526528

527529
static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask)
528530
{
529-
rhine_wait_bit(rp, reg, mask, false);
531+
rhine_wait_bit(rp, reg, mask, true);
530532
}
531533

532534
static u32 rhine_get_events(struct rhine_private *rp)

0 commit comments

Comments
 (0)