[U-Boot] [PATCH v2 30/67] net: mvgbe: Pull out init of struct eth_ops
Tomas Hlavacek
tmshlvck at gmail.com
Wed Nov 21 14:23:21 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/mvgbe.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
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);
--
1.7.2.5
More information about the U-Boot
mailing list