Commit 01007b4e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc64: Move sysfs specific stuff into sysfs.c

From: Anton Blanchard <anton@samba.org>

Move sysfs specific stuff into sysfs.c
parent 0e75cd78
......@@ -11,7 +11,7 @@ obj-y := setup.o entry.o traps.o irq.o idle.o dma.o \
udbg.o binfmt_elf32.o sys_ppc32.o ioctl32.o \
ptrace32.o signal32.o rtc.o init_task.o \
lmb.o cputable.o cpu_setup_power4.o idle_power4.o \
iommu.o
iommu.o sysfs.o
obj-$(CONFIG_PPC_OF) += of_device.o
......
......@@ -996,71 +996,3 @@ void __init smp_cpus_done(unsigned int max_cpus)
set_cpus_allowed(current, old_mask);
}
#ifdef CONFIG_NUMA
static struct node node_devices[MAX_NUMNODES];
static void register_nodes(void)
{
int i;
int ret;
for (i = 0; i < MAX_NUMNODES; i++) {
if (node_online(i)) {
int p_node = parent_node(i);
struct node *parent = NULL;
if (p_node != i)
parent = &node_devices[p_node];
ret = register_node(&node_devices[i], i, parent);
if (ret)
printk(KERN_WARNING "register_nodes: "
"register_node %d failed (%d)", i, ret);
}
}
}
#else
static void register_nodes(void)
{
return;
}
#endif
/* Only valid if CPU is online. */
static ssize_t show_physical_id(struct sys_device *dev, char *buf)
{
struct cpu *cpu = container_of(dev, struct cpu, sysdev);
return sprintf(buf, "%u\n", get_hard_smp_processor_id(cpu->sysdev.id));
}
static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL);
static DEFINE_PER_CPU(struct cpu, cpu_devices);
static int __init topology_init(void)
{
int cpu;
struct node *parent = NULL;
int ret;
register_nodes();
for_each_cpu(cpu) {
#ifdef CONFIG_NUMA
parent = &node_devices[cpu_to_node(cpu)];
#endif
ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, parent);
if (ret)
printk(KERN_WARNING "topology_init: register_cpu %d "
"failed (%d)\n", cpu, ret);
ret = sysdev_create_file(&per_cpu(cpu_devices, cpu).sysdev,
&attr_physical_id);
if (ret)
printk(KERN_WARNING "toplogy_init: sysdev_create_file "
"%d failed (%d)\n", cpu, ret);
}
return 0;
}
__initcall(topology_init);
#include <linux/config.h>
#include <linux/sysdev.h>
#include <linux/cpu.h>
#include <linux/smp.h>
#include <linux/percpu.h>
#include <linux/init.h>
#include <asm/processor.h>
#ifdef CONFIG_NUMA
static struct node node_devices[MAX_NUMNODES];
static void register_nodes(void)
{
int i;
for (i = 0; i < MAX_NUMNODES; i++) {
if (node_online(i)) {
int p_node = parent_node(i);
struct node *parent = NULL;
if (p_node != i)
parent = &node_devices[p_node];
register_node(&node_devices[i], i, parent);
}
}
}
#else
static void register_nodes(void)
{
return;
}
#endif
/* Only valid if CPU is online. */
static ssize_t show_physical_id(struct sys_device *dev, char *buf)
{
struct cpu *cpu = container_of(dev, struct cpu, sysdev);
return sprintf(buf, "%u\n", get_hard_smp_processor_id(cpu->sysdev.id));
}
static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL);
static DEFINE_PER_CPU(struct cpu, cpu_devices);
static int __init topology_init(void)
{
int cpu;
struct node *parent = NULL;
register_nodes();
for_each_cpu(cpu) {
struct cpu *c = &per_cpu(cpu_devices, cpu);
#ifdef CONFIG_NUMA
parent = &node_devices[cpu_to_node(cpu)];
#endif
register_cpu(c, cpu, parent);
sysdev_create_file(&c->sysdev, &attr_physical_id);
}
return 0;
}
__initcall(topology_init);
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