Browse Source

macb: Fix build with macro'ized readl/writel.

If an architecture defines readl/writel using CPP macros, we
get the following kinds of build failure:

> > > drivers/net/ethernet/cadence/macb.c:164:1: error: macro "writel"
> > > passed 3 arguments, but takes just 2
>      macb_or_gem_writel(bp, SA1B, bottom);
>     ^

Rename the methods so that this doesn't happen.

Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller 10 years ago
parent
commit
7a6e0706c0
2 changed files with 15 additions and 15 deletions
  1. 7 7
      drivers/net/ethernet/cadence/macb.c
  2. 8 8
      drivers/net/ethernet/cadence/macb.h

+ 7 - 7
drivers/net/ethernet/cadence/macb.c

@@ -506,7 +506,7 @@ static void macb_update_stats(struct macb *bp)
 	WARN_ON((unsigned long)(end - p - 1) != (MACB_TPF - MACB_PFR) / 4);
 	WARN_ON((unsigned long)(end - p - 1) != (MACB_TPF - MACB_PFR) / 4);
 
 
 	for(; p < end; p++, offset += 4)
 	for(; p < end; p++, offset += 4)
-		*p += bp->readl(bp, offset);
+		*p += bp->macb_reg_readl(bp, offset);
 }
 }
 
 
 static int macb_halt_tx(struct macb *bp)
 static int macb_halt_tx(struct macb *bp)
@@ -1934,14 +1934,14 @@ static void gem_update_stats(struct macb *bp)
 
 
 	for (i = 0; i < GEM_STATS_LEN; ++i, ++p) {
 	for (i = 0; i < GEM_STATS_LEN; ++i, ++p) {
 		u32 offset = gem_statistics[i].offset;
 		u32 offset = gem_statistics[i].offset;
-		u64 val = bp->readl(bp, offset);
+		u64 val = bp->macb_reg_readl(bp, offset);
 
 
 		bp->ethtool_stats[i] += val;
 		bp->ethtool_stats[i] += val;
 		*p += val;
 		*p += val;
 
 
 		if (offset == GEM_OCTTXL || offset == GEM_OCTRXL) {
 		if (offset == GEM_OCTTXL || offset == GEM_OCTRXL) {
 			/* Add GEM_OCTTXH, GEM_OCTRXH */
 			/* Add GEM_OCTTXH, GEM_OCTRXH */
-			val = bp->readl(bp, offset + 4);
+			val = bp->macb_reg_readl(bp, offset + 4);
 			bp->ethtool_stats[i] += ((u64)val) << 32;
 			bp->ethtool_stats[i] += ((u64)val) << 32;
 			*(++p) += val;
 			*(++p) += val;
 		}
 		}
@@ -2867,11 +2867,11 @@ static int macb_probe(struct platform_device *pdev)
 	bp->regs = mem;
 	bp->regs = mem;
 	bp->native_io = native_io;
 	bp->native_io = native_io;
 	if (native_io) {
 	if (native_io) {
-		bp->readl = hw_readl_native;
-		bp->writel = hw_writel_native;
+		bp->macb_reg_readl = hw_readl_native;
+		bp->macb_reg_writel = hw_writel_native;
 	} else {
 	} else {
-		bp->readl = hw_readl;
-		bp->writel = hw_writel;
+		bp->macb_reg_readl = hw_readl;
+		bp->macb_reg_writel = hw_writel;
 	}
 	}
 	bp->num_queues = num_queues;
 	bp->num_queues = num_queues;
 	bp->queue_mask = queue_mask;
 	bp->queue_mask = queue_mask;

+ 8 - 8
drivers/net/ethernet/cadence/macb.h

@@ -429,12 +429,12 @@
 	 | GEM_BF(name, value))
 	 | GEM_BF(name, value))
 
 
 /* Register access macros */
 /* Register access macros */
-#define macb_readl(port, reg)		(port)->readl((port), MACB_##reg)
-#define macb_writel(port, reg, value)	(port)->writel((port), MACB_##reg, (value))
-#define gem_readl(port, reg)		(port)->readl((port), GEM_##reg)
-#define gem_writel(port, reg, value)	(port)->writel((port), GEM_##reg, (value))
-#define queue_readl(queue, reg)		(queue)->bp->readl((queue)->bp, (queue)->reg)
-#define queue_writel(queue, reg, value)	(queue)->bp->writel((queue)->bp, (queue)->reg, (value))
+#define macb_readl(port, reg)		(port)->macb_reg_readl((port), MACB_##reg)
+#define macb_writel(port, reg, value)	(port)->macb_reg_writel((port), MACB_##reg, (value))
+#define gem_readl(port, reg)		(port)->macb_reg_readl((port), GEM_##reg)
+#define gem_writel(port, reg, value)	(port)->macb_reg_writel((port), GEM_##reg, (value))
+#define queue_readl(queue, reg)		(queue)->bp->macb_reg_readl((queue)->bp, (queue)->reg)
+#define queue_writel(queue, reg, value)	(queue)->bp->macb_reg_writel((queue)->bp, (queue)->reg, (value))
 
 
 /* Conditional GEM/MACB macros.  These perform the operation to the correct
 /* Conditional GEM/MACB macros.  These perform the operation to the correct
  * register dependent on whether the device is a GEM or a MACB.  For registers
  * register dependent on whether the device is a GEM or a MACB.  For registers
@@ -782,8 +782,8 @@ struct macb {
 	bool			native_io;
 	bool			native_io;
 
 
 	/* hardware IO accessors */
 	/* hardware IO accessors */
-	u32	(*readl)(struct macb *bp, int offset);
-	void	(*writel)(struct macb *bp, int offset, u32 value);
+	u32	(*macb_reg_readl)(struct macb *bp, int offset);
+	void	(*macb_reg_writel)(struct macb *bp, int offset, u32 value);
 
 
 	unsigned int		rx_tail;
 	unsigned int		rx_tail;
 	unsigned int		rx_prepared_head;
 	unsigned int		rx_prepared_head;