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

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 21, 2012, 1:23 p.m.
Message ID <1353504238-11277-56-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200742/
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Comments

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

Patch

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