aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/apic_32.c2
-rw-r--r--arch/x86/kernel/apic_64.c2
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c24
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_64.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd_64.c30
-rw-r--r--arch/x86/kernel/cpuid.c6
-rw-r--r--arch/x86/kernel/i8237.c2
-rw-r--r--arch/x86/kernel/i8259_32.c2
-rw-r--r--arch/x86/kernel/i8259_64.c2
-rw-r--r--arch/x86/kernel/io_apic_32.c2
-rw-r--r--arch/x86/kernel/io_apic_64.c2
-rw-r--r--arch/x86/kernel/msr.c6
-rw-r--r--arch/x86/kernel/nmi_32.c2
-rw-r--r--arch/x86/kernel/nmi_64.c2
-rw-r--r--arch/x86/oprofile/nmi_int.c2
15 files changed, 43 insertions, 45 deletions
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index edb5108e5d0e..a56c782653be 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -1530,7 +1530,7 @@ static int lapic_resume(struct sys_device *dev)
1530 */ 1530 */
1531 1531
1532static struct sysdev_class lapic_sysclass = { 1532static struct sysdev_class lapic_sysclass = {
1533 set_kset_name("lapic"), 1533 .name = "lapic",
1534 .resume = lapic_resume, 1534 .resume = lapic_resume,
1535 .suspend = lapic_suspend, 1535 .suspend = lapic_suspend,
1536}; 1536};
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index f28ccb588fba..fa6cdee6d303 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -639,7 +639,7 @@ static int lapic_resume(struct sys_device *dev)
639} 639}
640 640
641static struct sysdev_class lapic_sysclass = { 641static struct sysdev_class lapic_sysclass = {
642 set_kset_name("lapic"), 642 .name = "lapic",
643 .resume = lapic_resume, 643 .resume = lapic_resume,
644 .suspend = lapic_suspend, 644 .suspend = lapic_suspend,
645}; 645};
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 9f530ff43c21..8b4507b8469b 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,23 +744,23 @@ 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_put(&(INDEX_KOBJECT_PTR(cpu,j)->kobj));
756 &(INDEX_KOBJECT_PTR(cpu,j)->kobj));
757 } 753 }
758 kobject_unregister(cache_kobject[cpu]); 754 kobject_put(cache_kobject[cpu]);
759 cpuid4_cache_sysfs_exit(cpu); 755 cpuid4_cache_sysfs_exit(cpu);
760 break; 756 break;
761 } 757 }
758 kobject_uevent(&(this_object->kobj), KOBJ_ADD);
762 } 759 }
763 if (!retval) 760 if (!retval)
764 cpu_set(cpu, cache_dev_map); 761 cpu_set(cpu, cache_dev_map);
765 762
763 kobject_uevent(cache_kobject[cpu], KOBJ_ADD);
766 return retval; 764 return retval;
767} 765}
768 766
@@ -778,8 +776,8 @@ static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)
778 cpu_clear(cpu, cache_dev_map); 776 cpu_clear(cpu, cache_dev_map);
779 777
780 for (i = 0; i < num_cache_leaves; i++) 778 for (i = 0; i < num_cache_leaves; i++)
781 kobject_unregister(&(INDEX_KOBJECT_PTR(cpu,i)->kobj)); 779 kobject_put(&(INDEX_KOBJECT_PTR(cpu,i)->kobj));
782 kobject_unregister(cache_kobject[cpu]); 780 kobject_put(cache_kobject[cpu]);
783 cpuid4_cache_sysfs_exit(cpu); 781 cpuid4_cache_sysfs_exit(cpu);
784} 782}
785 783
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index 4b21d29fb5aa..242e8668dbeb 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -745,7 +745,7 @@ static void mce_restart(void)
745 745
746static struct sysdev_class mce_sysclass = { 746static struct sysdev_class mce_sysclass = {
747 .resume = mce_resume, 747 .resume = mce_resume,
748 set_kset_name("machinecheck"), 748 .name = "machinecheck",
749}; 749};
750 750
751DEFINE_PER_CPU(struct sys_device, device_mce); 751DEFINE_PER_CPU(struct sys_device, device_mce);
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
index 752fb16a817d..753588755fee 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
@@ -65,7 +65,7 @@ static struct threshold_block threshold_defaults = {
65}; 65};
66 66
67struct threshold_bank { 67struct threshold_bank {
68 struct kobject kobj; 68 struct kobject *kobj;
69 struct threshold_block *blocks; 69 struct threshold_block *blocks;
70 cpumask_t cpus; 70 cpumask_t cpus;
71}; 71};
@@ -432,10 +432,9 @@ static __cpuinit int allocate_threshold_blocks(unsigned int cpu,
432 else 432 else
433 per_cpu(threshold_banks, cpu)[bank]->blocks = b; 433 per_cpu(threshold_banks, cpu)[bank]->blocks = b;
434 434
435 kobject_set_name(&b->kobj, "misc%i", block); 435 err = kobject_init_and_add(&b->kobj, &threshold_ktype,
436 b->kobj.parent = &per_cpu(threshold_banks, cpu)[bank]->kobj; 436 per_cpu(threshold_banks, cpu)[bank]->kobj,
437 b->kobj.ktype = &threshold_ktype; 437 "misc%i", block);
438 err = kobject_register(&b->kobj);
439 if (err) 438 if (err)
440 goto out_free; 439 goto out_free;
441recurse: 440recurse:
@@ -451,11 +450,13 @@ recurse:
451 if (err) 450 if (err)
452 goto out_free; 451 goto out_free;
453 452
453 kobject_uevent(&b->kobj, KOBJ_ADD);
454
454 return err; 455 return err;
455 456
456out_free: 457out_free:
457 if (b) { 458 if (b) {
458 kobject_unregister(&b->kobj); 459 kobject_put(&b->kobj);
459 kfree(b); 460 kfree(b);
460 } 461 }
461 return err; 462 return err;
@@ -489,7 +490,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
489 goto out; 490 goto out;
490 491
491 err = sysfs_create_link(&per_cpu(device_mce, cpu).kobj, 492 err = sysfs_create_link(&per_cpu(device_mce, cpu).kobj,
492 &b->kobj, name); 493 b->kobj, name);
493 if (err) 494 if (err)
494 goto out; 495 goto out;
495 496
@@ -505,16 +506,15 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
505 goto out; 506 goto out;
506 } 507 }
507 508
508 kobject_set_name(&b->kobj, "threshold_bank%i", bank); 509 b->kobj = kobject_create_and_add(name, &per_cpu(device_mce, cpu).kobj);
509 b->kobj.parent = &per_cpu(device_mce, cpu).kobj; 510 if (!b->kobj)
511 goto out_free;
512
510#ifndef CONFIG_SMP 513#ifndef CONFIG_SMP
511 b->cpus = CPU_MASK_ALL; 514 b->cpus = CPU_MASK_ALL;
512#else 515#else
513 b->cpus = per_cpu(cpu_core_map, cpu); 516 b->cpus = per_cpu(cpu_core_map, cpu);
514#endif 517#endif
515 err = kobject_register(&b->kobj);
516 if (err)
517 goto out_free;
518 518
519 per_cpu(threshold_banks, cpu)[bank] = b; 519 per_cpu(threshold_banks, cpu)[bank] = b;
520 520
@@ -531,7 +531,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
531 continue; 531 continue;
532 532
533 err = sysfs_create_link(&per_cpu(device_mce, i).kobj, 533 err = sysfs_create_link(&per_cpu(device_mce, i).kobj,
534 &b->kobj, name); 534 b->kobj, name);
535 if (err) 535 if (err)
536 goto out; 536 goto out;
537 537
@@ -581,7 +581,7 @@ static void deallocate_threshold_block(unsigned int cpu,
581 return; 581 return;
582 582
583 list_for_each_entry_safe(pos, tmp, &head->blocks->miscj, miscj) { 583 list_for_each_entry_safe(pos, tmp, &head->blocks->miscj, miscj) {
584 kobject_unregister(&pos->kobj); 584 kobject_put(&pos->kobj);
585 list_del(&pos->miscj); 585 list_del(&pos->miscj);
586 kfree(pos); 586 kfree(pos);
587 } 587 }
@@ -627,7 +627,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
627 deallocate_threshold_block(cpu, bank); 627 deallocate_threshold_block(cpu, bank);
628 628
629free_out: 629free_out:
630 kobject_unregister(&b->kobj); 630 kobject_put(b->kobj);
631 kfree(b); 631 kfree(b);
632 per_cpu(threshold_banks, cpu)[bank] = NULL; 632 per_cpu(threshold_banks, cpu)[bank] = NULL;
633} 633}
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 05c9936a16cc..d387c770c518 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -157,15 +157,15 @@ static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb,
157 157
158 switch (action) { 158 switch (action) {
159 case CPU_UP_PREPARE: 159 case CPU_UP_PREPARE:
160 case CPU_UP_PREPARE_FROZEN:
161 err = cpuid_device_create(cpu); 160 err = cpuid_device_create(cpu);
162 break; 161 break;
163 case CPU_UP_CANCELED: 162 case CPU_UP_CANCELED:
164 case CPU_UP_CANCELED_FROZEN:
165 case CPU_DEAD: 163 case CPU_DEAD:
166 case CPU_DEAD_FROZEN:
167 cpuid_device_destroy(cpu); 164 cpuid_device_destroy(cpu);
168 break; 165 break;
166 case CPU_UP_CANCELED_FROZEN:
167 destroy_suspended_device(cpuid_class, MKDEV(CPUID_MAJOR, cpu));
168 break;
169 } 169 }
170 return err ? NOTIFY_BAD : NOTIFY_OK; 170 return err ? NOTIFY_BAD : NOTIFY_OK;
171} 171}
diff --git a/arch/x86/kernel/i8237.c b/arch/x86/kernel/i8237.c
index 29313832df0c..dbd6c1d1b638 100644
--- a/arch/x86/kernel/i8237.c
+++ b/arch/x86/kernel/i8237.c
@@ -51,7 +51,7 @@ static int i8237A_suspend(struct sys_device *dev, pm_message_t state)
51} 51}
52 52
53static struct sysdev_class i8237_sysdev_class = { 53static struct sysdev_class i8237_sysdev_class = {
54 set_kset_name("i8237"), 54 .name = "i8237",
55 .suspend = i8237A_suspend, 55 .suspend = i8237A_suspend,
56 .resume = i8237A_resume, 56 .resume = i8237A_resume,
57}; 57};
diff --git a/arch/x86/kernel/i8259_32.c b/arch/x86/kernel/i8259_32.c
index f634fc715c99..5f3496d01984 100644
--- a/arch/x86/kernel/i8259_32.c
+++ b/arch/x86/kernel/i8259_32.c
@@ -258,7 +258,7 @@ static int i8259A_shutdown(struct sys_device *dev)
258} 258}
259 259
260static struct sysdev_class i8259_sysdev_class = { 260static struct sysdev_class i8259_sysdev_class = {
261 set_kset_name("i8259"), 261 .name = "i8259",
262 .suspend = i8259A_suspend, 262 .suspend = i8259A_suspend,
263 .resume = i8259A_resume, 263 .resume = i8259A_resume,
264 .shutdown = i8259A_shutdown, 264 .shutdown = i8259A_shutdown,
diff --git a/arch/x86/kernel/i8259_64.c b/arch/x86/kernel/i8259_64.c
index 3f27ea0b9816..ba6d57286f56 100644
--- a/arch/x86/kernel/i8259_64.c
+++ b/arch/x86/kernel/i8259_64.c
@@ -370,7 +370,7 @@ static int i8259A_shutdown(struct sys_device *dev)
370} 370}
371 371
372static struct sysdev_class i8259_sysdev_class = { 372static struct sysdev_class i8259_sysdev_class = {
373 set_kset_name("i8259"), 373 .name = "i8259",
374 .suspend = i8259A_suspend, 374 .suspend = i8259A_suspend,
375 .resume = i8259A_resume, 375 .resume = i8259A_resume,
376 .shutdown = i8259A_shutdown, 376 .shutdown = i8259A_shutdown,
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index a6b1490e00c4..ab77f1905469 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -2401,7 +2401,7 @@ static int ioapic_resume(struct sys_device *dev)
2401} 2401}
2402 2402
2403static struct sysdev_class ioapic_sysdev_class = { 2403static struct sysdev_class ioapic_sysdev_class = {
2404 set_kset_name("ioapic"), 2404 .name = "ioapic",
2405 .suspend = ioapic_suspend, 2405 .suspend = ioapic_suspend,
2406 .resume = ioapic_resume, 2406 .resume = ioapic_resume,
2407}; 2407};
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index cbac1670c7c3..23a3ac06a23e 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -1850,7 +1850,7 @@ static int ioapic_resume(struct sys_device *dev)
1850} 1850}
1851 1851
1852static struct sysdev_class ioapic_sysdev_class = { 1852static struct sysdev_class ioapic_sysdev_class = {
1853 set_kset_name("ioapic"), 1853 .name = "ioapic",
1854 .suspend = ioapic_suspend, 1854 .suspend = ioapic_suspend,
1855 .resume = ioapic_resume, 1855 .resume = ioapic_resume,
1856}; 1856};
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index ee6eba4ecfea..21f6e3c0be18 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -155,15 +155,15 @@ static int __cpuinit msr_class_cpu_callback(struct notifier_block *nfb,
155 155
156 switch (action) { 156 switch (action) {
157 case CPU_UP_PREPARE: 157 case CPU_UP_PREPARE:
158 case CPU_UP_PREPARE_FROZEN:
159 err = msr_device_create(cpu); 158 err = msr_device_create(cpu);
160 break; 159 break;
161 case CPU_UP_CANCELED: 160 case CPU_UP_CANCELED:
162 case CPU_UP_CANCELED_FROZEN:
163 case CPU_DEAD: 161 case CPU_DEAD:
164 case CPU_DEAD_FROZEN:
165 msr_device_destroy(cpu); 162 msr_device_destroy(cpu);
166 break; 163 break;
164 case CPU_UP_CANCELED_FROZEN:
165 destroy_suspended_device(msr_class, MKDEV(MSR_MAJOR, cpu));
166 break;
167 } 167 }
168 return err ? NOTIFY_BAD : NOTIFY_OK; 168 return err ? NOTIFY_BAD : NOTIFY_OK;
169} 169}
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index 852db2906921..4f4bfd3a88b6 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -176,7 +176,7 @@ static int lapic_nmi_resume(struct sys_device *dev)
176 176
177 177
178static struct sysdev_class nmi_sysclass = { 178static struct sysdev_class nmi_sysclass = {
179 set_kset_name("lapic_nmi"), 179 .name = "lapic_nmi",
180 .resume = lapic_nmi_resume, 180 .resume = lapic_nmi_resume,
181 .suspend = lapic_nmi_suspend, 181 .suspend = lapic_nmi_suspend,
182}; 182};
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index 4253c4e8849c..c3d1476b6a11 100644
--- a/arch/x86/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
@@ -211,7 +211,7 @@ static int lapic_nmi_resume(struct sys_device *dev)
211} 211}
212 212
213static struct sysdev_class nmi_sysclass = { 213static struct sysdev_class nmi_sysclass = {
214 set_kset_name("lapic_nmi"), 214 .name = "lapic_nmi",
215 .resume = lapic_nmi_resume, 215 .resume = lapic_nmi_resume,
216 .suspend = lapic_nmi_suspend, 216 .suspend = lapic_nmi_suspend,
217}; 217};
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 944bbcdd2b8d..c8ab79ef4276 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -51,7 +51,7 @@ static int nmi_resume(struct sys_device *dev)
51 51
52 52
53static struct sysdev_class oprofile_sysclass = { 53static struct sysdev_class oprofile_sysclass = {
54 set_kset_name("oprofile"), 54 .name = "oprofile",
55 .resume = nmi_resume, 55 .resume = nmi_resume,
56 .suspend = nmi_suspend, 56 .suspend = nmi_suspend,
57}; 57};