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

Patch

diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index 6fd2bde..c353b3d 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -236,6 +236,13 @@  static int ftmac100_send(struct eth_device *dev, void *packet, int length)
 	return 0;
 }
 
+static struct eth_ops ftmac100_ops = {
+	.init = ftmac100_init,
+	.halt = ftmac100_halt,
+	.send = ftmac100_send,
+	.recv = ftmac100_recv
+};
+
 int ftmac100_initialize (bd_t *bd)
 {
 	struct eth_device *dev;
@@ -260,10 +267,7 @@  int ftmac100_initialize (bd_t *bd)
 
 	sprintf (dev->name, "FTMAC100");
 	dev->iobase	= CONFIG_FTMAC100_BASE;
-	dev->eo->init	= ftmac100_init;
-	dev->eo->halt	= ftmac100_halt;
-	dev->eo->send	= ftmac100_send;
-	dev->eo->recv	= ftmac100_recv;
+	dev->eo		= &ftmac100_ops;
 	dev->priv	= priv;
 
 	eth_register (dev);