Patchwork [U-Boot,v2,30/67] net: mvgbe: 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-31-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200707/
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/mvgbe.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index 6ddb6d6..eeb0741 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -647,6 +647,14 @@  static int mvgbe_recv(struct eth_device *dev)
 	return 0;
 }
 
+static struct eth_ops mvgbe_ops = {
+	.init = (int (*) (struct eth_device *, bd_t *))mvgbe_init,
+	.halt = (void (*) (struct eth_device *))mvgbe_halt,
+	.send = mvgbe_send,
+	.recv = mvgbe_recv,
+	.write_hwaddr = mvgbe_write_hwaddr
+};
+
 int mvgbe_initialize(bd_t *bis)
 {
 	struct mvgbe_device *dmvgbe;
@@ -721,11 +729,7 @@  error1:
 			return -1;
 		}
 
-		dev->eo->init = (void *)mvgbe_init;
-		dev->eo->halt = (void *)mvgbe_halt;
-		dev->eo->send = (void *)mvgbe_send;
-		dev->eo->recv = (void *)mvgbe_recv;
-		dev->eo->write_hwaddr = (void *)mvgbe_write_hwaddr;
+		dev->eo = &mvgbe_ops;
 
 		eth_register(dev);