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

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

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);
 
-- 
1.7.10.4



More information about the U-Boot mailing list