aboutsummaryrefslogtreecommitdiff
path: root/drivers/base/cpu.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-02-09 13:51:36 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-02-09 13:51:36 -0800
commitb0286db49a182187d39b512ee3748ae2b4dc3b17 (patch)
treef695f4c02a5cb1f5ee56b913adf6f81af03391c4 /drivers/base/cpu.c
parentae5cdd405bfc5799c07080ec35f48283a9b0142a (diff)
parent29bb5d4fd3140a7d5d02d858118c74a45f15c296 (diff)
Merge tag 'driver-core-3.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Driver core fixes for the 3.3-rc3 tree. A few fixes for kobject warnings that have popped up in the cpu hotplug path, and a regression fix for the speed of the hotplug memory code. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> * tag 'driver-core-3.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: driver-core: cpu: fix kobject warning when hotplugging a cpu ACPI: remove duplicated lines of merging problems with acpi_processor_add docbook: fix fatal errors in device-drivers docbook and add DMA Management section drivers/base/memory.c: fix memory_dev_init() long delay driver core: cpu: remove kernel warning when removing a cpu
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 db87e78d745..4dabf5077c4 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -208,6 +208,25 @@ static ssize_t print_cpus_offline(struct device *dev,
}
static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
+static void cpu_device_release(struct device *dev)
+{
+ /*
+ * This is an empty function to prevent the driver core from spitting a
+ * warning at us. Yes, I know this is directly opposite of what the
+ * documentation for the driver core and kobjects say, and the author
+ * of this code has already been publically ridiculed for doing
+ * something as foolish as this. However, at this point in time, it is
+ * the only way to handle the issue of statically allocated cpu
+ * devices. The different architectures will have their cpu device
+ * code reworked to properly handle this in the near future, so this
+ * function will then be changed to correctly free up the memory held
+ * by the cpu device.
+ *
+ * Never copy this way of doing things, or you too will be made fun of
+ * on the linux-kerenl list, you have been warned.
+ */
+}
+
/*
* register_cpu - Setup a sysfs device for a CPU.
* @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)
int error;
cpu->node_id = cpu_to_node(num);
+ memset(&cpu->dev, 0x00, sizeof(struct device));
cpu->dev.id = num;
cpu->dev.bus = &cpu_subsys;
+ cpu->dev.release = cpu_device_release;
error = device_register(&cpu->dev);
if (!error && cpu->hotpluggable)
register_cpu_control(cpu);