aboutsummaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/net-sysfs.c7
-rw-r--r--net/core/net-sysfs.h2
3 files changed, 10 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index a9500e6b3aa..d334446a8ea 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3776,6 +3776,7 @@ int register_netdevice(struct net_device *dev)
}
}
+ netdev_initialize_kobject(dev);
ret = netdev_register_kobject(dev);
if (ret)
goto err_uninit;
@@ -4208,7 +4209,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
}
/* Fixup kobjects */
- err = device_rename(&dev->dev, dev->name);
+ netdev_unregister_kobject(dev);
+ err = netdev_register_kobject(dev);
WARN_ON(err);
/* Add the device back in the hashes */
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 4e7b847347f..90e2177af08 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)
struct device *dev = &(net->dev);
struct attribute_group **groups = net->sysfs_groups;
- device_initialize(dev);
dev->class = &net_class;
dev->platform_data = net;
dev->groups = groups;
@@ -470,6 +469,12 @@ int netdev_register_kobject(struct net_device *net)
return device_add(dev);
}
+void netdev_initialize_kobject(struct net_device *net)
+{
+ struct device *device = &(net->dev);
+ device_initialize(device);
+}
+
int netdev_kobject_init(void)
{
return class_register(&net_class);
diff --git a/net/core/net-sysfs.h b/net/core/net-sysfs.h
index f5f108db392..14e7524260b 100644
--- a/net/core/net-sysfs.h
+++ b/net/core/net-sysfs.h
@@ -4,5 +4,5 @@
int netdev_kobject_init(void);
int netdev_register_kobject(struct net_device *);
void netdev_unregister_kobject(struct net_device *);
-
+void netdev_initialize_kobject(struct net_device *);
#endif