diff options
Diffstat (limited to 'drivers/base/cpu.c')
| -rw-r--r-- | drivers/base/cpu.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index e62a4ccea54d..27fd775375b0 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
| @@ -35,6 +35,7 @@ static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribut | |||
| 35 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 35 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
| 36 | ssize_t ret; | 36 | ssize_t ret; |
| 37 | 37 | ||
| 38 | cpu_hotplug_driver_lock(); | ||
| 38 | switch (buf[0]) { | 39 | switch (buf[0]) { |
| 39 | case '0': | 40 | case '0': |
| 40 | ret = cpu_down(cpu->sysdev.id); | 41 | ret = cpu_down(cpu->sysdev.id); |
| @@ -49,6 +50,7 @@ static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribut | |||
| 49 | default: | 50 | default: |
| 50 | ret = -EINVAL; | 51 | ret = -EINVAL; |
| 51 | } | 52 | } |
| 53 | cpu_hotplug_driver_unlock(); | ||
| 52 | 54 | ||
| 53 | if (ret >= 0) | 55 | if (ret >= 0) |
| 54 | ret = count; | 56 | ret = count; |
| @@ -72,6 +74,38 @@ void unregister_cpu(struct cpu *cpu) | |||
| 72 | per_cpu(cpu_sys_devices, logical_cpu) = NULL; | 74 | per_cpu(cpu_sys_devices, logical_cpu) = NULL; |
| 73 | return; | 75 | return; |
| 74 | } | 76 | } |
| 77 | |||
| 78 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE | ||
| 79 | static ssize_t cpu_probe_store(struct class *class, const char *buf, | ||
| 80 | size_t count) | ||
| 81 | { | ||
| 82 | return arch_cpu_probe(buf, count); | ||
| 83 | } | ||
| 84 | |||
| 85 | static ssize_t cpu_release_store(struct class *class, const char *buf, | ||
| 86 | size_t count) | ||
| 87 | { | ||
| 88 | return arch_cpu_release(buf, count); | ||
| 89 | } | ||
| 90 | |||
| 91 | static CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); | ||
| 92 | static CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store); | ||
| 93 | |||
| 94 | int __init cpu_probe_release_init(void) | ||
| 95 | { | ||
| 96 | int rc; | ||
| 97 | |||
| 98 | rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj, | ||
| 99 | &class_attr_probe.attr); | ||
| 100 | if (!rc) | ||
| 101 | rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj, | ||
| 102 | &class_attr_release.attr); | ||
| 103 | |||
| 104 | return rc; | ||
| 105 | } | ||
| 106 | device_initcall(cpu_probe_release_init); | ||
| 107 | #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ | ||
| 108 | |||
| 75 | #else /* ... !CONFIG_HOTPLUG_CPU */ | 109 | #else /* ... !CONFIG_HOTPLUG_CPU */ |
| 76 | static inline void register_cpu_control(struct cpu *cpu) | 110 | static inline void register_cpu_control(struct cpu *cpu) |
| 77 | { | 111 | { |
