[U-Boot] [RFC PATCH 06/50] net: at91_emac: Pull out init of struct eth_ops

Tomas Hlavacek tmshlvck at gmail.com
Fri Nov 2 18:17:58 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/at91_emac.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c
index 3395dcc..464d539 100644
--- a/drivers/net/at91_emac.c
+++ b/drivers/net/at91_emac.c
@@ -494,6 +494,14 @@ static int at91emac_write_hwaddr(struct eth_device *netdev)
 	return 0;
 }
 
+static struct eth_ops at91emac_ops = {
+	.init = at91emac_init,
+	.halt = at91emac_halt,
+	.send = at91emac_send,
+	.recv = at91emac_recv,
+	.write_hwaddr = at91emac_write_hwaddr
+};
+
 int at91emac_register(bd_t *bis, unsigned long iobase)
 {
 	emac_device *emac;
@@ -518,11 +526,7 @@ int at91emac_register(bd_t *bis, unsigned long iobase)
 	sprintf(dev->name, "emac");
 	dev->iobase = iobase;
 	dev->priv = emacfix;
-	dev->eo->init = at91emac_init;
-	dev->eo->halt = at91emac_halt;
-	dev->eo->send = at91emac_send;
-	dev->eo->recv = at91emac_recv;
-	dev->eo->write_hwaddr = at91emac_write_hwaddr;
+	dev->eo = &at91emac_ops;
 
 	eth_register(dev);
 
-- 
1.7.10.4



More information about the U-Boot mailing list