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

Patch

diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c
index 0361699..afdc088 100644
--- a/drivers/net/dc2114x.c
+++ b/drivers/net/dc2114x.c
@@ -207,6 +207,13 @@  static struct pci_device_id supported[] = {
 	{ }
 };
 
+static struct eth_ops dc21x4x_ops = {
+	.init = dc21x4x_init,
+	.halt = dc21x4x_halt,
+	.send = dc21x4x_send,
+	.recv = dc21x4x_recv
+};
+
 int dc21x4x_initialize(bd_t *bis)
 {
 	int			idx=0;
@@ -299,11 +306,8 @@  int dc21x4x_initialize(bd_t *bis)
 #else
 		dev->iobase = pci_mem_to_phys(devbusfn, iobase);
 #endif
-		dev->priv   = (void*) devbusfn;
-		dev->eo->init   = dc21x4x_init;
-		dev->eo->halt   = dc21x4x_halt;
-		dev->eo->send   = dc21x4x_send;
-		dev->eo->recv   = dc21x4x_recv;
+		dev->priv = (void *) devbusfn;
+		dev->eo = &dc21x4x_ops;
 
 		/* Ensure we're not sleeping. */
 		pci_write_config_byte(devbusfn, PCI_CFDA_PSM, WAKEUP);