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

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 2, 2012, 5:17 p.m.
Message ID <1351876722-5183-4-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196631/
State Superseded
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 2, 2012, 5:17 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/altera_tse.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch

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);