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

Tomas Hlavacek tmshlvck at gmail.com
Wed Nov 21 14:23:58 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/smsc95xx.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
index b8c2f2e..9f278c5 100644
--- a/drivers/usb/eth/smsc95xx.c
+++ b/drivers/usb/eth/smsc95xx.c
@@ -881,6 +881,14 @@ int smsc95xx_eth_probe(struct usb_device *dev, unsigned int ifnum,
 	return 1;
 }
 
+static struct eth_ops smsc95xx_ops = {
+	.init = smsc95xx_init,
+	.halt = smsc95xx_halt,
+	.send = smsc95xx_send,
+	.recv = smsc95xx_recv,
+	.write_hwaddr = smsc95xx_write_hwaddr
+};
+
 int smsc95xx_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
 				struct eth_device *eth)
 {
@@ -890,11 +898,7 @@ int smsc95xx_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
 		return 0;
 	}
 	sprintf(eth->name, "%s%d", SMSC95XX_BASE_NAME, curr_eth_dev++);
-	eth->eo->init = smsc95xx_init;
-	eth->eo->send = smsc95xx_send;
-	eth->eo->recv = smsc95xx_recv;
-	eth->eo->halt = smsc95xx_halt;
-	eth->eo->write_hwaddr = smsc95xx_write_hwaddr;
+	eth->eo = &smsc95xx_ops;
 	eth->priv = ss;
 	return 1;
 }
-- 
1.7.2.5



More information about the U-Boot mailing list