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

Patch

diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index 76391c1..7046829 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -525,6 +525,13 @@  static int ftgmac100_send(struct eth_device *dev, void *packet, int length)
 	return 0;
 }
 
+static struct eth_ops ftgmac100_ops = {
+	.init = ftgmac100_init,
+	.halt = ftgmac100_halt,
+	.send = ftgmac100_send,
+	.recv = ftgmac100_recv
+};
+
 int ftgmac100_initialize(bd_t *bd)
 {
 	struct eth_device *dev;
@@ -548,10 +555,7 @@  int ftgmac100_initialize(bd_t *bd)
 
 	sprintf(dev->name, "FTGMAC100");
 	dev->iobase	= CONFIG_FTGMAC100_BASE;
-	dev->eo->init	= ftgmac100_init;
-	dev->eo->halt	= ftgmac100_halt;
-	dev->eo->send	= ftgmac100_send;
-	dev->eo->recv	= ftgmac100_recv;
+	dev->eo		= &ftgmac100_ops;
 	dev->priv	= priv;
 
 	eth_register(dev);