Skip to content

Commit

Permalink
cpu: change cpu_sys_devices from array to per_cpu variable
Browse files Browse the repository at this point in the history
Change cpu_sys_devices from array to per_cpu variable in drivers/base/cpu.c.

Signed-off-by: Mike Travis <[email protected]>
Cc: Ashok Raj <[email protected]>
Cc: Vivek Goyal <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Suresh Siddha <[email protected]>
Cc: Kay Sievers <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Mike Travis authored and torvalds committed May 1, 2008
1 parent bd73096 commit e37d05d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/base/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct sysdev_class cpu_sysdev_class = {
};
EXPORT_SYMBOL(cpu_sysdev_class);

static struct sys_device *cpu_sys_devices[NR_CPUS];
static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices);

#ifdef CONFIG_HOTPLUG_CPU
static ssize_t show_online(struct sys_device *dev, char *buf)
Expand Down Expand Up @@ -68,7 +68,7 @@ void unregister_cpu(struct cpu *cpu)
sysdev_remove_file(&cpu->sysdev, &attr_online);

sysdev_unregister(&cpu->sysdev);
cpu_sys_devices[logical_cpu] = NULL;
per_cpu(cpu_sys_devices, logical_cpu) = NULL;
return;
}
#else /* ... !CONFIG_HOTPLUG_CPU */
Expand Down Expand Up @@ -167,7 +167,7 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
if (!error && cpu->hotpluggable)
register_cpu_control(cpu);
if (!error)
cpu_sys_devices[num] = &cpu->sysdev;
per_cpu(cpu_sys_devices, num) = &cpu->sysdev;
if (!error)
register_cpu_under_node(num, cpu_to_node(num));

Expand All @@ -180,8 +180,8 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)

struct sys_device *get_cpu_sysdev(unsigned cpu)
{
if (cpu < NR_CPUS)
return cpu_sys_devices[cpu];
if (cpu < nr_cpu_ids && cpu_possible(cpu))
return per_cpu(cpu_sys_devices, cpu);
else
return NULL;
}
Expand Down

0 comments on commit e37d05d

Please sign in to comment.