Patchwork [U-Boot,v2,49/67] net: sh_eth: Pull out init of struct eth_ops

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 21, 2012, 1:23 p.m.
Message ID <1353504238-11277-50-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200750/
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 21, 2012, 1:23 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/sh_eth.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 1f8d0c1..e801bcb 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -502,6 +502,13 @@  void sh_eth_halt(struct eth_device *dev)
 	sh_eth_stop(eth);
 }
 
+static struct eth_ops sh_eth_ops = {
+	.init = sh_eth_init,
+	.halt = sh_eth_halt,
+	.send = sh_eth_send,
+	.recv = sh_eth_recv
+};
+
 int sh_eth_initialize(bd_t *bd)
 {
     int ret = 0;
@@ -529,10 +536,7 @@  int sh_eth_initialize(bd_t *bd)
 
     dev->priv = (void *)eth;
     dev->iobase = 0;
-	dev->eo->init = sh_eth_init;
-	dev->eo->halt = sh_eth_halt;
-	dev->eo->send = sh_eth_send;
-	dev->eo->recv = sh_eth_recv;
+	dev->eo = &sh_eth_ops;
     eth->port_info[eth->port].dev = dev;
 
 	sprintf(dev->name, SHETHER_NAME);