diff options
Diffstat (limited to 'drivers/base/cpu.c')
-rw-r--r-- | drivers/base/cpu.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 848ebbd25717..f48370dfc908 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -44,13 +44,11 @@ static int __ref cpu_subsys_online(struct device *dev) | |||
44 | struct cpu *cpu = container_of(dev, struct cpu, dev); | 44 | struct cpu *cpu = container_of(dev, struct cpu, dev); |
45 | int cpuid = dev->id; | 45 | int cpuid = dev->id; |
46 | int from_nid, to_nid; | 46 | int from_nid, to_nid; |
47 | int ret = -ENODEV; | 47 | int ret; |
48 | |||
49 | cpu_hotplug_driver_lock(); | ||
50 | 48 | ||
51 | from_nid = cpu_to_node(cpuid); | 49 | from_nid = cpu_to_node(cpuid); |
52 | if (from_nid == NUMA_NO_NODE) | 50 | if (from_nid == NUMA_NO_NODE) |
53 | goto out; | 51 | return -ENODEV; |
54 | 52 | ||
55 | ret = cpu_up(cpuid); | 53 | ret = cpu_up(cpuid); |
56 | /* | 54 | /* |
@@ -61,19 +59,12 @@ static int __ref cpu_subsys_online(struct device *dev) | |||
61 | if (from_nid != to_nid) | 59 | if (from_nid != to_nid) |
62 | change_cpu_under_node(cpu, from_nid, to_nid); | 60 | change_cpu_under_node(cpu, from_nid, to_nid); |
63 | 61 | ||
64 | out: | ||
65 | cpu_hotplug_driver_unlock(); | ||
66 | return ret; | 62 | return ret; |
67 | } | 63 | } |
68 | 64 | ||
69 | static int cpu_subsys_offline(struct device *dev) | 65 | static int cpu_subsys_offline(struct device *dev) |
70 | { | 66 | { |
71 | int ret; | 67 | return cpu_down(dev->id); |
72 | |||
73 | cpu_hotplug_driver_lock(); | ||
74 | ret = cpu_down(dev->id); | ||
75 | cpu_hotplug_driver_unlock(); | ||
76 | return ret; | ||
77 | } | 68 | } |
78 | 69 | ||
79 | void unregister_cpu(struct cpu *cpu) | 70 | void unregister_cpu(struct cpu *cpu) |
@@ -93,7 +84,17 @@ static ssize_t cpu_probe_store(struct device *dev, | |||
93 | const char *buf, | 84 | const char *buf, |
94 | size_t count) | 85 | size_t count) |
95 | { | 86 | { |
96 | return arch_cpu_probe(buf, count); | 87 | ssize_t cnt; |
88 | int ret; | ||
89 | |||
90 | ret = lock_device_hotplug_sysfs(); | ||
91 | if (ret) | ||
92 | return ret; | ||
93 | |||
94 | cnt = arch_cpu_probe(buf, count); | ||
95 | |||
96 | unlock_device_hotplug(); | ||
97 | return cnt; | ||
97 | } | 98 | } |
98 | 99 | ||
99 | static ssize_t cpu_release_store(struct device *dev, | 100 | static ssize_t cpu_release_store(struct device *dev, |
@@ -101,7 +102,17 @@ static ssize_t cpu_release_store(struct device *dev, | |||
101 | const char *buf, | 102 | const char *buf, |
102 | size_t count) | 103 | size_t count) |
103 | { | 104 | { |
104 | return arch_cpu_release(buf, count); | 105 | ssize_t cnt; |
106 | int ret; | ||
107 | |||
108 | ret = lock_device_hotplug_sysfs(); | ||
109 | if (ret) | ||
110 | return ret; | ||
111 | |||
112 | cnt = arch_cpu_release(buf, count); | ||
113 | |||
114 | unlock_device_hotplug(); | ||
115 | return cnt; | ||
105 | } | 116 | } |
106 | 117 | ||
107 | static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); | 118 | static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); |