diff options
Diffstat (limited to 'drivers/base/cpu.c')
-rw-r--r-- | drivers/base/cpu.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index dd712b24ec91..4bef76a2f3f2 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/cpu.h> | 8 | #include <linux/cpu.h> |
9 | #include <linux/topology.h> | 9 | #include <linux/topology.h> |
10 | #include <linux/device.h> | 10 | #include <linux/device.h> |
11 | #include <linux/node.h> | ||
11 | 12 | ||
12 | #include "base.h" | 13 | #include "base.h" |
13 | 14 | ||
@@ -57,13 +58,12 @@ static void __devinit register_cpu_control(struct cpu *cpu) | |||
57 | { | 58 | { |
58 | sysdev_create_file(&cpu->sysdev, &attr_online); | 59 | sysdev_create_file(&cpu->sysdev, &attr_online); |
59 | } | 60 | } |
60 | void unregister_cpu(struct cpu *cpu, struct node *root) | 61 | void unregister_cpu(struct cpu *cpu) |
61 | { | 62 | { |
62 | int logical_cpu = cpu->sysdev.id; | 63 | int logical_cpu = cpu->sysdev.id; |
63 | 64 | ||
64 | if (root) | 65 | unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu)); |
65 | sysfs_remove_link(&root->sysdev.kobj, | 66 | |
66 | kobject_name(&cpu->sysdev.kobj)); | ||
67 | sysdev_remove_file(&cpu->sysdev, &attr_online); | 67 | sysdev_remove_file(&cpu->sysdev, &attr_online); |
68 | 68 | ||
69 | sysdev_unregister(&cpu->sysdev); | 69 | sysdev_unregister(&cpu->sysdev); |
@@ -109,23 +109,21 @@ static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); | |||
109 | * | 109 | * |
110 | * Initialize and register the CPU device. | 110 | * Initialize and register the CPU device. |
111 | */ | 111 | */ |
112 | int __devinit register_cpu(struct cpu *cpu, int num, struct node *root) | 112 | int __devinit register_cpu(struct cpu *cpu, int num) |
113 | { | 113 | { |
114 | int error; | 114 | int error; |
115 | |||
116 | cpu->node_id = cpu_to_node(num); | 115 | cpu->node_id = cpu_to_node(num); |
117 | cpu->sysdev.id = num; | 116 | cpu->sysdev.id = num; |
118 | cpu->sysdev.cls = &cpu_sysdev_class; | 117 | cpu->sysdev.cls = &cpu_sysdev_class; |
119 | 118 | ||
120 | error = sysdev_register(&cpu->sysdev); | 119 | error = sysdev_register(&cpu->sysdev); |
121 | if (!error && root) | 120 | |
122 | error = sysfs_create_link(&root->sysdev.kobj, | ||
123 | &cpu->sysdev.kobj, | ||
124 | kobject_name(&cpu->sysdev.kobj)); | ||
125 | if (!error && !cpu->no_control) | 121 | if (!error && !cpu->no_control) |
126 | register_cpu_control(cpu); | 122 | register_cpu_control(cpu); |
127 | if (!error) | 123 | if (!error) |
128 | cpu_sys_devices[num] = &cpu->sysdev; | 124 | cpu_sys_devices[num] = &cpu->sysdev; |
125 | if (!error) | ||
126 | register_cpu_under_node(num, cpu_to_node(num)); | ||
129 | 127 | ||
130 | #ifdef CONFIG_KEXEC | 128 | #ifdef CONFIG_KEXEC |
131 | if (!error) | 129 | if (!error) |
@@ -145,5 +143,13 @@ EXPORT_SYMBOL_GPL(get_cpu_sysdev); | |||
145 | 143 | ||
146 | int __init cpu_dev_init(void) | 144 | int __init cpu_dev_init(void) |
147 | { | 145 | { |
148 | return sysdev_class_register(&cpu_sysdev_class); | 146 | int err; |
147 | |||
148 | err = sysdev_class_register(&cpu_sysdev_class); | ||
149 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) | ||
150 | if (!err) | ||
151 | err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class); | ||
152 | #endif | ||
153 | |||
154 | return err; | ||
149 | } | 155 | } |