Patchwork [U-Boot,v2,41/67] net: smc911x: 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-42-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200726/
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/smc911x.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 5ba1bdf..0369376 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -251,6 +251,13 @@  static int smc911x_miiphy_write(const char *devname, u8 phy, u8 reg, u16 val)
 }
 #endif
 
+static struct eth_ops smc911x_ops = {
+	.init = smc911x_init,
+	.halt = smc911x_halt,
+	.send = smc911x_send,
+	.recv = smc911x_rx
+};
+
 int smc911x_initialize(u8 dev_num, int base_addr)
 {
 	unsigned long addrl, addrh;
@@ -282,10 +289,7 @@  int smc911x_initialize(u8 dev_num, int base_addr)
 		dev->enetaddr[5] = addrh >> 8;
 	}
 
-	dev->eo->init = smc911x_init;
-	dev->eo->halt = smc911x_halt;
-	dev->eo->send = smc911x_send;
-	dev->eo->recv = smc911x_rx;
+	dev->eo = &smc911x_ops;
 	sprintf(dev->name, "%s-%hu", DRIVERNAME, dev_num);
 
 	eth_register(dev);