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

Patch

diff --git a/drivers/net/ns8382x.c b/drivers/net/ns8382x.c
index 8b08e0b..c433d3a 100644
--- a/drivers/net/ns8382x.c
+++ b/drivers/net/ns8382x.c
@@ -294,6 +294,14 @@  OUTL(struct eth_device *dev, int command, u_long addr)
 	*(vu_long *) ((addr + dev->iobase)) = cpu_to_le32(command);
 }
 
+static struct eth_ops ns8382x_ops = {
+	.init = ns8382x_init,
+	.halt = ns8382x_disable,
+	.send = ns8382x_send,
+	.recv = ns8382x_poll
+};
+
+
 /* Function: ns8382x_initialize
  * Description: Retrieves the MAC address of the card, and sets up some
  *  globals required by other routines, and initializes the NIC, making it
@@ -346,10 +354,7 @@  ns8382x_initialize(bd_t * bis)
 		sprintf(dev->name, "dp8382x#%d", card_number);
 		dev->iobase = bus_to_phys(iobase);
 		dev->priv = (void *) devno;
-		dev->eo->init = ns8382x_init;
-		dev->eo->halt = ns8382x_disable;
-		dev->eo->send = ns8382x_send;
-		dev->eo->recv = ns8382x_poll;
+		dev->eo = &ns8382x_ops;
 
 		/* ns8382x has a non-standard PM control register
 		 * in PCI config space.  Some boards apparently need