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

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

diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index 2cc9743..f1fed0e 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -774,6 +774,13 @@ static int ne2k_send(struct eth_device *dev, void *packet, int length)
 	return 0;
 }
 
+static struct eth_ops ne2k_ops = {
+	.init = ne2k_init,
+	.halt = ne2k_halt,
+	.send = ne2k_send,
+	.recv = ne2k_recv
+};
+
 /**
  * Setup the driver for use and register it with the eth layer
  * @return 0 on success, -1 on error (causing caller to print error msg)
@@ -789,10 +796,7 @@ int ne2k_register(void)
 	if (ne2k_setup_driver(dev))
 		return -1;
 
-	dev->eo->init = ne2k_init;
-	dev->eo->halt = ne2k_halt;
-	dev->eo->send = ne2k_send;
-	dev->eo->recv = ne2k_recv;
+	dev->eo = &ne2k_ops;
 
 	sprintf(dev->name, "NE2000");
 
-- 
1.7.10.4



More information about the U-Boot mailing list