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

Tomas Hlavacek tmshlvck at gmail.com
Fri Nov 2 18:18:21 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/mcffec.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index 0aeb24e..31c8dcd 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -551,6 +551,13 @@ void fec_halt(struct eth_device *dev)
 	memset(info->txbuf, 0, DBUF_LENGTH);
 }
 
+static struct eth_ops fec_ops = {
+	.init = fec_init,
+	.halt = fec_halt,
+	.send = fec_send,
+	.recv = fec_recv
+};
+
 int mcffec_initialize(bd_t * bis)
 {
 	struct eth_device *dev;
@@ -572,10 +579,7 @@ int mcffec_initialize(bd_t * bis)
 		sprintf(dev->name, "FEC%d", fec_info[i].index);
 
 		dev->priv = &fec_info[i];
-		dev->eo->init = fec_init;
-		dev->eo->halt = fec_halt;
-		dev->eo->send = fec_send;
-		dev->eo->recv = fec_recv;
+		dev->eo = &fec_ops;
 
 		/* setup Receive and Transmit buffer descriptor */
 #ifdef CONFIG_SYS_FEC_BUF_USE_SRAM
-- 
1.7.10.4



More information about the U-Boot mailing list