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

Patch

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 */