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

Tomas Hlavacek tmshlvck at gmail.com
Fri Nov 2 18:18:04 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/davinci_emac.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index a221092..5701f75 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -769,6 +769,14 @@ static int davinci_eth_rcv_packet (struct eth_device *dev)
 	return (0);
 }
 
+static struct eth_ops davinci_emac_ops = {
+	.init = davinci_eth_open,
+	.halt = davinci_eth_close,
+	.send = davinci_eth_send_packet,
+	.recv = davinci_eth_rcv_packet,
+	.write_hwaddr = davinci_eth_set_mac_addr
+};
+
 /*
  * This function initializes the emac hardware. It does NOT initialize
  * EMAC modules power or pin multiplexors, that is done by board_init()
@@ -791,11 +799,7 @@ int davinci_emac_initialize(void)
 	sprintf(dev->name, "DaVinci-EMAC");
 
 	dev->iobase = 0;
-	dev->eo->init = davinci_eth_open;
-	dev->eo->halt = davinci_eth_close;
-	dev->eo->send = davinci_eth_send_packet;
-	dev->eo->recv = davinci_eth_rcv_packet;
-	dev->eo->write_hwaddr = davinci_eth_set_mac_addr;
+	dev->eo = &davinci_emac_ops;
 
 	eth_register(dev);
 
-- 
1.7.10.4



More information about the U-Boot mailing list