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

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

Comments

Tomas Hlavacek - Nov. 2, 2012, 5:18 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/tsec.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Patch

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 345d563..034f0ed 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -605,6 +605,16 @@  static int init_phy(struct eth_device *dev)
 	return 1;
 }
 
+static struct eth_ops tsec_ops = {
+	.init = tsec_init,
+	.halt = tsec_halt,
+	.send = tsec_send,
+	.recv = tsec_recv,
+#ifdef CONFIG_MCAST_TFTP
+	.mcast = tsec_mcast_addr
+#endif
+};
+
 /* Initialize device structure. Returns success if PHY
  * initialization succeeded (i.e. if it recognizes the PHY)
  */
@@ -638,13 +648,7 @@  static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info)
 	priv->bus = miiphy_get_dev_by_name(tsec_info->mii_devname);
 	dev->iobase = 0;
 	dev->priv = priv;
-	dev->eo->init = tsec_init;
-	dev->eo->halt = tsec_halt;
-	dev->eo->send = tsec_send;
-	dev->eo->recv = tsec_recv;
-#ifdef CONFIG_MCAST_TFTP
-	dev->eo->mcast = tsec_mcast_addr;
-#endif
+	dev->eo = &tsec_ops;
 
 	/* Tell u-boot to get the addr from the env */
 	for (i = 0; i < 6; i++)