[U-Boot] [RFC PATCH 14/50] net: designware: Pull out init of struct eth_ops

Tomas Hlavacek tmshlvck at gmail.com
Fri Nov 2 18:18:06 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/designware.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 2d92591..255819e 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -523,6 +523,14 @@ static int dw_mii_write(const char *devname, u8 addr, u8 reg, u16 val)
 }
 #endif
 
+static struct eth_ops dw_eth_ops = {
+	.init = dw_eth_init,
+	.send = dw_eth_send,
+	.recv = dw_eth_recv,
+	.halt = dw_eth_halt,
+	.write_hwaddr = dw_write_hwaddr
+};
+
 int designware_initialize(u32 id, ulong base_addr, u32 phy_addr, u32 interface)
 {
 	struct eth_device *dev;
@@ -559,11 +567,7 @@ int designware_initialize(u32 id, ulong base_addr, u32 phy_addr, u32 interface)
 	priv->phy_configured = 0;
 	priv->interface = interface;
 
-	dev->eo->init = dw_eth_init;
-	dev->eo->send = dw_eth_send;
-	dev->eo->recv = dw_eth_recv;
-	dev->eo->halt = dw_eth_halt;
-	dev->eo->write_hwaddr = dw_write_hwaddr;
+	dev->eo = &dw_eth_ops;
 
 	eth_register(dev);
 
-- 
1.7.10.4



More information about the U-Boot mailing list