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

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:23:11 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/fec_mxc.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index f8a5556..3259f07 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -915,6 +915,15 @@ static int fec_recv(struct eth_device *dev)
 	return len;
 }
 
+static struct eth_ops fec_ops = {
+	.init = fec_init,
+	.send = fec_send,
+	.recv = fec_recv,
+	.halt = fec_halt,
+	.write_hwaddr = fec_set_hwaddr
+};
+
+
 static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr)
 {
 	struct eth_device *edev;
@@ -943,11 +952,7 @@ static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr)
 	memset(fec, 0, sizeof(*fec));
 
 	edev->priv = fec;
-	edev->eo->init = fec_init;
-	edev->eo->send = fec_send;
-	edev->eo->recv = fec_recv;
-	edev->eo->halt = fec_halt;
-	edev->eo->write_hwaddr = fec_set_hwaddr;
+	edev->eo = &fec_ops;
 
 	fec->eth = (struct ethernet_regs *)base_addr;
 	fec->bd = bd;
-- 
1.7.2.5



More information about the U-Boot mailing list