From: Ashok Raj This file provides ability for caller of register_cpu() to either create a control file, or not. This can be handy if a particular platform decides that certain CPU's are not removable. Hence would like to not create a control file. Signed-off-by: Dave Hansen Signed-off-by: Ashok Raj Signed-off-by: Andrew Morton --- 25-akpm/arch/ppc64/kernel/sysfs.c | 10 ++++++++++ 25-akpm/drivers/base/cpu.c | 4 +++- 25-akpm/include/linux/cpu.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff -puN arch/ppc64/kernel/sysfs.c~dont-create-cpu-online-sysfs-file arch/ppc64/kernel/sysfs.c --- 25/arch/ppc64/kernel/sysfs.c~dont-create-cpu-online-sysfs-file Wed Jun 9 14:43:35 2004 +++ 25-akpm/arch/ppc64/kernel/sysfs.c Wed Jun 9 14:43:35 2004 @@ -325,6 +325,16 @@ static int __init topology_init(void) #ifdef CONFIG_NUMA parent = &node_devices[cpu_to_node(cpu)]; #endif + /* + * For now, we just see if the system supports making + * the RTAS calls for CPU hotplug. But, there may be a + * more comprehensive way to do this for an individual + * CPU. For instance, the boot cpu might never be valid + * for hotplugging. + */ + if (systemcfg->platform != PLATFORM_PSERIES_LPAR) + c->no_control = 1; + register_cpu(c, cpu, parent); register_cpu_pmc(&c->sysdev); diff -puN drivers/base/cpu.c~dont-create-cpu-online-sysfs-file drivers/base/cpu.c --- 25/drivers/base/cpu.c~dont-create-cpu-online-sysfs-file Wed Jun 9 14:43:35 2004 +++ 25-akpm/drivers/base/cpu.c Wed Jun 9 14:43:35 2004 @@ -58,6 +58,8 @@ static inline void register_cpu_control( /* * register_cpu - Setup a driverfs device for a CPU. + * @cpu - Callers can set the cpu->no_control field to 1, to indicate not to + * generate a control file in sysfs for this CPU. * @num - CPU number to use when creating the device. * * Initialize and register the CPU device. @@ -75,7 +77,7 @@ int __init register_cpu(struct cpu *cpu, error = sysfs_create_link(&root->sysdev.kobj, &cpu->sysdev.kobj, kobject_name(&cpu->sysdev.kobj)); - if (!error) + if (!error && !cpu->no_control) register_cpu_control(cpu); return error; } diff -puN include/linux/cpu.h~dont-create-cpu-online-sysfs-file include/linux/cpu.h --- 25/include/linux/cpu.h~dont-create-cpu-online-sysfs-file Wed Jun 9 14:43:35 2004 +++ 25-akpm/include/linux/cpu.h Wed Jun 9 14:43:35 2004 @@ -27,6 +27,7 @@ struct cpu { int node_id; /* The node which contains the CPU */ + int no_control; /* Should the sysfs control file be created? */ struct sys_device sysdev; }; _