Patchwork [U-Boot,v2,15/67] net: e1000: Pull out init of struct eth_ops

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 21, 2012, 1:23 p.m.
Message ID <1353504238-11277-16-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200700/
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Comments

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

Patch

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index c9f9fb3..82e89d8 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5118,6 +5118,13 @@  void e1000_get_bus_type(struct e1000_hw *hw)
 /* A list of all registered e1000 devices */
 static LIST_HEAD(e1000_hw_list);
 
+static struct eth_ops e1000_ops = {
+	.init = e1000_init,
+	.recv = e1000_poll,
+	.send = e1000_transmit,
+	.halt = e1000_disable
+};
+
 /**************************************************************************
 PROBE - Look for an adapter, this routine's visible to the outside
 You should omit the last argument struct pci_device * for a non-PCI NIC
@@ -5218,10 +5225,7 @@  e1000_initialize(bd_t * bis)
 		       nic->enetaddr[3], nic->enetaddr[4], nic->enetaddr[5]);
 
 		/* Set up the function pointers and register the device */
-		nic->eo->init = e1000_init;
-		nic->eo->recv = e1000_poll;
-		nic->eo->send = e1000_transmit;
-		nic->eo->halt = e1000_disable;
+		nic->eo = &e1000_ops;
 		eth_register(nic);
 	}