[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1356967549-5056-4-git-send-email-andi@lisas.de>
Date: Mon, 31 Dec 2012 16:25:37 +0100
From: Andreas Mohr <andi@...as.de>
To: andim2@...rs.sf.net
Cc: Roger Luethi <rl@...lgate.ch>, netdev@...r.kernel.org,
Francois Romieu <romieu@...zoreil.com>
Subject: [PATCH RFC 03/15] via-rhine: small rhine_wait_bit() improvement.
From: Andreas Mohr <andim2@...rs.sf.net>
Precalculate actual I/O address,
make sure to remember value in helper variable,
add a logging helper line.
Signed-off-by: Andreas Mohr <andim2@...rs.sf.net>
---
drivers/net/ethernet/via/via-rhine.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 928d96f..6be6566 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -505,11 +505,19 @@ static void rhine_restart_tx(struct net_device *dev);
static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool low)
{
- void __iomem *ioaddr = rp->base;
+ void __iomem *ioaddr_reg = rp->base;
int i;
+ ioaddr_reg += reg;
for (i = 0; i < 1024; i++) {
- bool has_mask_bits = !!(ioread8(ioaddr + reg) & mask);
+ u8 val = ioread8(ioaddr_reg);
+ bool has_mask_bits = !!(val & mask);
+
+ if (i < 20 /* avoid log spew */) {
+ /* netif_err(rp, hw, rp->dev,
+ "wait_bit %02x val %02x mask %02x %s hmb %d\n",
+ reg, val, mask, low ? "low" : "high", has_mask_bits); */
+ }
if (low ^ has_mask_bits)
break;
--
1.7.2.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists