[U-Boot] [PATCH v2 02/67] net: 4xx_enet: Pull out init of struct eth_ops

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:22:53 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/4xx_enet.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/4xx_enet.c b/drivers/net/4xx_enet.c
index 27b66dd..309e616 100644
--- a/drivers/net/4xx_enet.c
+++ b/drivers/net/4xx_enet.c
@@ -1905,6 +1905,13 @@ static int ppc_4xx_eth_rx (struct eth_device *dev)
 	return length;
 }
 
+static struct eth_ops ppc_4xx_eth_ops = {
+	.init = ppc_4xx_eth_init,
+	.send = ppc_4xx_eth_send,
+	.recv = ppc_4xx_eth_rx,
+	.halt = ppc_4xx_eth_halt
+};
+
 int ppc_4xx_eth_initialize (bd_t * bis)
 {
 	static int virgin = 0;
@@ -2023,10 +2030,7 @@ int ppc_4xx_eth_initialize (bd_t * bis)
 
 		sprintf (dev->name, "ppc_4xx_eth%d", eth_num - CONFIG_EMAC_NR_START);
 		dev->priv = (void *) hw;
-		dev->eo->init = ppc_4xx_eth_init;
-		dev->eo->halt = ppc_4xx_eth_halt;
-		dev->eo->send = ppc_4xx_eth_send;
-		dev->eo->recv = ppc_4xx_eth_rx;
+		dev->eo = &ppc_4xx_eth_ops;
 
 		eth_register(dev);
 
-- 
1.7.2.5



More information about the U-Boot mailing list