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

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

diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index ee1a1f6..89cd23e 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -890,6 +890,14 @@ static int tse_eth_init(struct eth_device *dev, bd_t * bd)
 	return priv->link ? 0 : -1;
 }
 
+static struct eth_ops altera_tse_ops = {
+	.init = tse_eth_init,
+	.halt = tse_eth_halt,
+	.send = tse_eth_send,
+	.recv = tse_eth_rx,
+	.write_hwaddr = tse_set_mac_address
+};
+
 /* TSE init code */
 int altera_tse_initialize(u8 dev_num, int mac_base,
 			  int sgdma_rx_base, int sgdma_tx_base,
@@ -951,11 +959,7 @@ int altera_tse_initialize(u8 dev_num, int mac_base,
 
 	/* init eth structure */
 	dev->priv = priv;
-	dev->eo->init = tse_eth_init;
-	dev->eo->halt = tse_eth_halt;
-	dev->eo->send = tse_eth_send;
-	dev->eo->recv = tse_eth_rx;
-	dev->eo->write_hwaddr = tse_set_mac_address;
+	dev->eo = &altera_tse_ops;
 	sprintf(dev->name, "%s-%hu", "ALTERA_TSE", dev_num);
 
 	eth_register(dev);
-- 
1.7.10.4



More information about the U-Boot mailing list