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

Patch

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);