Commit 1b37d6ea2cdc61102f4643d8cd654ec15212b927

Authored by Liu Jinsong
Committed by Konrad Rzeszutek Wilk
1 parent 484400ffbf

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>

Showing 1 changed file with 12 additions and 22 deletions Side-by-side Diff

drivers/xen/xen-acpi-cpuhotplug.c
... ... @@ -239,24 +239,6 @@
239 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 242 static int acpi_processor_device_remove(struct acpi_device *device)
261 243 {
262 244 pr_debug(PREFIX "Xen does not support CPU hotremove\n");
... ... @@ -272,6 +254,8 @@
272 254 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
273 255 int result;
274 256  
  257 + acpi_scan_lock_acquire();
  258 +
275 259 switch (event) {
276 260 case ACPI_NOTIFY_BUS_CHECK:
277 261 case ACPI_NOTIFY_DEVICE_CHECK:
278 262  
... ... @@ -286,12 +270,16 @@
286 270 if (!acpi_bus_get_device(handle, &device))
287 271 break;
288 272  
289   - result = acpi_processor_device_add(handle, &device);
  273 + result = acpi_bus_scan(handle);
290 274 if (result) {
291 275 pr_err(PREFIX "Unable to add the device\n");
292 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 283 ost_code = ACPI_OST_SC_SUCCESS;
296 284 break;
297 285  
298 286  
... ... @@ -321,11 +309,13 @@
321 309 "Unsupported event [0x%x]\n", event));
322 310  
323 311 /* non-hotplug event; possibly handled by other handler */
324   - return;
  312 + goto out;
325 313 }
326 314  
327 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 321 static acpi_status is_processor_device(acpi_handle handle)