Patchwork [U-Boot,RFC,12/50] net: davinci_emac: 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-13-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196646/
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/davinci_emac.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index a221092..5701f75 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -769,6 +769,14 @@  static int davinci_eth_rcv_packet (struct eth_device *dev)
 	return (0);
 }
 
+static struct eth_ops davinci_emac_ops = {
+	.init = davinci_eth_open,
+	.halt = davinci_eth_close,
+	.send = davinci_eth_send_packet,
+	.recv = davinci_eth_rcv_packet,
+	.write_hwaddr = davinci_eth_set_mac_addr
+};
+
 /*
  * This function initializes the emac hardware. It does NOT initialize
  * EMAC modules power or pin multiplexors, that is done by board_init()
@@ -791,11 +799,7 @@  int davinci_emac_initialize(void)
 	sprintf(dev->name, "DaVinci-EMAC");
 
 	dev->iobase = 0;
-	dev->eo->init = davinci_eth_open;
-	dev->eo->halt = davinci_eth_close;
-	dev->eo->send = davinci_eth_send_packet;
-	dev->eo->recv = davinci_eth_rcv_packet;
-	dev->eo->write_hwaddr = davinci_eth_set_mac_addr;
+	dev->eo = &davinci_emac_ops;
 
 	eth_register(dev);