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

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:23:22 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/mpc512x_fec.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mpc512x_fec.c b/drivers/net/mpc512x_fec.c
index 4aa3b28..d10a70a 100644
--- a/drivers/net/mpc512x_fec.c
+++ b/drivers/net/mpc512x_fec.c
@@ -608,6 +608,13 @@ static int mpc512x_fec_recv (struct eth_device *dev)
 	return frame_length;
 }
 
+static struct eth_ops mpc512x_fec_ops = {
+	.init = mpc512x_fec_init,
+	.halt = mpc512x_fec_halt,
+	.send = mpc512x_fec_send,
+	.recv = mpc512x_fec_recv
+};
+
 /********************************************************************/
 int mpc512x_fec_initialize (bd_t * bis)
 {
@@ -629,10 +636,7 @@ int mpc512x_fec_initialize (bd_t * bis)
 # endif
 	dev->priv = (void *)fec;
 	dev->iobase = (int)&im->fec;
-	dev->eo->init = mpc512x_fec_init;
-	dev->eo->halt = mpc512x_fec_halt;
-	dev->eo->send = mpc512x_fec_send;
-	dev->eo->recv = mpc512x_fec_recv;
+	dev->eo = &mpc512x_fec_ops;
 
 	sprintf (dev->name, "FEC");
 	eth_register (dev);
-- 
1.7.2.5



More information about the U-Boot mailing list