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

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

diff --git a/drivers/net/plb2800_eth.c b/drivers/net/plb2800_eth.c
index d3eb692..3b5861f 100644
--- a/drivers/net/plb2800_eth.c
+++ b/drivers/net/plb2800_eth.c
@@ -92,6 +92,12 @@ static unsigned char * plb2800_get_mac_addr(void);
 static int rx_new;
 static int mac_addr_set = 0;
 
+static struct eth_ops plb2800_eth_ops = {
+	.init = plb2800_eth_init,
+	.halt = plb2800_eth_halt,
+	.send = plb2800_eth_send,
+	.recv = plb2800_eth_recv
+};
 
 int plb2800_eth_initialize(bd_t * bis)
 {
@@ -110,10 +116,7 @@ int plb2800_eth_initialize(bd_t * bis)
 	memset(dev, 0, sizeof(*dev));
 
 	sprintf(dev->name, "PLB2800 Switch");
-	dev->eo->init = plb2800_eth_init;
-	dev->eo->halt = plb2800_eth_halt;
-	dev->eo->send = plb2800_eth_send;
-	dev->eo->recv = plb2800_eth_recv;
+	dev->eo = &plb2800_eth_ops;
 
 	eth_register(dev);
 
-- 
1.7.10.4



More information about the U-Boot mailing list