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

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 2, 2012, 5:18 p.m.
Message ID <1351876722-5183-39-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196659/
State Superseded
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 2, 2012, 5:18 p.m.
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@gmail.com>
---
 drivers/net/plb2800_eth.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Patch

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