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

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 21, 2012, 1:23 p.m.
Message ID <1353504238-11277-67-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200741/
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Comments

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

Patch

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;