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

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

diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index 76391c1..7046829 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -525,6 +525,13 @@ static int ftgmac100_send(struct eth_device *dev, void *packet, int length)
 	return 0;
 }
 
+static struct eth_ops ftgmac100_ops = {
+	.init = ftgmac100_init,
+	.halt = ftgmac100_halt,
+	.send = ftgmac100_send,
+	.recv = ftgmac100_recv
+};
+
 int ftgmac100_initialize(bd_t *bd)
 {
 	struct eth_device *dev;
@@ -548,10 +555,7 @@ int ftgmac100_initialize(bd_t *bd)
 
 	sprintf(dev->name, "FTGMAC100");
 	dev->iobase	= CONFIG_FTGMAC100_BASE;
-	dev->eo->init	= ftgmac100_init;
-	dev->eo->halt	= ftgmac100_halt;
-	dev->eo->send	= ftgmac100_send;
-	dev->eo->recv	= ftgmac100_recv;
+	dev->eo		= &ftgmac100_ops;
 	dev->priv	= priv;
 
 	eth_register(dev);
-- 
1.7.10.4



More information about the U-Boot mailing list