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

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

diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 3ea7213..f237ef8 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -1331,6 +1331,14 @@ static void print_packet( byte * buf, int length )
 }
 #endif
 
+static struct eth_ops smc_ops = {
+	.init = smc_init,
+	.halt = smc_halt,
+	.send = smc_send,
+	.recv = smc_rcv,
+	.write_hwaddr = smc_write_hwaddr
+};
+
 int smc91111_initialize(u8 dev_num, int base_addr)
 {
 	struct smc91111_priv *priv;
@@ -1357,11 +1365,7 @@ int smc91111_initialize(u8 dev_num, int base_addr)
 		dev->enetaddr[i] = SMC_inb(dev, (ADDR0_REG + i));
 	swap_to(FLASH);
 
-	dev->eo->init = smc_init;
-	dev->eo->halt = smc_halt;
-	dev->eo->send = smc_send;
-	dev->eo->recv = smc_rcv;
-	dev->eo->write_hwaddr = smc_write_hwaddr;
+	dev->eo = &smc_ops;
 	sprintf(dev->name, "%s-%hu", SMC_DEV_NAME, dev_num);
 
 	eth_register(dev);
-- 
1.7.10.4



More information about the U-Boot mailing list