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>
This commit is contained in:
parent
3f61e4278c
commit
5b296bc9e1
|
@ -3841,16 +3841,19 @@ 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;
|
||||||
|
|
||||||
if (dev->open == sky2_up) {
|
|
||||||
struct sky2_port *sky2 = netdev_priv(dev);
|
struct sky2_port *sky2 = netdev_priv(dev);
|
||||||
|
|
||||||
|
if (dev->open != sky2_up || !sky2_debug)
|
||||||
|
return NOTIFY_DONE;
|
||||||
|
|
||||||
switch(event) {
|
switch(event) {
|
||||||
case NETDEV_CHANGENAME:
|
case NETDEV_CHANGENAME:
|
||||||
if (!netif_running(dev))
|
if (sky2->debugfs) {
|
||||||
|
sky2->debugfs = debugfs_rename(sky2_debug, sky2->debugfs,
|
||||||
|
sky2_debug, dev->name);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
/* fallthrough */
|
|
||||||
case NETDEV_DOWN:
|
|
||||||
case NETDEV_GOING_DOWN:
|
case NETDEV_GOING_DOWN:
|
||||||
if (sky2->debugfs) {
|
if (sky2->debugfs) {
|
||||||
printk(KERN_DEBUG PFX "%s: remove debugfs\n",
|
printk(KERN_DEBUG PFX "%s: remove debugfs\n",
|
||||||
|
@ -3858,25 +3861,14 @@ static int sky2_device_event(struct notifier_block *unused,
|
||||||
debugfs_remove(sky2->debugfs);
|
debugfs_remove(sky2->debugfs);
|
||||||
sky2->debugfs = NULL;
|
sky2->debugfs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event != NETDEV_CHANGENAME)
|
|
||||||
break;
|
break;
|
||||||
/* fallthrough for changename */
|
|
||||||
case NETDEV_UP:
|
case NETDEV_UP:
|
||||||
if (sky2_debug) {
|
sky2->debugfs = debugfs_create_file(dev->name, S_IRUGO,
|
||||||
struct dentry *d;
|
|
||||||
d = debugfs_create_file(dev->name, S_IRUGO,
|
|
||||||
sky2_debug, dev,
|
sky2_debug, dev,
|
||||||
&sky2_debug_fops);
|
&sky2_debug_fops);
|
||||||
if (d == NULL || IS_ERR(d))
|
if (IS_ERR(sky2->debugfs))
|
||||||
printk(KERN_INFO PFX
|
sky2->debugfs = NULL;
|
||||||
"%s: debugfs create failed\n",
|
|
||||||
dev->name);
|
|
||||||
else
|
|
||||||
sky2->debugfs = d;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NOTIFY_DONE;
|
return NOTIFY_DONE;
|
||||||
|
|
Loading…
Reference in New Issue