[U-Boot] [PATCH v2 41/67] net: smc911x: Pull out init of struct eth_ops
Tomas Hlavacek
tmshlvck at gmail.com
Wed Nov 21 14:23:32 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/smc911x.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
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);
--
1.7.2.5
More information about the U-Boot
mailing list