[U-Boot] [PATCH v2 42/67] net: tsec: Pull out init of struct eth_ops

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:23:33 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/tsec.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

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++)
-- 
1.7.2.5



More information about the U-Boot mailing list