Patchwork [U-Boot,v2,67/67] net: usb: smsc95xx: 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-68-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200745/
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/smsc95xx.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

Patch

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;
 }