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

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:23:27 CET 2012


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 at gmail.com>
---
 drivers/net/pcnet.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

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



More information about the U-Boot mailing list