[U-Boot] [PATCH v2 66/67] net: usb: asix: Pull out init of struct eth_ops

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:23:57 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/usb/eth/asix.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c
index f2cea6b..ed8bcdd 100644
--- a/drivers/usb/eth/asix.c
+++ b/drivers/usb/eth/asix.c
@@ -692,6 +692,13 @@ int asix_eth_probe(struct usb_device *dev, unsigned int ifnum,
 	return 1;
 }
 
+static struct eth_ops asix_ops = {
+	.init = asix_init,
+	.halt = asix_halt,
+	.send = asix_send,
+	.recv = asix_recv
+};
+
 int asix_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
 				struct eth_device *eth)
 {
@@ -702,10 +709,7 @@ int asix_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
 		return 0;
 	}
 	sprintf(eth->name, "%s%d", ASIX_BASE_NAME, curr_eth_dev++);
-	eth->eo->init = asix_init;
-	eth->eo->send = asix_send;
-	eth->eo->recv = asix_recv;
-	eth->eo->halt = asix_halt;
+	eth->eo = &asix_ops;
 	if (!(priv->flags & FLAG_TYPE_AX88172))
 		eth->eo->write_hwaddr = asix_write_hwaddr;
 	eth->priv = ss;
-- 
1.7.2.5



More information about the U-Boot mailing list