Patchwork [U-Boot,RFC,08/50] net: bfin_mac: 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-9-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196634/
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/bfin_mac.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index ef4736f..b2c4b0f 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -91,6 +91,14 @@  static int bfin_miiphy_write(const char *devname, uchar addr, uchar reg, ushort
 	return 0;
 }
 
+static struct eth_ops bfin_emac_ops = {
+	.init = bfin_EMAC_init,
+	.halt = bfin_EMAC_halt,
+	.send = bfin_EMAC_send,
+	.recv = bfin_EMAC_recv,
+	.write_hwaddr = bfin_EMAC_setup_addr
+};
+
 int bfin_EMAC_initialize(bd_t *bis)
 {
 	struct eth_device *dev;
@@ -103,11 +111,7 @@  int bfin_EMAC_initialize(bd_t *bis)
 
 	dev->iobase = 0;
 	dev->priv = 0;
-	dev->eo->init = bfin_EMAC_init;
-	dev->eo->halt = bfin_EMAC_halt;
-	dev->eo->send = bfin_EMAC_send;
-	dev->eo->recv = bfin_EMAC_recv;
-	dev->eo->write_hwaddr = bfin_EMAC_setup_addr;
+	dev->eo = &bfin_emac_ops;
 
 	eth_register(dev);