Patchwork [U-Boot,v2,38/67] net: rtl8139: 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-39-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200751/
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/rtl8139.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

Patch

diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index ed02cf6..0e4e5d5 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -200,6 +200,16 @@  static struct pci_device_id supported[] = {
        {}
 };
 
+static struct eth_ops rtl8139_ops = {
+	.init = rtl8139_probe,
+	.halt = rtl_disable,
+	.send = rtl_transmit,
+	.recv = rtl_poll,
+#ifdef CONFIG_MCAST_TFTP
+	.mcast = rtl_bcast_addr
+#endif
+};
+
 int rtl8139_initialize(bd_t *bis)
 {
 	pci_dev_t devno;
@@ -229,13 +239,7 @@  int rtl8139_initialize(bd_t *bis)
 
 		dev->priv = (void *) devno;
 		dev->iobase = (int)bus_to_phys(iobase);
-		dev->eo->init = rtl8139_probe;
-		dev->eo->halt = rtl_disable;
-		dev->eo->send = rtl_transmit;
-		dev->eo->recv = rtl_poll;
-#ifdef CONFIG_MCAST_TFTP
-		dev->eo->mcast = rtl_bcast_addr;
-#endif
+		dev->eo = &rtl8139_ops;
 
 		eth_register (dev);