[U-Boot] [RFC PATCH 09/50] net: calxedaxgmac: Pull out init of struct eth_ops

Tomas Hlavacek tmshlvck at gmail.com
Fri Nov 2 18:18:01 CET 2012


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 at gmail.com>
---
 drivers/net/calxedaxgmac.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

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);
 
-- 
1.7.10.4



More information about the U-Boot mailing list