aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-12-17 14:54:39 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:28 -0500
commit5b3f355d8fef95901505e924818b3031092453c2 (patch)
tree4e83412e4337002f26be509afc74d484cf829d60
parent61030bfb79148b12b661580c8e3c2adfe1d9fc9e (diff)
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: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 9f530ff43c21..3509542eed87 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -733,10 +733,8 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
733 if (unlikely(retval < 0)) 733 if (unlikely(retval < 0))
734 return retval; 734 return retval;
735 735
736 cache_kobject[cpu]->parent = &sys_dev->kobj; 736 retval = kobject_init_and_add(cache_kobject[cpu], &ktype_percpu_entry,
737 kobject_set_name(cache_kobject[cpu], "%s", "cache"); 737 &sys_dev->kobj, "%s", "cache");
738 cache_kobject[cpu]->ktype = &ktype_percpu_entry;
739 retval = kobject_register(cache_kobject[cpu]);
740 if (retval < 0) { 738 if (retval < 0) {
741 cpuid4_cache_sysfs_exit(cpu); 739 cpuid4_cache_sysfs_exit(cpu);
742 return retval; 740 return retval;
@@ -746,10 +744,9 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
746 this_object = INDEX_KOBJECT_PTR(cpu,i); 744 this_object = INDEX_KOBJECT_PTR(cpu,i);
747 this_object->cpu = cpu; 745 this_object->cpu = cpu;
748 this_object->index = i; 746 this_object->index = i;
749 this_object->kobj.parent = cache_kobject[cpu]; 747 retval = kobject_init_and_add(&(this_object->kobj),
750 kobject_set_name(&(this_object->kobj), "index%1lu", i); 748 &ktype_cache, cache_kobject[cpu],
751 this_object->kobj.ktype = &ktype_cache; 749 "index%1lu", i);
752 retval = kobject_register(&(this_object->kobj));
753 if (unlikely(retval)) { 750 if (unlikely(retval)) {
754 for (j = 0; j < i; j++) { 751 for (j = 0; j < i; j++) {
755 kobject_unregister( 752 kobject_unregister(
@@ -759,10 +756,12 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
759 cpuid4_cache_sysfs_exit(cpu); 756 cpuid4_cache_sysfs_exit(cpu);
760 break; 757 break;
761 } 758 }
759 kobject_uevent(&(this_object->kobj), KOBJ_ADD);
762 } 760 }
763 if (!retval) 761 if (!retval)
764 cpu_set(cpu, cache_dev_map); 762 cpu_set(cpu, cache_dev_map);
765 763
764 kobject_uevent(cache_kobject[cpu], KOBJ_ADD);
766 return retval; 765 return retval;
767} 766}
768 767