Skip to content

Commit 1b37d6e

Browse files
Liu Jinsongkonradwilk
Liu Jinsong
authored andcommitted
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 <[email protected]> Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
1 parent 484400f commit 1b37d6e

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

drivers/xen/xen-acpi-cpuhotplug.c

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -239,24 +239,6 @@ static acpi_status xen_acpi_cpu_hotadd(struct acpi_processor *pr)
239239
return AE_OK;
240240
}
241241

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-
260242
static int acpi_processor_device_remove(struct acpi_device *device)
261243
{
262244
pr_debug(PREFIX "Xen does not support CPU hotremove\n");
@@ -272,6 +254,8 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
272254
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
273255
int result;
274256

257+
acpi_scan_lock_acquire();
258+
275259
switch (event) {
276260
case ACPI_NOTIFY_BUS_CHECK:
277261
case ACPI_NOTIFY_DEVICE_CHECK:
@@ -286,12 +270,16 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
286270
if (!acpi_bus_get_device(handle, &device))
287271
break;
288272

289-
result = acpi_processor_device_add(handle, &device);
273+
result = acpi_bus_scan(handle);
290274
if (result) {
291275
pr_err(PREFIX "Unable to add the device\n");
292276
break;
293277
}
294-
278+
result = acpi_bus_get_device(handle, &device);
279+
if (result) {
280+
pr_err(PREFIX "Missing device object\n");
281+
break;
282+
}
295283
ost_code = ACPI_OST_SC_SUCCESS;
296284
break;
297285

@@ -321,11 +309,13 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
321309
"Unsupported event [0x%x]\n", event));
322310

323311
/* non-hotplug event; possibly handled by other handler */
324-
return;
312+
goto out;
325313
}
326314

327315
(void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL);
328-
return;
316+
317+
out:
318+
acpi_scan_lock_release();
329319
}
330320

331321
static acpi_status is_processor_device(acpi_handle handle)

0 commit comments

Comments
 (0)