[U-Boot] [PATCH v2 63/67] net: fm_eth: Pull out init of struct eth_ops

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:23:54 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/fm/eth.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index 8d881d4..d148957 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -611,6 +611,13 @@ static int init_phy(struct eth_device *dev)
 	return 0;
 }
 
+static struct eth_ops fm_eth_ops = {
+	.init = fm_eth_open,
+	.halt = fm_eth_halt,
+	.send = fm_eth_send,
+	.recv = fm_eth_recv
+};
+
 int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info)
 {
 	struct eth_device *dev;
@@ -653,10 +660,7 @@ int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info)
 	devlist[num_controllers++] = dev;
 	dev->iobase = 0;
 	dev->priv = (void *)fm_eth;
-	dev->eo->init = fm_eth_open;
-	dev->eo->halt = fm_eth_halt;
-	dev->eo->send = fm_eth_send;
-	dev->eo->recv = fm_eth_recv;
+	dev->eo = &fm_eth_ops;
 	fm_eth->dev = dev;
 	fm_eth->bus = info->bus;
 	fm_eth->phyaddr = info->phy_addr;
-- 
1.7.2.5



More information about the U-Boot mailing list