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

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:22:55 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/dm9000x.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

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



More information about the U-Boot mailing list