[U-Boot] [PATCH v2 35/67] net: ns8382x: Pull out init of struct eth_ops

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:23: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/ns8382x.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ns8382x.c b/drivers/net/ns8382x.c
index 8b08e0b..c433d3a 100644
--- a/drivers/net/ns8382x.c
+++ b/drivers/net/ns8382x.c
@@ -294,6 +294,14 @@ OUTL(struct eth_device *dev, int command, u_long addr)
 	*(vu_long *) ((addr + dev->iobase)) = cpu_to_le32(command);
 }
 
+static struct eth_ops ns8382x_ops = {
+	.init = ns8382x_init,
+	.halt = ns8382x_disable,
+	.send = ns8382x_send,
+	.recv = ns8382x_poll
+};
+
+
 /* Function: ns8382x_initialize
  * Description: Retrieves the MAC address of the card, and sets up some
  *  globals required by other routines, and initializes the NIC, making it
@@ -346,10 +354,7 @@ ns8382x_initialize(bd_t * bis)
 		sprintf(dev->name, "dp8382x#%d", card_number);
 		dev->iobase = bus_to_phys(iobase);
 		dev->priv = (void *) devno;
-		dev->eo->init = ns8382x_init;
-		dev->eo->halt = ns8382x_disable;
-		dev->eo->send = ns8382x_send;
-		dev->eo->recv = ns8382x_poll;
+		dev->eo = &ns8382x_ops;
 
 		/* ns8382x has a non-standard PM control register
 		 * in PCI config space.  Some boards apparently need
-- 
1.7.2.5



More information about the U-Boot mailing list