Patchwork [U-Boot,RFC,48/50] net: zynq_gem: Pull out init of struct eth_ops

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 2, 2012, 5:18 p.m.
Message ID <1351876722-5183-49-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196665/
State Superseded
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 2, 2012, 5:18 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/zynq_gem.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 3cba176..0a9a0f0 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -399,6 +399,14 @@  static int zynq_gem_miiphy_write(const char *devname, uchar addr,
 	return phywrite(dev, addr, reg, val);
 }
 
+static struct eth_ops zynq_gem_ops = {
+	.init = zynq_gem_init,
+	.halt = zynq_gem_halt,
+	.send = zynq_gem_send,
+	.recv = zynq_gem_recv,
+	.write_hwaddr = zynq_gem_setup_mac
+};
+
 int zynq_gem_initialize(bd_t *bis, int base_addr)
 {
 	struct eth_device *dev;
@@ -425,11 +433,7 @@  int zynq_gem_initialize(bd_t *bis, int base_addr)
 
 	dev->iobase = base_addr;
 
-	dev->eo->init = zynq_gem_init;
-	dev->eo->halt = zynq_gem_halt;
-	dev->eo->send = zynq_gem_send;
-	dev->eo->recv = zynq_gem_recv;
-	dev->eo->write_hwaddr = zynq_gem_setup_mac;
+	dev->eo = &zynq_gem_ops;
 
 	eth_register(dev);