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

Tomas Hlavacek tmshlvck at gmail.com
Fri Nov 2 18:18:00 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/bfin_mac.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index ef4736f..b2c4b0f 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -91,6 +91,14 @@ static int bfin_miiphy_write(const char *devname, uchar addr, uchar reg, ushort
 	return 0;
 }
 
+static struct eth_ops bfin_emac_ops = {
+	.init = bfin_EMAC_init,
+	.halt = bfin_EMAC_halt,
+	.send = bfin_EMAC_send,
+	.recv = bfin_EMAC_recv,
+	.write_hwaddr = bfin_EMAC_setup_addr
+};
+
 int bfin_EMAC_initialize(bd_t *bis)
 {
 	struct eth_device *dev;
@@ -103,11 +111,7 @@ int bfin_EMAC_initialize(bd_t *bis)
 
 	dev->iobase = 0;
 	dev->priv = 0;
-	dev->eo->init = bfin_EMAC_init;
-	dev->eo->halt = bfin_EMAC_halt;
-	dev->eo->send = bfin_EMAC_send;
-	dev->eo->recv = bfin_EMAC_recv;
-	dev->eo->write_hwaddr = bfin_EMAC_setup_addr;
+	dev->eo = &bfin_emac_ops;
 
 	eth_register(dev);
 
-- 
1.7.10.4



More information about the U-Boot mailing list