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

Tomas Hlavacek tmshlvck at gmail.com
Fri Nov 2 18:18:03 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/cs8900.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

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



More information about the U-Boot mailing list