diff options
Diffstat (limited to 'drivers/base/cpu.c')
-rw-r--r-- | drivers/base/cpu.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index db87e78d7459..4dabf5077c48 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -208,6 +208,25 @@ static ssize_t print_cpus_offline(struct device *dev, | |||
208 | } | 208 | } |
209 | static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL); | 209 | static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL); |
210 | 210 | ||
211 | static void cpu_device_release(struct device *dev) | ||
212 | { | ||
213 | /* | ||
214 | * This is an empty function to prevent the driver core from spitting a | ||
215 | * warning at us. Yes, I know this is directly opposite of what the | ||
216 | * documentation for the driver core and kobjects say, and the author | ||
217 | * of this code has already been publically ridiculed for doing | ||
218 | * something as foolish as this. However, at this point in time, it is | ||
219 | * the only way to handle the issue of statically allocated cpu | ||
220 | * devices. The different architectures will have their cpu device | ||
221 | * code reworked to properly handle this in the near future, so this | ||
222 | * function will then be changed to correctly free up the memory held | ||
223 | * by the cpu device. | ||
224 | * | ||
225 | * Never copy this way of doing things, or you too will be made fun of | ||
226 | * on the linux-kerenl list, you have been warned. | ||
227 | */ | ||
228 | } | ||
229 | |||
211 | /* | 230 | /* |
212 | * register_cpu - Setup a sysfs device for a CPU. | 231 | * register_cpu - Setup a sysfs device for a CPU. |
213 | * @cpu - cpu->hotpluggable field set to 1 will generate a control file in | 232 | * @cpu - cpu->hotpluggable field set to 1 will generate a control file in |
@@ -221,8 +240,10 @@ int __cpuinit register_cpu(struct cpu *cpu, int num) | |||
221 | int error; | 240 | int error; |
222 | 241 | ||
223 | cpu->node_id = cpu_to_node(num); | 242 | cpu->node_id = cpu_to_node(num); |
243 | memset(&cpu->dev, 0x00, sizeof(struct device)); | ||
224 | cpu->dev.id = num; | 244 | cpu->dev.id = num; |
225 | cpu->dev.bus = &cpu_subsys; | 245 | cpu->dev.bus = &cpu_subsys; |
246 | cpu->dev.release = cpu_device_release; | ||
226 | error = device_register(&cpu->dev); | 247 | error = device_register(&cpu->dev); |
227 | if (!error && cpu->hotpluggable) | 248 | if (!error && cpu->hotpluggable) |
228 | register_cpu_control(cpu); | 249 | register_cpu_control(cpu); |