Patchwork [U-Boot,RFC,04/50] net: dm9000x: Pull out init of struct eth_ops

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 2, 2012, 5:17 p.m.
Message ID <1351876722-5183-5-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196632/
State Superseded
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 2, 2012, 5:17 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/dm9000x.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index bd96948..f6b226c 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -623,6 +623,13 @@  dm9000_phy_write(int reg, u16 value)
 	DM9000_DBG("dm9000_phy_write(reg:0x%x, value:0x%x)\n", reg, value);
 }
 
+static struct eth_ops dm9000_ops = {
+	.init = dm9000_init,
+	.send = dm9000_send,
+	.recv = dm9000_rx,
+	.halt = dm9000_halt
+};
+
 int dm9000_initialize(bd_t *bis)
 {
 	struct eth_device *dev = &(dm9000_info.netdev);
@@ -630,10 +637,7 @@  int dm9000_initialize(bd_t *bis)
 	/* Load MAC address from EEPROM */
 	dm9000_get_enetaddr(dev);
 
-	dev->eo->init = dm9000_init;
-	dev->eo->halt = dm9000_halt;
-	dev->eo->send = dm9000_send;
-	dev->eo->recv = dm9000_rx;
+	dev->eo = &dm9000_ops;
 	sprintf(dev->name, "dm9000");
 
 	eth_register(dev);