diff mbox

[U-Boot,06/10] net: axi_emac: Pass private structure where possible

Message ID ad167473f130feb9ab54d7b57b6bf6effa71c782.1449835152.git.michal.simek@xilinx.com
State Accepted
Commit f09854810cf99c0bf3a31a5d26b4c556186ea302
Delegated to: Michal Simek
Headers show

Commit Message

Michal Simek Dec. 11, 2015, 11:59 a.m. UTC
Simplify move to DM to avoid handling with eth_device structure.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/net/xilinx_axi_emac.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Comments

Joe Hershberger Dec. 15, 2015, 8:15 p.m. UTC | #1
On Fri, Dec 11, 2015 at 5:59 AM, Michal Simek <michal.simek@xilinx.com> wrote:
> Simplify move to DM to avoid handling with eth_device structure.

I think you need to change this commit log. You are moving functions
to use axidma_priv instead of eth_device in preparation of the DM
move. You are not actually moving to DM with this patch.

> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
diff mbox

Patch

diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index 20ff6b089830..77b1869dc9dc 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -315,9 +315,9 @@  static void axiemac_halt(struct eth_device *dev)
 	debug("axiemac: Halted\n");
 }
 
-static int axi_ethernet_init(struct eth_device *dev)
+static int axi_ethernet_init(struct axidma_priv *priv)
 {
-	struct axi_regs *regs = (struct axi_regs *)dev->iobase;
+	struct axi_regs *regs = priv->iobase;
 	u32 timeout = 200;
 
 	/*
@@ -374,9 +374,8 @@  static int axiemac_setup_mac(struct eth_device *dev)
 }
 
 /* Reset DMA engine */
-static void axi_dma_init(struct eth_device *dev)
+static void axi_dma_init(struct axidma_priv *priv)
 {
-	struct axidma_priv *priv = dev->priv;
 	u32 timeout = 500;
 
 	/* Reset the engine so the hardware starts from a known state */
@@ -410,10 +409,10 @@  static int axiemac_init(struct eth_device *dev, bd_t * bis)
 	 * reset, and since AXIDMA reset line is connected to AxiEthernet, this
 	 * would ensure a reset of AxiEthernet.
 	 */
-	axi_dma_init(dev);
+	axi_dma_init(priv);
 
 	/* Initialize AxiEthernet hardware. */
-	if (axi_ethernet_init(dev))
+	if (axi_ethernet_init(priv))
 		return -1;
 
 	/* Disable all RX interrupts before RxBD space setup */
@@ -511,10 +510,9 @@  static int axiemac_send(struct eth_device *dev, void *ptr, int len)
 	return 0;
 }
 
-static int isrxready(struct eth_device *dev)
+static int isrxready(struct axidma_priv *priv)
 {
 	u32 status;
-	struct axidma_priv *priv = dev->priv;
 
 	/* Read pending interrupts */
 	status = in_be32(&priv->dmarx->status);
@@ -539,7 +537,7 @@  static int axiemac_recv(struct eth_device *dev)
 	u32 temp;
 
 	/* Wait for an incoming packet */
-	if (!isrxready(dev))
+	if (!isrxready(priv))
 		return 0;
 
 	debug("axiemac: RX data ready\n");