Patchwork [U-Boot,RFC,15/50] net: dnet: 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-16-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/196637/
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/dnet.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index be0891f..126828e 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -355,6 +355,13 @@  static void dnet_halt(struct eth_device *netdev)
 	dnet_writew_mac(dnet, DNET_INTERNAL_MODE_REG, 0);
 }
 
+static struct eth_ops dnet_ops = {
+	.init = dnet_init,
+	.halt = dnet_halt,
+	.send = dnet_send,
+	.recv = dnet_recv
+};
+
 int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr)
 {
 	struct dnet_device *dnet;
@@ -374,10 +381,7 @@  int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr)
 	dnet->phy_addr = phy_addr;
 
 	sprintf(netdev->name, "dnet%d", id);
-	netdev->eo->init = dnet_init;
-	netdev->eo->halt = dnet_halt;
-	netdev->eo->send = dnet_send;
-	netdev->eo->recv = dnet_recv;
+	netdev->eo = &dnet_ops;
 
 	dev_capa = readl(&dnet->regs->VERCAPS) & 0xFFFF;
 	debug("%s: has %smdio, %sirq, %sgigabit, %sdma\n", netdev->name,