netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [RFC] netdev sysfs failure handling
Date: Fri, 21 Apr 2006 13:42:05 -0700	[thread overview]
Message-ID: <20060421134205.2786a0ee@localhost.localdomain> (raw)

In case of sysfs failure, don't let device be brought up.
It can be cleared by unregister_netdevice so module can be unloaded
normally.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

--- sky2-2.6.17.orig/net/core/dev.c	2006-04-21 12:21:45.000000000 -0700
+++ sky2-2.6.17/net/core/dev.c	2006-04-21 12:46:48.000000000 -0700
@@ -3043,10 +3043,17 @@
 
 		switch(dev->reg_state) {
 		case NETREG_REGISTERING:
+			/* Can't do proper error handling here because
+			 * this is a delayed call after register_netdevice
+			 * so no way to tell device driver what is wrong.
+			 */
 			err = netdev_register_sysfs(dev);
-			if (err)
+			if (err) {
 				printk(KERN_ERR "%s: failed sysfs registration (%d)\n",
 				       dev->name, err);
+				/* Don't let device be brought up */
+				clear_bit(__LINK_STATE_PRESENT, &dev->state);
+			}
 			dev->reg_state = NETREG_REGISTERED;
 			break;
 

             reply	other threads:[~2006-04-21 20:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-21 20:42 Stephen Hemminger [this message]
2006-05-07  1:06 ` [RFC] netdev sysfs failure handling David S. Miller
2006-05-09 19:01   ` Stephen Hemminger
2006-05-09 21:05     ` David S. Miller
2006-05-09 21:40       ` Stephen Hemminger
2006-05-09 22:43         ` David S. Miller
2006-05-09 22:50           ` Stephen Hemminger

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=20060421134205.2786a0ee@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=davem@davemloft.net \
    --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).