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

Patch

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 2c53902..c0f1202 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -529,6 +529,14 @@  static int macb_write_hwaddr(struct eth_device *dev)
 	return 0;
 }
 
+static struct eth_ops macb_ops = {
+	.init = macb_init,
+	.halt = macb_halt,
+	.send = macb_send,
+	.recv = macb_recv,
+	.write_hwaddr = macb_write_hwaddr
+};
+
 int macb_eth_initialize(int id, void *regs, unsigned int phy_addr)
 {
 	struct macb_device *macb;
@@ -558,11 +566,7 @@  int macb_eth_initialize(int id, void *regs, unsigned int phy_addr)
 	macb->phy_addr = phy_addr;
 
 	sprintf(netdev->name, "macb%d", id);
-	netdev->eo->init = macb_init;
-	netdev->eo->halt = macb_halt;
-	netdev->eo->send = macb_send;
-	netdev->eo->recv = macb_recv;
-	netdev->eo->write_hwaddr = macb_write_hwaddr;
+	netdev->eo = &macb_ops;
 
 	/*
 	 * Do some basic initialization so that we at least can talk