netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org, akpm@linux-foundation.org
Subject: [PATCH 02/12] sky2: use debugfs rename
Date: Wed, 29 Aug 2007 12:58:11 -0700	[thread overview]
Message-ID: <20070829195842.759980631@linux-foundation.org> (raw)
In-Reply-To: 20070829193922.078561651@linux-foundation.org

[-- Attachment #1: sky2-debugfs-rename.patch --]
[-- Type: text/plain, Size: 1994 bytes --]

Use debugfs rename to handle device neame changes.

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

--- a/drivers/net/sky2.c	2007-08-29 11:36:04.000000000 -0700
+++ b/drivers/net/sky2.c	2007-08-29 11:40:09.000000000 -0700
@@ -3712,42 +3712,34 @@ static int sky2_device_event(struct noti
 			     unsigned long event, void *ptr)
 {
 	struct net_device *dev = ptr;
+	struct sky2_port *sky2 = netdev_priv(dev);
 
-	if (dev->open == sky2_up) {
-		struct sky2_port *sky2 = netdev_priv(dev);
+	if (dev->open != sky2_up || !sky2_debug)
+		return NOTIFY_DONE;
 
-		switch(event) {
-		case NETDEV_CHANGENAME:
-			if (!netif_running(dev))
-				break;
-			/* fallthrough */
-		case NETDEV_DOWN:
-		case NETDEV_GOING_DOWN:
-			if (sky2->debugfs) {
-				printk(KERN_DEBUG PFX "%s: remove debugfs\n",
-				       dev->name);
-				debugfs_remove(sky2->debugfs);
-				sky2->debugfs = NULL;
-			}
+	switch(event) {
+	case NETDEV_CHANGENAME:
+		if (sky2->debugfs) {
+			sky2->debugfs = debugfs_rename(sky2_debug, sky2->debugfs,
+						       sky2_debug, dev->name);
+		}
+		break;
 
-			if (event != NETDEV_CHANGENAME)
-				break;
-			/* fallthrough for changename */
-		case NETDEV_UP:
-			if (sky2_debug) {
-				struct dentry *d;
-				d = debugfs_create_file(dev->name, S_IRUGO,
-							sky2_debug, dev,
-							&sky2_debug_fops);
-				if (d == NULL || IS_ERR(d))
-					printk(KERN_INFO PFX
-					       "%s: debugfs create failed\n",
-					       dev->name);
-				else
-					sky2->debugfs = d;
-			}
-			break;
+	case NETDEV_GOING_DOWN:
+		if (sky2->debugfs) {
+			printk(KERN_DEBUG PFX "%s: remove debugfs\n",
+			       dev->name);
+			debugfs_remove(sky2->debugfs);
+			sky2->debugfs = NULL;
 		}
+		break;
+
+	case NETDEV_UP:
+		sky2->debugfs = debugfs_create_file(dev->name, S_IRUGO,
+						    sky2_debug, dev,
+						    &sky2_debug_fops);
+		if (IS_ERR(sky2->debugfs))
+			sky2->debugfs = NULL;
 	}
 
 	return NOTIFY_DONE;

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


  parent reply	other threads:[~2007-08-29 20:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-29 19:39 [PATCH 0/0] sky2: update for 2.6.24 Stephen Hemminger
2007-08-29 19:58 ` [PATCH 01/12] sky2: fe+ chip support Stephen Hemminger
2007-08-31 13:43   ` Jeff Garzik
2007-09-14 13:38     ` [PATCH] sky2: fix PHY setup on FE-P Stephen Hemminger
2007-08-29 19:58 ` Stephen Hemminger [this message]
2007-08-29 19:58 ` [PATCH 03/12] sky2: document GPHY_CTRL bits Stephen Hemminger
2007-08-29 19:58 ` [PATCH 04/12] sky2: dont restrict config space access Stephen Hemminger
2007-08-29 19:58 ` [PATCH 05/12] sky2: advanced error reporting Stephen Hemminger
2007-08-29 19:58 ` [PATCH 06/12] sky2: use pci_config access functions Stephen Hemminger
2007-08-29 19:58 ` [PATCH 07/12] sky2: use net_device internal stats Stephen Hemminger
2007-08-31 13:43   ` Jeff Garzik
2007-08-31 13:59     ` Stephen Hemminger
2007-08-29 19:58 ` [PATCH 08/12] ktime_sub_ns: analog of ktime_add_ns Stephen Hemminger
2007-08-29 19:58 ` [PATCH 09/12] export reciprocal_value for modules Stephen Hemminger
2007-08-29 19:58 ` [PATCH 10/12] sky2: hardware receive timestamp counter Stephen Hemminger
2007-08-29 19:58 ` [PATCH 11/12] sky2: avoid divide in receive path Stephen Hemminger
2007-08-29 19:58 ` [PATCH 12/12] sky2: 1.18 Stephen Hemminger
2007-08-30 20:36 ` [PATCH 0/0] sky2: update for 2.6.24 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=20070829195842.759980631@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=jgarzik@pobox.com \
    --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).