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

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

diff --git a/arch/powerpc/cpu/mpc8xx/scc.c b/arch/powerpc/cpu/mpc8xx/scc.c
index 801c689..1d154f5 100644
--- a/arch/powerpc/cpu/mpc8xx/scc.c
+++ b/arch/powerpc/cpu/mpc8xx/scc.c
@@ -70,6 +70,13 @@ static int scc_recv(struct eth_device* dev);
 static int scc_init (struct eth_device* dev, bd_t * bd);
 static void scc_halt(struct eth_device* dev);
 
+static struct eth_ops sec_ops = {
+	.init = scc_init,
+	.halt = scc_halt,
+	.send = scc_send,
+	.recv = scc_recv
+};
+
 int scc_initialize(bd_t *bis)
 {
 	struct eth_device* dev;
@@ -80,10 +87,7 @@ int scc_initialize(bd_t *bis)
 	sprintf(dev->name, "SCC");
 	dev->iobase = 0;
 	dev->priv   = 0;
-	dev->eo->init = scc_init;
-	dev->eo->halt = scc_halt;
-	dev->eo->send = scc_send;
-	dev->eo->recv = scc_recv;
+	dev->eo = &sec_ops;
 
 	eth_register(dev);
 
-- 
1.7.2.5



More information about the U-Boot mailing list