diff options
author | Liu Jinsong <jinsong.liu@intel.com> | 2013-02-16 22:47:24 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-02-25 07:44:29 -0500 |
commit | 1b37d6ea2cdc61102f4643d8cd654ec15212b927 (patch) | |
tree | 8ba98292a756d790c33b54aa28c95d2a9f0ac097 | |
parent | 484400ffbf2dd33446d71c05b9cddf91932a882e (diff) |
xen/acpi: xen cpu hotplug minor updates
Recently at native Rafael did some cleanup for acpi, say, drop
acpi_bus_add, remove unnecessary argument of acpi_bus_scan,
and run acpi_bus_scan under acpi_scan_lock.
This patch does similar cleanup for xen cpu hotplug, removing
redundant logic, and adding lock.
Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | drivers/xen/xen-acpi-cpuhotplug.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/drivers/xen/xen-acpi-cpuhotplug.c b/drivers/xen/xen-acpi-cpuhotplug.c index 757827966e34..18c742bec91b 100644 --- a/drivers/xen/xen-acpi-cpuhotplug.c +++ b/drivers/xen/xen-acpi-cpuhotplug.c | |||
@@ -239,24 +239,6 @@ static acpi_status xen_acpi_cpu_hotadd(struct acpi_processor *pr) | |||
239 | return AE_OK; | 239 | return AE_OK; |
240 | } | 240 | } |
241 | 241 | ||
242 | static | ||
243 | int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) | ||
244 | { | ||
245 | acpi_handle phandle; | ||
246 | struct acpi_device *pdev; | ||
247 | |||
248 | if (acpi_get_parent(handle, &phandle)) | ||
249 | return -ENODEV; | ||
250 | |||
251 | if (acpi_bus_get_device(phandle, &pdev)) | ||
252 | return -ENODEV; | ||
253 | |||
254 | if (acpi_bus_scan(handle)) | ||
255 | return -ENODEV; | ||
256 | |||
257 | return 0; | ||
258 | } | ||
259 | |||
260 | static int acpi_processor_device_remove(struct acpi_device *device) | 242 | static int acpi_processor_device_remove(struct acpi_device *device) |
261 | { | 243 | { |
262 | pr_debug(PREFIX "Xen does not support CPU hotremove\n"); | 244 | pr_debug(PREFIX "Xen does not support CPU hotremove\n"); |
@@ -272,6 +254,8 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
272 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ | 254 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ |
273 | int result; | 255 | int result; |
274 | 256 | ||
257 | acpi_scan_lock_acquire(); | ||
258 | |||
275 | switch (event) { | 259 | switch (event) { |
276 | case ACPI_NOTIFY_BUS_CHECK: | 260 | case ACPI_NOTIFY_BUS_CHECK: |
277 | case ACPI_NOTIFY_DEVICE_CHECK: | 261 | case ACPI_NOTIFY_DEVICE_CHECK: |
@@ -286,12 +270,16 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
286 | if (!acpi_bus_get_device(handle, &device)) | 270 | if (!acpi_bus_get_device(handle, &device)) |
287 | break; | 271 | break; |
288 | 272 | ||
289 | result = acpi_processor_device_add(handle, &device); | 273 | result = acpi_bus_scan(handle); |
290 | if (result) { | 274 | if (result) { |
291 | pr_err(PREFIX "Unable to add the device\n"); | 275 | pr_err(PREFIX "Unable to add the device\n"); |
292 | break; | 276 | break; |
293 | } | 277 | } |
294 | 278 | result = acpi_bus_get_device(handle, &device); | |
279 | if (result) { | ||
280 | pr_err(PREFIX "Missing device object\n"); | ||
281 | break; | ||
282 | } | ||
295 | ost_code = ACPI_OST_SC_SUCCESS; | 283 | ost_code = ACPI_OST_SC_SUCCESS; |
296 | break; | 284 | break; |
297 | 285 | ||
@@ -321,11 +309,13 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
321 | "Unsupported event [0x%x]\n", event)); | 309 | "Unsupported event [0x%x]\n", event)); |
322 | 310 | ||
323 | /* non-hotplug event; possibly handled by other handler */ | 311 | /* non-hotplug event; possibly handled by other handler */ |
324 | return; | 312 | goto out; |
325 | } | 313 | } |
326 | 314 | ||
327 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); | 315 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); |
328 | return; | 316 | |
317 | out: | ||
318 | acpi_scan_lock_release(); | ||
329 | } | 319 | } |
330 | 320 | ||
331 | static acpi_status is_processor_device(acpi_handle handle) | 321 | static acpi_status is_processor_device(acpi_handle handle) |