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