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

Tomas Hlavacek tmshlvck at gmail.com
Fri Nov 2 18:18:18 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/ks8695eth.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ks8695eth.c b/drivers/net/ks8695eth.c
index b0703ef..4a5a27e 100644
--- a/drivers/net/ks8695eth.c
+++ b/drivers/net/ks8695eth.c
@@ -220,6 +220,13 @@ static int ks8695_eth_send(struct eth_device *dev, void *packet, int len)
 
 /****************************************************************************/
 
+static struct eth_ops ks8695_eth_ops = {
+	.init = ks8695_eth_init,
+	.halt = ks8695_eth_halt,
+	.send = ks8695_eth_send,
+	.recv = ks8695_eth_recv
+};
+
 int ks8695_eth_initialize(void)
 {
 	struct eth_device *dev;
@@ -230,10 +237,7 @@ int ks8695_eth_initialize(void)
 	memset(dev, 0, sizeof(*dev));
 
 	dev->iobase = KS8695_IO_BASE + KS8695_LAN_DMA_TX;
-	dev->eo->init = ks8695_eth_init;
-	dev->eo->halt = ks8695_eth_halt;
-	dev->eo->send = ks8695_eth_send;
-	dev->eo->recv = ks8695_eth_recv;
+	dev->eo = &ks8695_eth_ops;
 	strcpy(dev->name, "ks8695eth");
 
 	eth_register(dev);
-- 
1.7.10.4



More information about the U-Boot mailing list