[PATCH 2/2] xen/acpi: xen cpu hotplug minor updates

From: Liu Jinsong
Date: Sat Feb 16 2013 - 22:47:24 EST


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@xxxxxxxxx>
---
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-cpuho=
tplug.c
index 7578279..18c742b 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_pro=
cessor *pr)
return AE_OK;
}
=20
-static
-int acpi_processor_device_add(acpi_handle handle, struct acpi_device **dev=
ice)
-{
- acpi_handle phandle;
- struct acpi_device *pdev;
-
- if (acpi_get_parent(handle, &phandle))
- return -ENODEV;
-
- if (acpi_bus_get_device(phandle, &pdev))
- return -ENODEV;
-
- if (acpi_bus_scan(handle))
- return -ENODEV;
-
- return 0;
-}
-
static int acpi_processor_device_remove(struct acpi_device *device)
{
pr_debug(PREFIX "Xen does not support CPU hotremove\n");
@@ -272,6 +254,8 @@ static void acpi_processor_hotplug_notify(acpi_handle h=
andle,
u32 ost_code =3D ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
int result;
=20
+ acpi_scan_lock_acquire();
+
switch (event) {
case ACPI_NOTIFY_BUS_CHECK:
case ACPI_NOTIFY_DEVICE_CHECK:
@@ -286,12 +270,16 @@ static void acpi_processor_hotplug_notify(acpi_handle=
handle,
if (!acpi_bus_get_device(handle, &device))
break;
=20
- result =3D acpi_processor_device_add(handle, &device);
+ result =3D acpi_bus_scan(handle);
if (result) {
pr_err(PREFIX "Unable to add the device\n");
break;
}
-
+ result =3D acpi_bus_get_device(handle, &device);
+ if (result) {
+ pr_err(PREFIX "Missing device object\n");
+ break;
+ }
ost_code =3D ACPI_OST_SC_SUCCESS;
break;
=20
@@ -321,11 +309,13 @@ static void acpi_processor_hotplug_notify(acpi_handle=
handle,
"Unsupported event [0x%x]\n", event));
=20
/* non-hotplug event; possibly handled by other handler */
- return;
+ goto out;
}
=20
(void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL);
- return;
+
+out:
+ acpi_scan_lock_release();
}
=20
static acpi_status is_processor_device(acpi_handle handle)
--=20
1.7.1

--_002_DE8DF0795D48FD4CA783C40EC82923353FCCD5SHSMSX101ccrcorpi_
Content-Type: application/octet-stream;
name="0002-xen-acpi-xen-cpu-hotplug-minor-updates.patch"
Content-Description: 0002-xen-acpi-xen-cpu-hotplug-minor-updates.patch
Content-Disposition: attachment;
filename="0002-xen-acpi-xen-cpu-hotplug-minor-updates.patch"; size=2614;
creation-date="Sun, 17 Feb 2013 07:24:14 GMT";
modification-date="Sun, 17 Feb 2013 15:14:24 GMT"
Content-Transfer-Encoding: base64

RnJvbSAxOTVkZjJiZjYxNzQ5NTliYWEwMjVjY2IyNDkwNDFiYjUzZDYwNjBhIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBMaXUgSmluc29uZyA8amluc29uZy5saXVAaW50ZWwuY29tPgpE
YXRlOiBTdW4sIDE3IEZlYiAyMDEzIDExOjQ3OjI0ICswODAwClN1YmplY3Q6IFtQQVRDSCAyLzJd
IHhlbi9hY3BpOiB4ZW4gY3B1IGhvdHBsdWcgbWlub3IgdXBkYXRlcwoKUmVjZW50bHkgYXQgbmF0
aXZlIFJhZmFlbCBkaWQgc29tZSBjbGVhbnVwIGZvciBhY3BpLCBzYXksIGRyb3AKYWNwaV9idXNf
YWRkLCByZW1vdmUgdW5uZWNlc3NhcnkgYXJndW1lbnQgb2YgYWNwaV9idXNfc2NhbiwKYW5kIHJ1
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9IGFjcGlfYnVzX3NjYW4oaGFuZGxl
KTsKIAkJaWYgKHJlc3VsdCkgewogCQkJcHJfZXJyKFBSRUZJWCAiVW5hYmxlIHRvIGFkZCB0aGUg
ZGV2aWNlXG4iKTsKIAkJCWJyZWFrOwogCQl9Ci0KKwkJcmVzdWx0ID0gYWNwaV9idXNfZ2V0X2Rl
dmljZShoYW5kbGUsICZkZXZpY2UpOworCQlpZiAocmVzdWx0KSB7CisJCQlwcl9lcnIoUFJFRklY
ICJNaXNzaW5nIGRldmljZSBvYmplY3RcbiIpOworCQkJYnJlYWs7CisJCX0KIAkJb3N0X2NvZGUg
PSBBQ1BJX09TVF9TQ19TVUNDRVNTOwogCQlicmVhazsKIApAQCAtMzIxLDExICszMDksMTMgQEAg
c3RhdGljIHZvaWQgYWNwaV9wcm9jZXNzb3JfaG90cGx1Z19ub3RpZnkoYWNwaV9oYW5kbGUgaGFu
ZGxlLAogCQkJCSAgIlVuc3VwcG9ydGVkIGV2ZW50IFsweCV4XVxuIiwgZXZlbnQpKTsKIAogCQkv
KiBub24taG90cGx1ZyBldmVudDsgcG9zc2libHkgaGFuZGxlZCBieSBvdGhlciBoYW5kbGVyICov
Ci0JCXJldHVybjsKKwkJZ290byBvdXQ7CiAJfQogCiAJKHZvaWQpIGFjcGlfZXZhbHVhdGVfaG90
cGx1Z19vc3QoaGFuZGxlLCBldmVudCwgb3N0X2NvZGUsIE5VTEwpOwotCXJldHVybjsKKworb3V0
OgorCWFjcGlfc2Nhbl9sb2NrX3JlbGVhc2UoKTsKIH0KIAogc3RhdGljIGFjcGlfc3RhdHVzIGlz
X3Byb2Nlc3Nvcl9kZXZpY2UoYWNwaV9oYW5kbGUgaGFuZGxlKQotLSAKMS43LjEKCg==

--_002_DE8DF0795D48FD4CA783C40EC82923353FCCD5SHSMSX101ccrcorpi_--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/