[U-Boot] [RFC PATCH 18/50] net: enc28j60: Pull out init of struct eth_ops

Tomas Hlavacek tmshlvck at gmail.com
Fri Nov 2 18:18:10 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>
---
 drivers/net/enc28j60.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index 95f0b93..e73fef8 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)
-- 
1.7.10.4



More information about the U-Boot mailing list