Patchwork [U-Boot,v2,02/67] net: 4xx_enet: Pull out init of struct eth_ops

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

Comments

Tomas Hlavacek - Nov. 21, 2012, 1:22 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/4xx_enet.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/net/4xx_enet.c b/drivers/net/4xx_enet.c
index 27b66dd..309e616 100644
--- a/drivers/net/4xx_enet.c
+++ b/drivers/net/4xx_enet.c
@@ -1905,6 +1905,13 @@  static int ppc_4xx_eth_rx (struct eth_device *dev)
 	return length;
 }
 
+static struct eth_ops ppc_4xx_eth_ops = {
+	.init = ppc_4xx_eth_init,
+	.send = ppc_4xx_eth_send,
+	.recv = ppc_4xx_eth_rx,
+	.halt = ppc_4xx_eth_halt
+};
+
 int ppc_4xx_eth_initialize (bd_t * bis)
 {
 	static int virgin = 0;
@@ -2023,10 +2030,7 @@  int ppc_4xx_eth_initialize (bd_t * bis)
 
 		sprintf (dev->name, "ppc_4xx_eth%d", eth_num - CONFIG_EMAC_NR_START);
 		dev->priv = (void *) hw;
-		dev->eo->init = ppc_4xx_eth_init;
-		dev->eo->halt = ppc_4xx_eth_halt;
-		dev->eo->send = ppc_4xx_eth_send;
-		dev->eo->recv = ppc_4xx_eth_rx;
+		dev->eo = &ppc_4xx_eth_ops;
 
 		eth_register(dev);