Patchwork [U-Boot,v2,36/67] net: pcnet: Pull out init of struct eth_ops

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 21, 2012, 1:23 p.m.
Message ID <1353504238-11277-37-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200709/
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 21, 2012, 1:23 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/pcnet.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c
index 35254c3..8bb8c67 100644
--- a/drivers/net/pcnet.c
+++ b/drivers/net/pcnet.c
@@ -154,6 +154,12 @@  static struct pci_device_id supported[] = {
 	{}
 };
 
+static struct eth_ops pcnet_ops = {
+	.init = pcnet_init,
+	.halt = pcnet_halt,
+	.send = pcnet_send,
+	.recv = pcnet_recv
+};
 
 int pcnet_initialize (bd_t * bis)
 {
@@ -216,12 +222,9 @@  int pcnet_initialize (bd_t * bis)
 		}
 
 		/*
-		 * Setup device structure and register the driver.
+		 * Setup device ops and register the driver.
 		 */
-		dev->eo->init = pcnet_init;
-		dev->eo->halt = pcnet_halt;
-		dev->eo->send = pcnet_send;
-		dev->eo->recv = pcnet_recv;
+		dev->eo = &pcnet_ops;
 
 		eth_register (dev);
 	}