Patchwork [U-Boot,RFC,33/50] net: natsemi: Pull out init of struct eth_ops

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 2, 2012, 5:18 p.m.
Message ID <1351876722-5183-34-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196676/
State Superseded
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 2, 2012, 5:18 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/natsemi.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch

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);