login
Header Space

 
 

[RFC][PATCH 2/3] Move net_device->init callback on net_device_ops.

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linux Netdev List <netdev@...>
Date: Friday, April 4, 2008 - 10:12 am

This is how all the other temporary operations will be done.
The return code is still 0 in case init is not set by driver.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---
 net/core/dev.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 5e7bf79..a01c078 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3701,8 +3701,8 @@ int register_netdevice(struct net_device *dev)
 	dev->iflink = -1;
 
 	/* Init, if this function is available */
-	if (dev->init) {
-		ret = dev->init(dev);
+	if (dev->nd_ops->init) {
+		ret = dev->nd_ops->init(dev);
 		if (ret) {
 			if (ret > 0)
 				ret = -EIO;
@@ -3980,7 +3980,16 @@ static struct net_device_stats *internal_stats(struct net_device *dev)
  * temporary devices operations - to be removed very soon
  */
 
+static int nd_default_init(struct net_device *dev)
+{
+	if (dev->init)
+		return dev->init(dev);
+	else
+		return 0;
+}
+
 static struct net_device_ops nd_default_ops = {
+	.init			= nd_default_init,
 };
 
 /**
-- 
1.5.3.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC][PATCH 2/3] Move net_device->init callback on net_de..., Pavel Emelyanov, (Fri Apr 4, 10:12 am)
[RFC][PATCH 1/3] Introduce the net_device_ops structure., Pavel Emelyanov, (Fri Apr 4, 10:10 am)
Re: [RFC][PATCH 1/3] Introduce the net_device_ops structure., Stephen Hemminger, (Fri Apr 4, 11:14 am)
Re: [RFC][PATCH 1/3] Introduce the net_device_ops structure., Patrick McHardy, (Fri Apr 4, 11:54 am)
speck-geostationary