Patchwork [U-Boot,v2,50/67] net: au1x00_eth: 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-51-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200754/
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/mips/cpu/mips32/au1x00/au1x00_eth.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_eth.c b/arch/mips/cpu/mips32/au1x00/au1x00_eth.c
index 2909fb3..cd4c518 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_eth.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_eth.c
@@ -283,6 +283,13 @@  static void au1x00_halt(struct eth_device* dev){
 	*macen = 0;
 }
 
+static struct eth_ops au1x00_ops = {
+	.init = au1x00_init,
+	.halt = au1x00_halt,
+	.send = au1x00_send,
+	.recv = au1x00_recv
+};
+
 int au1x00_enet_initialize(bd_t *bis){
 	struct eth_device* dev;
 
@@ -296,10 +303,7 @@  int au1x00_enet_initialize(bd_t *bis){
 	sprintf(dev->name, "Au1X00 ethernet");
 	dev->iobase = 0;
 	dev->priv = 0;
-	dev->eo->init = au1x00_init;
-	dev->eo->halt = au1x00_halt;
-	dev->eo->send = au1x00_send;
-	dev->eo->recv = au1x00_recv;
+	dev->eo = &au1x00_ops;
 
 	eth_register(dev);