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

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

diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index d87302b..4e4e2e4 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -785,6 +785,13 @@ static int lan91c96_detect_chip(struct eth_device *dev)
 	return 0;
 }
 
+static struct eth_ops lan91c96_ops = {
+	.init = lan91c96_init,
+	.halt = lan91c96_halt,
+	.send = lan91c96_send,
+	.recv = lan91c96_recv
+};
+
 int lan91c96_initialize(u8 dev_num, int base_addr)
 {
 	struct eth_device *dev;
@@ -806,10 +813,7 @@ int lan91c96_initialize(u8 dev_num, int base_addr)
 	}
 	get_rom_mac(dev, dev->enetaddr);
 
-	dev->eo->init = lan91c96_init;
-	dev->eo->halt = lan91c96_halt;
-	dev->eo->send = lan91c96_send;
-	dev->eo->recv = lan91c96_recv;
+	dev->eo = &lan91c96_ops;
 	sprintf(dev->name, "%s-%hu", supported_chips[r].name, dev_num);
 
 	eth_register(dev);
-- 
1.7.10.4



More information about the U-Boot mailing list