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

Patch

diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
index 65a4254..a78eada 100644
--- a/drivers/net/cs8900.c
+++ b/drivers/net/cs8900.c
@@ -299,6 +299,13 @@  int cs8900_e2prom_write(struct eth_device *dev, u8 addr, u16 value)
 	return 0;
 }
 
+static struct eth_ops cs8900_ops = {
+	.init = cs8900_init,
+	.halt = cs8900_halt,
+	.send = cs8900_send,
+	.recv = cs8900_recv
+};
+
 int cs8900_initialize(u8 dev_num, int base_addr)
 {
 	struct eth_device *dev;
@@ -320,10 +327,7 @@  int cs8900_initialize(u8 dev_num, int base_addr)
 
 	dev->iobase = base_addr;
 	dev->priv = priv;
-	dev->eo->init = cs8900_init;
-	dev->eo->halt = cs8900_halt;
-	dev->eo->send = cs8900_send;
-	dev->eo->recv = cs8900_recv;
+	dev->eo = &cs8900_ops;
 
 	/* Load MAC address from EEPROM */
 	cs8900_get_enetaddr(dev);