Patchwork [U-Boot,v2,40/67] net: smc91111: Pull out init of struct eth_ops

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 21, 2012, 1:23 p.m.
Message ID <1353504238-11277-41-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200724/
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 21, 2012, 1:23 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/smc91111.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

Patch

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