netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@openvz.org>
To: Linux Netdev List <netdev@vger.kernel.org>
Subject: [RFC][PATCH 2/3] Move net_device->init callback on net_device_ops.
Date: Fri, 04 Apr 2008 18:12:27 +0400	[thread overview]
Message-ID: <47F6374B.5000207@openvz.org> (raw)
In-Reply-To: <47F63681.1030603@openvz.org>

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


  parent reply	other threads:[~2008-04-04 13:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-04 14:09 [RFC][PATCH 0/3] Make loopback device weight twice as little Pavel Emelyanov
2008-04-04 14:10 ` [RFC][PATCH 1/3] Introduce the net_device_ops structure Pavel Emelyanov
2008-04-04 15:14   ` Stephen Hemminger
2008-04-04 15:54     ` Patrick McHardy
2008-04-14  4:20       ` David Miller
2008-04-04 14:12 ` Pavel Emelyanov [this message]
2008-04-04 14:14 ` [RFC][PATCH 3/3] Move net_device->uninit callback on net_device_ops Pavel Emelyanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47F6374B.5000207@openvz.org \
    --to=xemul@openvz.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).