Patchwork [U-Boot,RFC,35/50] net: npe: 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-36-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196680/
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/npe/npe.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/net/npe/npe.c b/drivers/net/npe/npe.c
index d376c21..adff561 100644
--- a/drivers/net/npe/npe.c
+++ b/drivers/net/npe/npe.c
@@ -576,6 +576,13 @@  static int npe_rx(struct eth_device *dev)
 	return 0;
 }
 
+static struct eth_ops npe_ops = {
+	.init = npe_init,
+	.halt = npe_halt,
+	.send = npe_send,
+	.recv = npe_rx
+};
+
 int npe_initialize(bd_t * bis)
 {
 	static int virgin = 0;
@@ -625,10 +632,7 @@  int npe_initialize(bd_t * bis)
 
 		sprintf(dev->name, "NPE%d", eth_num);
 		dev->priv = (void *)p_npe;
-		dev->eo->init = npe_init;
-		dev->eo->halt = npe_halt;
-		dev->eo->send = npe_send;
-		dev->eo->recv = npe_rx;
+		dev->eo = &npe_ops;
 
 		p_npe->print_speed = 1;