Patchwork [U-Boot,RFC,32/50] net: mpc512x_fec: 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-33-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196673/
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/mpc512x_fec.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch

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