diff options
Diffstat (limited to 'arch/powerpc/kernel/sysfs.c')
-rw-r--r-- | arch/powerpc/kernel/sysfs.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index 5bc2585c8036..4662b580efa1 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
@@ -279,7 +279,7 @@ static void unregister_cpu_online(unsigned int cpu) | |||
279 | } | 279 | } |
280 | #endif /* CONFIG_HOTPLUG_CPU */ | 280 | #endif /* CONFIG_HOTPLUG_CPU */ |
281 | 281 | ||
282 | static int sysfs_cpu_notify(struct notifier_block *self, | 282 | static int __devinit sysfs_cpu_notify(struct notifier_block *self, |
283 | unsigned long action, void *hcpu) | 283 | unsigned long action, void *hcpu) |
284 | { | 284 | { |
285 | unsigned int cpu = (unsigned int)(long)hcpu; | 285 | unsigned int cpu = (unsigned int)(long)hcpu; |
@@ -297,30 +297,19 @@ static int sysfs_cpu_notify(struct notifier_block *self, | |||
297 | return NOTIFY_OK; | 297 | return NOTIFY_OK; |
298 | } | 298 | } |
299 | 299 | ||
300 | static struct notifier_block sysfs_cpu_nb = { | 300 | static struct notifier_block __devinitdata sysfs_cpu_nb = { |
301 | .notifier_call = sysfs_cpu_notify, | 301 | .notifier_call = sysfs_cpu_notify, |
302 | }; | 302 | }; |
303 | 303 | ||
304 | /* NUMA stuff */ | 304 | /* NUMA stuff */ |
305 | 305 | ||
306 | #ifdef CONFIG_NUMA | 306 | #ifdef CONFIG_NUMA |
307 | static struct node node_devices[MAX_NUMNODES]; | ||
308 | |||
309 | static void register_nodes(void) | 307 | static void register_nodes(void) |
310 | { | 308 | { |
311 | int i; | 309 | int i; |
312 | 310 | ||
313 | for (i = 0; i < MAX_NUMNODES; i++) { | 311 | for (i = 0; i < MAX_NUMNODES; i++) |
314 | if (node_online(i)) { | 312 | register_one_node(i); |
315 | int p_node = parent_node(i); | ||
316 | struct node *parent = NULL; | ||
317 | |||
318 | if (p_node != i) | ||
319 | parent = &node_devices[p_node]; | ||
320 | |||
321 | register_node(&node_devices[i], i, parent); | ||
322 | } | ||
323 | } | ||
324 | } | 313 | } |
325 | 314 | ||
326 | int sysfs_add_device_to_node(struct sys_device *dev, int nid) | 315 | int sysfs_add_device_to_node(struct sys_device *dev, int nid) |
@@ -359,23 +348,13 @@ static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL); | |||
359 | static int __init topology_init(void) | 348 | static int __init topology_init(void) |
360 | { | 349 | { |
361 | int cpu; | 350 | int cpu; |
362 | struct node *parent = NULL; | ||
363 | 351 | ||
364 | register_nodes(); | 352 | register_nodes(); |
365 | |||
366 | register_cpu_notifier(&sysfs_cpu_nb); | 353 | register_cpu_notifier(&sysfs_cpu_nb); |
367 | 354 | ||
368 | for_each_possible_cpu(cpu) { | 355 | for_each_possible_cpu(cpu) { |
369 | struct cpu *c = &per_cpu(cpu_devices, cpu); | 356 | struct cpu *c = &per_cpu(cpu_devices, cpu); |
370 | 357 | ||
371 | #ifdef CONFIG_NUMA | ||
372 | /* The node to which a cpu belongs can't be known | ||
373 | * until the cpu is made present. | ||
374 | */ | ||
375 | parent = NULL; | ||
376 | if (cpu_present(cpu)) | ||
377 | parent = &node_devices[cpu_to_node(cpu)]; | ||
378 | #endif | ||
379 | /* | 358 | /* |
380 | * For now, we just see if the system supports making | 359 | * For now, we just see if the system supports making |
381 | * the RTAS calls for CPU hotplug. But, there may be a | 360 | * the RTAS calls for CPU hotplug. But, there may be a |
@@ -387,7 +366,7 @@ static int __init topology_init(void) | |||
387 | c->no_control = 1; | 366 | c->no_control = 1; |
388 | 367 | ||
389 | if (cpu_online(cpu) || (c->no_control == 0)) { | 368 | if (cpu_online(cpu) || (c->no_control == 0)) { |
390 | register_cpu(c, cpu, parent); | 369 | register_cpu(c, cpu); |
391 | 370 | ||
392 | sysdev_create_file(&c->sysdev, &attr_physical_id); | 371 | sysdev_create_file(&c->sysdev, &attr_physical_id); |
393 | } | 372 | } |