Patchwork [U-Boot,v2,25/67] net: ks8695eth: 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-26-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200722/
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/ks8695eth.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/net/ks8695eth.c b/drivers/net/ks8695eth.c
index b0703ef..4a5a27e 100644
--- a/drivers/net/ks8695eth.c
+++ b/drivers/net/ks8695eth.c
@@ -220,6 +220,13 @@  static int ks8695_eth_send(struct eth_device *dev, void *packet, int len)
 
 /****************************************************************************/
 
+static struct eth_ops ks8695_eth_ops = {
+	.init = ks8695_eth_init,
+	.halt = ks8695_eth_halt,
+	.send = ks8695_eth_send,
+	.recv = ks8695_eth_recv
+};
+
 int ks8695_eth_initialize(void)
 {
 	struct eth_device *dev;
@@ -230,10 +237,7 @@  int ks8695_eth_initialize(void)
 	memset(dev, 0, sizeof(*dev));
 
 	dev->iobase = KS8695_IO_BASE + KS8695_LAN_DMA_TX;
-	dev->eo->init = ks8695_eth_init;
-	dev->eo->halt = ks8695_eth_halt;
-	dev->eo->send = ks8695_eth_send;
-	dev->eo->recv = ks8695_eth_recv;
+	dev->eo = &ks8695_eth_ops;
 	strcpy(dev->name, "ks8695eth");
 
 	eth_register(dev);