diff options
author | Andreas Mohr <andi@lisas.de> | 2012-04-01 08:35:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-01 23:09:36 -0400 |
commit | 3f8c91a7398b9266fbe7abcbe4bd5dffef907643 (patch) | |
tree | b49aab8ce6ded6ba2c718ce889bfa80d5e42f246 /drivers/net/ethernet/via | |
parent | 72331bc0cd072c3f4b670cd1256e47681fc53b80 (diff) |
via-rhine: fix wait-bit inversion.
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/via')
-rw-r--r-- | drivers/net/ethernet/via/via-rhine.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index 39b8cf3dafcd..fcfa01f7ceb6 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); | |||
503 | static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid); | 503 | static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid); |
504 | static void rhine_restart_tx(struct net_device *dev); | 504 | static void rhine_restart_tx(struct net_device *dev); |
505 | 505 | ||
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) |
507 | { | 507 | { |
508 | void __iomem *ioaddr = rp->base; | 508 | void __iomem *ioaddr = rp->base; |
509 | int i; | 509 | int i; |
510 | 510 | ||
511 | for (i = 0; i < 1024; i++) { | 511 | 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) | ||
513 | break; | 515 | break; |
514 | udelay(10); | 516 | udelay(10); |
515 | } | 517 | } |
516 | if (i > 64) { | 518 | if (i > 64) { |
517 | netif_dbg(rp, hw, rp->dev, "%s bit wait (%02x/%02x) cycle " | 519 | 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); |
519 | } | 521 | } |
520 | } | 522 | } |
521 | 523 | ||
522 | static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask) | 524 | static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask) |
523 | { | 525 | { |
524 | rhine_wait_bit(rp, reg, mask, true); | 526 | rhine_wait_bit(rp, reg, mask, false); |
525 | } | 527 | } |
526 | 528 | ||
527 | static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask) | 529 | static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask) |
528 | { | 530 | { |
529 | rhine_wait_bit(rp, reg, mask, false); | 531 | rhine_wait_bit(rp, reg, mask, true); |
530 | } | 532 | } |
531 | 533 | ||
532 | static u32 rhine_get_events(struct rhine_private *rp) | 534 | static u32 rhine_get_events(struct rhine_private *rp) |