提交 5b296bc9 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

sky2: use debugfs rename

Use debugfs rename to handle device neame changes.
Signed-off-by: NStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 3f61e427
...@@ -3841,42 +3841,34 @@ static int sky2_device_event(struct notifier_block *unused, ...@@ -3841,42 +3841,34 @@ static int sky2_device_event(struct notifier_block *unused,
unsigned long event, void *ptr) unsigned long event, void *ptr)
{ {
struct net_device *dev = ptr; struct net_device *dev = ptr;
struct sky2_port *sky2 = netdev_priv(dev);
if (dev->open == sky2_up) { if (dev->open != sky2_up || !sky2_debug)
struct sky2_port *sky2 = netdev_priv(dev); return NOTIFY_DONE;
switch(event) { switch(event) {
case NETDEV_CHANGENAME: case NETDEV_CHANGENAME:
if (!netif_running(dev)) if (sky2->debugfs) {
break; sky2->debugfs = debugfs_rename(sky2_debug, sky2->debugfs,
/* fallthrough */ sky2_debug, dev->name);
case NETDEV_DOWN: }
case NETDEV_GOING_DOWN: break;
if (sky2->debugfs) {
printk(KERN_DEBUG PFX "%s: remove debugfs\n",
dev->name);
debugfs_remove(sky2->debugfs);
sky2->debugfs = NULL;
}
if (event != NETDEV_CHANGENAME) case NETDEV_GOING_DOWN:
break; if (sky2->debugfs) {
/* fallthrough for changename */ printk(KERN_DEBUG PFX "%s: remove debugfs\n",
case NETDEV_UP: dev->name);
if (sky2_debug) { debugfs_remove(sky2->debugfs);
struct dentry *d; sky2->debugfs = NULL;
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;
} }
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; return NOTIFY_DONE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册