diff mbox

[U-Boot,v2,27/67] net: macb: Pull out init of struct eth_ops

Message ID 1353504238-11277-28-git-send-email-tmshlvck@gmail.com
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Commit Message

Tomas Hlavacek Nov. 21, 2012, 1:23 p.m. UTC
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/macb.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 2c53902..c0f1202 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -529,6 +529,14 @@  static int macb_write_hwaddr(struct eth_device *dev)
 	return 0;
 }
 
+static struct eth_ops macb_ops = {
+	.init = macb_init,
+	.halt = macb_halt,
+	.send = macb_send,
+	.recv = macb_recv,
+	.write_hwaddr = macb_write_hwaddr
+};
+
 int macb_eth_initialize(int id, void *regs, unsigned int phy_addr)
 {
 	struct macb_device *macb;
@@ -558,11 +566,7 @@  int macb_eth_initialize(int id, void *regs, unsigned int phy_addr)
 	macb->phy_addr = phy_addr;
 
 	sprintf(netdev->name, "macb%d", id);
-	netdev->eo->init = macb_init;
-	netdev->eo->halt = macb_halt;
-	netdev->eo->send = macb_send;
-	netdev->eo->recv = macb_recv;
-	netdev->eo->write_hwaddr = macb_write_hwaddr;
+	netdev->eo = &macb_ops;
 
 	/*
 	 * Do some basic initialization so that we at least can talk