Patchwork [U-Boot,RFC,19/50] net: ep93xx_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-20-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196642/
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/ep93xx_eth.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/net/ep93xx_eth.c b/drivers/net/ep93xx_eth.c
index 0b5cb3c..a2a1502 100644
--- a/drivers/net/ep93xx_eth.c
+++ b/drivers/net/ep93xx_eth.c
@@ -439,6 +439,13 @@  int ep93xx_miiphy_initialize(bd_t * const bd)
 }
 #endif
 
+static struct eth_dev ep93xx_eth_ops = {
+	.init = ep93xx_eth_open,
+	.halt = ep93xx_eth_close,
+	.send = ep93xx_eth_send_packet,
+	.recv = ep93xx_eth_rcv_packet
+};
+
 /**
  * Initialize the EP93xx MAC.  The MAC hardware is reset.  Buffers are
  * allocated, if necessary, for the TX and RX descriptor and status queues,
@@ -499,10 +506,7 @@  int ep93xx_eth_initialize(u8 dev_num, int base_addr)
 
 	dev->iobase = base_addr;
 	dev->priv = priv;
-	dev->eo->init = ep93xx_eth_open;
-	dev->eo->halt = ep93xx_eth_close;
-	dev->eo->send = ep93xx_eth_send_packet;
-	dev->eo->recv = ep93xx_eth_rcv_packet;
+	dev->eo = &ep93xx_eth_ops;
 
 	sprintf(dev->name, "ep93xx_eth-%hu", dev_num);