diff options
-rw-r--r-- | net/core/dev.c | 4 | ||||
-rw-r--r-- | net/core/net-sysfs.c | 7 | ||||
-rw-r--r-- | net/core/net-sysfs.h | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index a9500e6b3aa2..d334446a8eaf 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -3776,6 +3776,7 @@ int register_netdevice(struct net_device *dev) | |||
3776 | } | 3776 | } |
3777 | } | 3777 | } |
3778 | 3778 | ||
3779 | netdev_initialize_kobject(dev); | ||
3779 | ret = netdev_register_kobject(dev); | 3780 | ret = netdev_register_kobject(dev); |
3780 | if (ret) | 3781 | if (ret) |
3781 | goto err_uninit; | 3782 | goto err_uninit; |
@@ -4208,7 +4209,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
4208 | } | 4209 | } |
4209 | 4210 | ||
4210 | /* Fixup kobjects */ | 4211 | /* Fixup kobjects */ |
4211 | err = device_rename(&dev->dev, dev->name); | 4212 | netdev_unregister_kobject(dev); |
4213 | err = netdev_register_kobject(dev); | ||
4212 | WARN_ON(err); | 4214 | WARN_ON(err); |
4213 | 4215 | ||
4214 | /* Add the device back in the hashes */ | 4216 | /* Add the device back in the hashes */ |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 4e7b847347f7..90e2177af081 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -449,7 +449,6 @@ int netdev_register_kobject(struct net_device *net) | |||
449 | struct device *dev = &(net->dev); | 449 | struct device *dev = &(net->dev); |
450 | struct attribute_group **groups = net->sysfs_groups; | 450 | struct attribute_group **groups = net->sysfs_groups; |
451 | 451 | ||
452 | device_initialize(dev); | ||
453 | dev->class = &net_class; | 452 | dev->class = &net_class; |
454 | dev->platform_data = net; | 453 | dev->platform_data = net; |
455 | dev->groups = groups; | 454 | dev->groups = groups; |
@@ -470,6 +469,12 @@ int netdev_register_kobject(struct net_device *net) | |||
470 | return device_add(dev); | 469 | return device_add(dev); |
471 | } | 470 | } |
472 | 471 | ||
472 | void netdev_initialize_kobject(struct net_device *net) | ||
473 | { | ||
474 | struct device *device = &(net->dev); | ||
475 | device_initialize(device); | ||
476 | } | ||
477 | |||
473 | int netdev_kobject_init(void) | 478 | int netdev_kobject_init(void) |
474 | { | 479 | { |
475 | return class_register(&net_class); | 480 | return class_register(&net_class); |
diff --git a/net/core/net-sysfs.h b/net/core/net-sysfs.h index f5f108db3924..14e7524260b3 100644 --- a/net/core/net-sysfs.h +++ b/net/core/net-sysfs.h | |||
@@ -4,5 +4,5 @@ | |||
4 | int netdev_kobject_init(void); | 4 | int netdev_kobject_init(void); |
5 | int netdev_register_kobject(struct net_device *); | 5 | int netdev_register_kobject(struct net_device *); |
6 | void netdev_unregister_kobject(struct net_device *); | 6 | void netdev_unregister_kobject(struct net_device *); |
7 | 7 | void netdev_initialize_kobject(struct net_device *); | |
8 | #endif | 8 | #endif |