Commit 5b3f355d authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Kobject: change arch/x86/kernel/cpu/intel_cacheinfo.c to use kobject_init_and_add

Stop using kobject_register, as this way we can control the sending of
the uevent properly, after everything is properly initialized.

Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 61030bfb
...@@ -733,10 +733,8 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) ...@@ -733,10 +733,8 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
if (unlikely(retval < 0)) if (unlikely(retval < 0))
return retval; return retval;
cache_kobject[cpu]->parent = &sys_dev->kobj; retval = kobject_init_and_add(cache_kobject[cpu], &ktype_percpu_entry,
kobject_set_name(cache_kobject[cpu], "%s", "cache"); &sys_dev->kobj, "%s", "cache");
cache_kobject[cpu]->ktype = &ktype_percpu_entry;
retval = kobject_register(cache_kobject[cpu]);
if (retval < 0) { if (retval < 0) {
cpuid4_cache_sysfs_exit(cpu); cpuid4_cache_sysfs_exit(cpu);
return retval; return retval;
...@@ -746,10 +744,9 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) ...@@ -746,10 +744,9 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
this_object = INDEX_KOBJECT_PTR(cpu,i); this_object = INDEX_KOBJECT_PTR(cpu,i);
this_object->cpu = cpu; this_object->cpu = cpu;
this_object->index = i; this_object->index = i;
this_object->kobj.parent = cache_kobject[cpu]; retval = kobject_init_and_add(&(this_object->kobj),
kobject_set_name(&(this_object->kobj), "index%1lu", i); &ktype_cache, cache_kobject[cpu],
this_object->kobj.ktype = &ktype_cache; "index%1lu", i);
retval = kobject_register(&(this_object->kobj));
if (unlikely(retval)) { if (unlikely(retval)) {
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
kobject_unregister( kobject_unregister(
...@@ -759,10 +756,12 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) ...@@ -759,10 +756,12 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
cpuid4_cache_sysfs_exit(cpu); cpuid4_cache_sysfs_exit(cpu);
break; break;
} }
kobject_uevent(&(this_object->kobj), KOBJ_ADD);
} }
if (!retval) if (!retval)
cpu_set(cpu, cache_dev_map); cpu_set(cpu, cache_dev_map);
kobject_uevent(cache_kobject[cpu], KOBJ_ADD);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment