[U-Boot,v2,33/67] net: ne2000: Pull out init of struct eth_ops

Submitted by Tomas Hlavacek on Nov. 21, 2012, 1:23 p.m.

Details

Message ID 1353504238-11277-34-git-send-email-tmshlvck@gmail.com
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Commit Message

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/ne2000_base.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

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");