[U-Boot] [RFC PATCH 23/50] net: greth.c: Pull out init of struct eth_ops

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

diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index 150dccf..3794005 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -597,6 +597,13 @@ void greth_set_hwaddr(greth_priv * greth, unsigned char *mac)
 	       mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 }
 
+static struct eth_ops greth_ops = {
+	.init = greth_init,
+	.halt = greth_halt,
+	.send = greth_send,
+	.recv = greth_recv
+};
+
 int greth_initialize(bd_t * bis)
 {
 	greth_priv *greth;
@@ -623,10 +630,7 @@ int greth_initialize(bd_t * bis)
 	debug("Found GRETH at %p, irq %d\n", greth->regs, greth->irq);
 	dev->priv = (void *)greth;
 	dev->iobase = (unsigned int)greth->regs;
-	dev->eo->init = greth_init;
-	dev->eo->halt = greth_halt;
-	dev->eo->send = greth_send;
-	dev->eo->recv = greth_recv;
+	dev->eo = &greth_ops;
 	greth->dev = dev;
 
 	/* Reset Core */
-- 
1.7.10.4



More information about the U-Boot mailing list