diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-08-29 15:58:11 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:50:51 -0400 |
commit | 5b296bc9e1e5570ce60262e62af066f70180cb99 (patch) | |
tree | 5977343cf8ffb82bd56859c959b4ef1c679e1f5d /drivers/net | |
parent | 3f61e4278c8489c1d026a45b0903cd4230d1ec07 (diff) |
sky2: use debugfs rename
Use debugfs rename to handle device neame changes.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/sky2.c | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index a0d75b0f3798..d10af8ed93df 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -3841,42 +3841,34 @@ static int sky2_device_event(struct notifier_block *unused, | |||
3841 | unsigned long event, void *ptr) | 3841 | unsigned long event, void *ptr) |
3842 | { | 3842 | { |
3843 | struct net_device *dev = ptr; | 3843 | struct net_device *dev = ptr; |
3844 | struct sky2_port *sky2 = netdev_priv(dev); | ||
3844 | 3845 | ||
3845 | if (dev->open == sky2_up) { | 3846 | if (dev->open != sky2_up || !sky2_debug) |
3846 | struct sky2_port *sky2 = netdev_priv(dev); | 3847 | return NOTIFY_DONE; |
3847 | 3848 | ||
3848 | switch(event) { | 3849 | switch(event) { |
3849 | case NETDEV_CHANGENAME: | 3850 | case NETDEV_CHANGENAME: |
3850 | if (!netif_running(dev)) | 3851 | if (sky2->debugfs) { |
3851 | break; | 3852 | sky2->debugfs = debugfs_rename(sky2_debug, sky2->debugfs, |
3852 | /* fallthrough */ | 3853 | sky2_debug, dev->name); |
3853 | case NETDEV_DOWN: | 3854 | } |
3854 | case NETDEV_GOING_DOWN: | 3855 | break; |
3855 | if (sky2->debugfs) { | ||
3856 | printk(KERN_DEBUG PFX "%s: remove debugfs\n", | ||
3857 | dev->name); | ||
3858 | debugfs_remove(sky2->debugfs); | ||
3859 | sky2->debugfs = NULL; | ||
3860 | } | ||
3861 | 3856 | ||
3862 | if (event != NETDEV_CHANGENAME) | 3857 | case NETDEV_GOING_DOWN: |
3863 | break; | 3858 | if (sky2->debugfs) { |
3864 | /* fallthrough for changename */ | 3859 | printk(KERN_DEBUG PFX "%s: remove debugfs\n", |
3865 | case NETDEV_UP: | 3860 | dev->name); |
3866 | if (sky2_debug) { | 3861 | debugfs_remove(sky2->debugfs); |
3867 | struct dentry *d; | 3862 | sky2->debugfs = NULL; |
3868 | d = debugfs_create_file(dev->name, S_IRUGO, | ||
3869 | sky2_debug, dev, | ||
3870 | &sky2_debug_fops); | ||
3871 | if (d == NULL || IS_ERR(d)) | ||
3872 | printk(KERN_INFO PFX | ||
3873 | "%s: debugfs create failed\n", | ||
3874 | dev->name); | ||
3875 | else | ||
3876 | sky2->debugfs = d; | ||
3877 | } | ||
3878 | break; | ||
3879 | } | 3863 | } |
3864 | break; | ||
3865 | |||
3866 | case NETDEV_UP: | ||
3867 | sky2->debugfs = debugfs_create_file(dev->name, S_IRUGO, | ||
3868 | sky2_debug, dev, | ||
3869 | &sky2_debug_fops); | ||
3870 | if (IS_ERR(sky2->debugfs)) | ||
3871 | sky2->debugfs = NULL; | ||
3880 | } | 3872 | } |
3881 | 3873 | ||
3882 | return NOTIFY_DONE; | 3874 | return NOTIFY_DONE; |