[PATCH 1/2] net eth: make edev->init optional

Sascha Hauer s.hauer at pengutronix.de
Tue Oct 30 12:30:05 EDT 2012


edev->init is called at eth_register time unconditionally and is supposed
to initialize the ethernet hardware. Since it's called unconditionally
this could be done by the driver without having an additional hook.
Some drivers need their initialization done earlier since they also register
a mdiobus which does hardware accesses on registration time.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 net/eth.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/eth.c b/net/eth.c
index f3d7bfe..2cfdb96 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -269,7 +269,8 @@ int eth_register(struct eth_device *edev)
 	dev_add_param(dev, "netmask", eth_set_ipaddr, NULL, 0);
 	dev_add_param(dev, "serverip", eth_set_ipaddr, NULL, 0);
 
-	edev->init(edev);
+	if (edev->init)
+		edev->init(edev);
 
 	list_add_tail(&edev->list, &netdev_list);
 
-- 
1.7.10.4




More information about the barebox mailing list