[U-Boot] [PATCH v2 32/67] net: natsemi: Pull out init of struct eth_ops

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:23:23 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/natsemi.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 4288d1f..a3d78b9 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -273,6 +273,13 @@ OUTL(struct eth_device *dev, int command, u_long addr)
 	*(vu_long *) ((addr + dev->iobase)) = cpu_to_le32(command);
 }
 
+static struct eth_ops natsemi_ops = {
+	.init = natsemi_init,
+	.halt = natsemi_disable,
+	.send = natsemi_send,
+	.recv = natsemi_poll
+};
+
 /*
  * Function: natsemi_initialize
  *
@@ -332,10 +339,7 @@ natsemi_initialize(bd_t * bis)
 		printf("natsemi: NatSemi ns8381[56] @ %#x\n", dev->iobase);
 #endif
 		dev->priv = (void *) devno;
-		dev->eo->init = natsemi_init;
-		dev->eo->halt = natsemi_disable;
-		dev->eo->send = natsemi_send;
-		dev->eo->recv = natsemi_poll;
+		dev->eo = &natsemi_ops;
 
 		eth_register(dev);
 
-- 
1.7.2.5



More information about the U-Boot mailing list