Patchwork [U-Boot,RFC,46/50] net: xilinx_axi_emac: Pull out init of struct eth_ops

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 2, 2012, 5:18 p.m.
Message ID <1351876722-5183-47-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196671/
State Superseded
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 2, 2012, 5:18 p.m.
Add static struct eth_ops and set ops function pointers statically.
Remove setting eth_ops members dynamically.

This is a step toward converting the driver for DM.

Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>
---
 drivers/net/xilinx_axi_emac.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index 54a871b..44ece48 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -622,6 +622,15 @@  static int axiemac_bus_reset(struct mii_dev *bus)
 	return 0;
 }
 
+static struct eth_ops axiemac_ops = {
+	.init = axiemac_init,
+	.halt = axiemac_halt,
+	.send = axiemac_send,
+	.recv = axiemac_recv,
+	.write_hwaddr = axiemac_setup_mac
+};
+
+
 int xilinx_axiemac_initialize(bd_t *bis, unsigned long base_addr,
 							unsigned long dma_addr)
 {
@@ -645,11 +654,7 @@  int xilinx_axiemac_initialize(bd_t *bis, unsigned long base_addr,
 	priv->dmatx = (struct axidma_reg *)dma_addr;
 	/* RX channel offset is 0x30 */
 	priv->dmarx = (struct axidma_reg *)(dma_addr + 0x30);
-	dev->eo->init = axiemac_init;
-	dev->eo->halt = axiemac_halt;
-	dev->eo->send = axiemac_send;
-	dev->eo->recv = axiemac_recv;
-	dev->eo->write_hwaddr = axiemac_setup_mac;
+	dev->eo = &axiemac_ops;
 
 #ifdef CONFIG_PHY_ADDR
 	priv->phyaddr = CONFIG_PHY_ADDR;