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

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:23:18 CET 2012


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 at gmail.com>
---
 drivers/net/macb.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

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
-- 
1.7.2.5



More information about the U-Boot mailing list