Patchwork [U-Boot,RFC,09/50] net: calxedaxgmac: 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-10-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196640/
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/calxedaxgmac.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/net/calxedaxgmac.c b/drivers/net/calxedaxgmac.c
index 2346feb..3550160 100644
--- a/drivers/net/calxedaxgmac.c
+++ b/drivers/net/calxedaxgmac.c
@@ -508,6 +508,15 @@  static void xgmac_halt(struct eth_device *dev)
 	priv->rx_currdesc = 0;
 }
 
+static struct eth_ops xgmac_ops = {
+	.init = xgmac_init,
+	.send = xgmac_tx,
+	.recv = xgmac_rx,
+	.halt = xgmac_halt
+};
+
+
+
 int calxedaxgmac_initialize(u32 id, ulong base_addr)
 {
 	struct eth_device *dev;
@@ -543,10 +552,7 @@  int calxedaxgmac_initialize(u32 id, ulong base_addr)
 	macaddr[0] = readl(&regs->macaddr[0].lo);
 	memcpy(dev->enetaddr, macaddr, 6);
 
-	dev->eo->init = xgmac_init;
-	dev->eo->send = xgmac_tx;
-	dev->eo->recv = xgmac_rx;
-	dev->eo->halt = xgmac_halt;
+	dev->eo = &xgmac_ops;
 
 	eth_register(dev);