net/macb: move to circ_buf macros and fix initial condition
authorNicolas Ferre <nicolas.ferre@atmel.com>
Mon, 19 Nov 2012 06:00:21 +0000 (06:00 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 Nov 2012 19:21:25 +0000 (14:21 -0500)
commit909a85834d4e082501c26dd745b7caacf4eb1db3
tree5f92556445c6cea1485262d02658e11a3a3a7ff4
parente5ef39eda6a1dfc045445d1199e5508703d139df
net/macb: move to circ_buf macros and fix initial condition

Move to circular buffers management macro and correct an error
with circular buffer initial condition.

Without this patch, the macb_tx_ring_avail() function was
not reporting the proper ring availability at startup:
macb macb: eth0: BUG! Tx Ring full when queue awake!
macb macb: eth0: tx_head = 0, tx_tail = 0
And hanginig forever...

I remove the macb_tx_ring_avail() function and use the
proven macros from circ_buf.h. CIRC_CNT() is used in the
"consumer" part of the driver: macb_tx_interrupt() to match
advice from Documentation/circular-buffers.txt.

Reported-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Tested-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cadence/macb.c