Skip to contentSkip to conversation

fix for register_cpu()

PATCH New Jesse Barnes 1 participant 1 message Oct 17, 2003 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix for register_cpu()

register_cpu() needs to honor the root argument that gets passed in if it's valid.

Jesse

drivers/base/cpu.c +9 -1
diff -Nru a/drivers/base/cpu.c b/drivers/base/cpu.c
@@ -23,10 +23,18 @@
  */
 int __init register_cpu(struct cpu *cpu, int num, struct node *root)
 {
+	int error;
+
 	cpu->node_id = cpu_to_node(num);
 	cpu->sysdev.id = num;
 	cpu->sysdev.cls = &cpu_sysdev_class;
-	return sys_device_register(&cpu->sysdev);
+
+	error = sys_device_register(&cpu->sysdev);
+	if (!error && root) 
+		error = sysfs_create_link(&root->sysdev.kobj,
+					  &cpu->sysdev.kobj,
+					  kobject_name(&cpu->sysdev.kobj));
+	return error;
 }