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

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

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);
 	}
 
-- 
1.7.10.4



More information about the U-Boot mailing list