[U-Boot] [RFC PATCH 15/50] net: dnet: Pull out init of struct eth_ops
Tomas Hlavacek
tmshlvck at gmail.com
Fri Nov 2 18:18:07 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/net/dnet.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index be0891f..126828e 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -355,6 +355,13 @@ static void dnet_halt(struct eth_device *netdev)
dnet_writew_mac(dnet, DNET_INTERNAL_MODE_REG, 0);
}
+static struct eth_ops dnet_ops = {
+ .init = dnet_init,
+ .halt = dnet_halt,
+ .send = dnet_send,
+ .recv = dnet_recv
+};
+
int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr)
{
struct dnet_device *dnet;
@@ -374,10 +381,7 @@ int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr)
dnet->phy_addr = phy_addr;
sprintf(netdev->name, "dnet%d", id);
- netdev->eo->init = dnet_init;
- netdev->eo->halt = dnet_halt;
- netdev->eo->send = dnet_send;
- netdev->eo->recv = dnet_recv;
+ netdev->eo = &dnet_ops;
dev_capa = readl(&dnet->regs->VERCAPS) & 0xFFFF;
debug("%s: has %smdio, %sirq, %sgigabit, %sdma\n", netdev->name,
--
1.7.10.4
More information about the U-Boot
mailing list