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

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

diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 946b8e2..6a78605 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -482,6 +482,14 @@ static int ethoc_recv(struct eth_device *dev)
 	return 0;
 }
 
+static struct eth_ops ethoc_ops = {
+	.init = ethoc_init,
+	.halt = ethoc_halt,
+	.send = ethoc_send,
+	.recv = ethoc_recv,
+	.write_hwaddr = ethoc_set_mac_address
+};
+
 int ethoc_initialize(u8 dev_num, int base_addr)
 {
 	struct ethoc *priv;
@@ -499,11 +507,7 @@ int ethoc_initialize(u8 dev_num, int base_addr)
 	memset(dev, 0, sizeof(*dev));
 	dev->priv = priv;
 	dev->iobase = base_addr;
-	dev->eo->init = ethoc_init;
-	dev->eo->halt = ethoc_halt;
-	dev->eo->send = ethoc_send;
-	dev->eo->recv = ethoc_recv;
-	dev->eo->write_hwaddr = ethoc_set_mac_address;
+	dev->eo = &ethoc_ops;
 	sprintf(dev->name, "%s-%hu", "ETHOC", dev_num);
 
 	eth_register(dev);
-- 
1.7.10.4



More information about the U-Boot mailing list