Patchwork [U-Boot,v2,19/67] net: ethoc: 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-20-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200721/
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/ethoc.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 946b8e2..6a78605 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -482,6 +482,14 @@  static int ethoc_recv(struct eth_device *dev)
 	return 0;
 }
 
+static struct eth_ops ethoc_ops = {
+	.init = ethoc_init,
+	.halt = ethoc_halt,
+	.send = ethoc_send,
+	.recv = ethoc_recv,
+	.write_hwaddr = ethoc_set_mac_address
+};
+
 int ethoc_initialize(u8 dev_num, int base_addr)
 {
 	struct ethoc *priv;
@@ -499,11 +507,7 @@  int ethoc_initialize(u8 dev_num, int base_addr)
 	memset(dev, 0, sizeof(*dev));
 	dev->priv = priv;
 	dev->iobase = base_addr;
-	dev->eo->init = ethoc_init;
-	dev->eo->halt = ethoc_halt;
-	dev->eo->send = ethoc_send;
-	dev->eo->recv = ethoc_recv;
-	dev->eo->write_hwaddr = ethoc_set_mac_address;
+	dev->eo = &ethoc_ops;
 	sprintf(dev->name, "%s-%hu", "ETHOC", dev_num);
 
 	eth_register(dev);