Re: [PATCH 1/2] net: macb: Separate rx and tx ring init function

From: Varka Bhadram
Date: Fri Jul 18 2014 - 06:16:48 EST


On 07/18/2014 03:43 PM, Neil Armstrong wrote:
Le 18/07/2014 12:10, Varka Bhadram a écrit :
On 07/18/2014 03:22 PM, Neil Armstrong wrote:
A single method is called to initialize the TX and RX
rings. Separate the methods into distinct ones for
MACB and GEM context.

Signed-off-by: Neil Armstrong <narmstrong@xxxxxxxxxxx>
---
drivers/net/ethernet/cadence/macb.c | 33 ++++++++++++++++++++++++---------
drivers/net/ethernet/cadence/macb.h | 3 ++-
2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index e9daa07..20ad483 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1219,7 +1219,14 @@ out_err:
return -ENOMEM;
}
-static void gem_init_rings(struct macb *bp)
+static void gem_init_rx_rings(struct macb *bp)
+{
+ bp->rx_tail = bp->rx_prepared_head = 0;
+
+ gem_rx_refill(bp);
+}
+
+static void gem_init_tx_rings(struct macb *bp)
{
int i;
@@ -1229,12 +1236,10 @@ static void gem_init_rings(struct macb *bp)
}
bp->tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP);
- bp->rx_tail = bp->rx_prepared_head = bp->tx_head = bp->tx_tail = 0;
-
- gem_rx_refill(bp);
+ bp->tx_head = bp->tx_tail = 0;
This is not the preferred way of doing it....

multiple assignments should be avoided
Should I change it ? I only moved the lines, the logic hasn't changed.

Yes. we can change the logic also.... :-)

--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/