aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/cpu.c10
-rw-r--r--drivers/base/sys.c3
2 files changed, 6 insertions, 7 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 6fe41742997..e38dfed41d8 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -18,7 +18,7 @@ struct sysdev_class cpu_sysdev_class = {
18}; 18};
19EXPORT_SYMBOL(cpu_sysdev_class); 19EXPORT_SYMBOL(cpu_sysdev_class);
20 20
21static struct sys_device *cpu_sys_devices[NR_CPUS]; 21static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices);
22 22
23#ifdef CONFIG_HOTPLUG_CPU 23#ifdef CONFIG_HOTPLUG_CPU
24static ssize_t show_online(struct sys_device *dev, char *buf) 24static ssize_t show_online(struct sys_device *dev, char *buf)
@@ -68,7 +68,7 @@ void unregister_cpu(struct cpu *cpu)
68 sysdev_remove_file(&cpu->sysdev, &attr_online); 68 sysdev_remove_file(&cpu->sysdev, &attr_online);
69 69
70 sysdev_unregister(&cpu->sysdev); 70 sysdev_unregister(&cpu->sysdev);
71 cpu_sys_devices[logical_cpu] = NULL; 71 per_cpu(cpu_sys_devices, logical_cpu) = NULL;
72 return; 72 return;
73} 73}
74#else /* ... !CONFIG_HOTPLUG_CPU */ 74#else /* ... !CONFIG_HOTPLUG_CPU */
@@ -167,7 +167,7 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
167 if (!error && cpu->hotpluggable) 167 if (!error && cpu->hotpluggable)
168 register_cpu_control(cpu); 168 register_cpu_control(cpu);
169 if (!error) 169 if (!error)
170 cpu_sys_devices[num] = &cpu->sysdev; 170 per_cpu(cpu_sys_devices, num) = &cpu->sysdev;
171 if (!error) 171 if (!error)
172 register_cpu_under_node(num, cpu_to_node(num)); 172 register_cpu_under_node(num, cpu_to_node(num));
173 173
@@ -180,8 +180,8 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
180 180
181struct sys_device *get_cpu_sysdev(unsigned cpu) 181struct sys_device *get_cpu_sysdev(unsigned cpu)
182{ 182{
183 if (cpu < NR_CPUS) 183 if (cpu < nr_cpu_ids && cpu_possible(cpu))
184 return cpu_sys_devices[cpu]; 184 return per_cpu(cpu_sys_devices, cpu);
185 else 185 else
186 return NULL; 186 return NULL;
187} 187}
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 4fbb56bcb1e..358bb0be3c0 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -175,8 +175,7 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv)
175 } 175 }
176 176
177 /* Check whether this driver has already been added to a class. */ 177 /* Check whether this driver has already been added to a class. */
178 if ((drv->entry.next != drv->entry.prev) || 178 if (drv->entry.next && !list_empty(&drv->entry)) {
179 (drv->entry.next != NULL)) {
180 printk(KERN_WARNING "sysdev: class %s: driver (%p) has already" 179 printk(KERN_WARNING "sysdev: class %s: driver (%p) has already"
181 " been registered to a class, something is wrong, but " 180 " been registered to a class, something is wrong, but "
182 "will forge on!\n", cls->name, drv); 181 "will forge on!\n", cls->name, drv);