Patchwork [U-Boot,v2,17/67] net: enc28j60: 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-18-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200736/
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>
---
 drivers/net/enc28j60.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index 95f0b93..cde4e1a 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -924,6 +924,14 @@  static void enc_halt(struct eth_device *dev)
 	enc_release_bus(enc);
 }
 
+static struct eth_ops enc28j60_ops = {
+	.init = enc_init,
+	.halt = enc_halt,
+	.send = enc_send,
+	.recv = enc_recv,
+	.write_hwaddr = enc_write_hwaddr
+};
+
 /*
  * This is the only exported function.
  *
@@ -962,11 +970,7 @@  int enc28j60_initialize(unsigned int bus, unsigned int cs,
 	enc->dev = dev;
 	/* now fill the eth_device object */
 	dev->priv = enc;
-	dev->eo->init = enc_init;
-	dev->eo->halt = enc_halt;
-	dev->eo->send = enc_send;
-	dev->eo->recv = enc_recv;
-	dev->eo->write_hwaddr = enc_write_hwaddr;
+	dev->eo = &enc28j60_ops;
 	sprintf(dev->name, "enc%i.%i", bus, cs);
 	eth_register(dev);
 #if defined(CONFIG_CMD_MII)