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

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 21, 2012, 1:23 p.m.
Message ID <1353504238-11277-21-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200719/
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 21, 2012, 1:23 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/fec_mxc.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

Patch

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;