Patchwork [U-Boot,v2,26/67] net: lan91c96: 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-27-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200737/
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/net/lan91c96.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index d87302b..4e4e2e4 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -785,6 +785,13 @@  static int lan91c96_detect_chip(struct eth_device *dev)
 	return 0;
 }
 
+static struct eth_ops lan91c96_ops = {
+	.init = lan91c96_init,
+	.halt = lan91c96_halt,
+	.send = lan91c96_send,
+	.recv = lan91c96_recv
+};
+
 int lan91c96_initialize(u8 dev_num, int base_addr)
 {
 	struct eth_device *dev;
@@ -806,10 +813,7 @@  int lan91c96_initialize(u8 dev_num, int base_addr)
 	}
 	get_rom_mac(dev, dev->enetaddr);
 
-	dev->eo->init = lan91c96_init;
-	dev->eo->halt = lan91c96_halt;
-	dev->eo->send = lan91c96_send;
-	dev->eo->recv = lan91c96_recv;
+	dev->eo = &lan91c96_ops;
 	sprintf(dev->name, "%s-%hu", supported_chips[r].name, dev_num);
 
 	eth_register(dev);