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

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

diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index 6fd2bde..c353b3d 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -236,6 +236,13 @@ static int ftmac100_send(struct eth_device *dev, void *packet, int length)
 	return 0;
 }
 
+static struct eth_ops ftmac100_ops = {
+	.init = ftmac100_init,
+	.halt = ftmac100_halt,
+	.send = ftmac100_send,
+	.recv = ftmac100_recv
+};
+
 int ftmac100_initialize (bd_t *bd)
 {
 	struct eth_device *dev;
@@ -260,10 +267,7 @@ int ftmac100_initialize (bd_t *bd)
 
 	sprintf (dev->name, "FTMAC100");
 	dev->iobase	= CONFIG_FTMAC100_BASE;
-	dev->eo->init	= ftmac100_init;
-	dev->eo->halt	= ftmac100_halt;
-	dev->eo->send	= ftmac100_send;
-	dev->eo->recv	= ftmac100_recv;
+	dev->eo		= &ftmac100_ops;
 	dev->priv	= priv;
 
 	eth_register (dev);
-- 
1.7.2.5



More information about the U-Boot mailing list