Commit b0286db4 authored by Linus Torvalds's avatar Linus Torvalds

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: default avatarGreg 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
parents ae5cdd40 29bb5d4f
...@@ -208,6 +208,25 @@ static ssize_t print_cpus_offline(struct device *dev, ...@@ -208,6 +208,25 @@ static ssize_t print_cpus_offline(struct device *dev,
} }
static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL); 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. * register_cpu - Setup a sysfs device for a CPU.
* @cpu - cpu->hotpluggable field set to 1 will generate a control file in * @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,8 +240,10 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
int error; int error;
cpu->node_id = cpu_to_node(num); cpu->node_id = cpu_to_node(num);
memset(&cpu->dev, 0x00, sizeof(struct device));
cpu->dev.id = num; cpu->dev.id = num;
cpu->dev.bus = &cpu_subsys; cpu->dev.bus = &cpu_subsys;
cpu->dev.release = cpu_device_release;
error = device_register(&cpu->dev); error = device_register(&cpu->dev);
if (!error && cpu->hotpluggable) if (!error && cpu->hotpluggable)
register_cpu_control(cpu); register_cpu_control(cpu);
......
...@@ -572,19 +572,36 @@ static int init_memory_block(struct memory_block **memory, ...@@ -572,19 +572,36 @@ static int init_memory_block(struct memory_block **memory,
} }
static int add_memory_section(int nid, struct mem_section *section, static int add_memory_section(int nid, struct mem_section *section,
struct memory_block **mem_p,
unsigned long state, enum mem_add_context context) unsigned long state, enum mem_add_context context)
{ {
struct memory_block *mem; struct memory_block *mem = NULL;
int scn_nr = __section_nr(section);
int ret = 0; int ret = 0;
mutex_lock(&mem_sysfs_mutex); mutex_lock(&mem_sysfs_mutex);
mem = find_memory_block(section); if (context == BOOT) {
/* same memory block ? */
if (mem_p && *mem_p)
if (scn_nr >= (*mem_p)->start_section_nr &&
scn_nr <= (*mem_p)->end_section_nr) {
mem = *mem_p;
kobject_get(&mem->dev.kobj);
}
} else
mem = find_memory_block(section);
if (mem) { if (mem) {
mem->section_count++; mem->section_count++;
kobject_put(&mem->dev.kobj); kobject_put(&mem->dev.kobj);
} else } else {
ret = init_memory_block(&mem, section, state); ret = init_memory_block(&mem, section, state);
/* store memory_block pointer for next loop */
if (!ret && context == BOOT)
if (mem_p)
*mem_p = mem;
}
if (!ret) { if (!ret) {
if (context == HOTPLUG && if (context == HOTPLUG &&
...@@ -627,7 +644,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section, ...@@ -627,7 +644,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section,
*/ */
int register_new_memory(int nid, struct mem_section *section) int register_new_memory(int nid, struct mem_section *section)
{ {
return add_memory_section(nid, section, MEM_OFFLINE, HOTPLUG); return add_memory_section(nid, section, NULL, MEM_OFFLINE, HOTPLUG);
} }
int unregister_memory_section(struct mem_section *section) int unregister_memory_section(struct mem_section *section)
...@@ -647,6 +664,7 @@ int __init memory_dev_init(void) ...@@ -647,6 +664,7 @@ int __init memory_dev_init(void)
int ret; int ret;
int err; int err;
unsigned long block_sz; unsigned long block_sz;
struct memory_block *mem = NULL;
ret = subsys_system_register(&memory_subsys, NULL); ret = subsys_system_register(&memory_subsys, NULL);
if (ret) if (ret)
...@@ -662,7 +680,10 @@ int __init memory_dev_init(void) ...@@ -662,7 +680,10 @@ int __init memory_dev_init(void)
for (i = 0; i < NR_MEM_SECTIONS; i++) { for (i = 0; i < NR_MEM_SECTIONS; i++) {
if (!present_section_nr(i)) if (!present_section_nr(i))
continue; continue;
err = add_memory_section(0, __nr_to_section(i), MEM_ONLINE, /* don't need to reuse memory_block if only one per block */
err = add_memory_section(0, __nr_to_section(i),
(sections_per_block == 1) ? NULL : &mem,
MEM_ONLINE,
BOOT); BOOT);
if (!ret) if (!ret)
ret = err; ret = err;
......
...@@ -456,7 +456,15 @@ static int link_mem_sections(int nid) ...@@ -456,7 +456,15 @@ static int link_mem_sections(int nid)
if (!present_section_nr(section_nr)) if (!present_section_nr(section_nr))
continue; continue;
mem_sect = __nr_to_section(section_nr); mem_sect = __nr_to_section(section_nr);
/* same memblock ? */
if (mem_blk)
if ((section_nr >= mem_blk->start_section_nr) &&
(section_nr <= mem_blk->end_section_nr))
continue;
mem_blk = find_memory_block_hinted(mem_sect, mem_blk); mem_blk = find_memory_block_hinted(mem_sect, mem_blk);
ret = register_mem_sect_under_node(mem_blk, nid); ret = register_mem_sect_under_node(mem_blk, nid);
if (!err) if (!err)
err = ret; err = ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment