summaryrefslogtreecommitdiff
path: root/drivers/acpi/acpi_memhotplug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpi_memhotplug.c')
-rw-r--r--drivers/acpi/acpi_memhotplug.c82
1 files changed, 34 insertions, 48 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index c7c8d537a063..b05469513842 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -85,12 +85,11 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
struct acpi_resource *resource = NULL;
struct acpi_resource_address64 address64;
- ACPI_FUNCTION_TRACE("acpi_memory_get_device_resources");
/* Get the range from the _CRS */
status = acpi_get_current_resources(mem_device->handle, &buffer);
if (ACPI_FAILURE(status))
- return_VALUE(-EINVAL);
+ return -EINVAL;
resource = (struct acpi_resource *)buffer.pointer;
status = acpi_resource_to_address64(resource, &address64);
@@ -106,7 +105,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
}
acpi_os_free(buffer.pointer);
- return_VALUE(0);
+ return 0;
}
static int
@@ -118,7 +117,6 @@ acpi_memory_get_device(acpi_handle handle,
struct acpi_device *device = NULL;
struct acpi_device *pdevice = NULL;
- ACPI_FUNCTION_TRACE("acpi_memory_get_device");
if (!acpi_bus_get_device(handle, &device) && device)
goto end;
@@ -126,14 +124,14 @@ acpi_memory_get_device(acpi_handle handle,
status = acpi_get_parent(handle, &phandle);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent"));
- return_VALUE(-EINVAL);
+ return -EINVAL;
}
/* Get the parent device */
status = acpi_bus_get_device(phandle, &pdevice);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device"));
- return_VALUE(-EINVAL);
+ return -EINVAL;
}
/*
@@ -143,29 +141,28 @@ acpi_memory_get_device(acpi_handle handle,
status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus"));
- return_VALUE(-EINVAL);
+ return -EINVAL;
}
end:
*mem_device = acpi_driver_data(device);
if (!(*mem_device)) {
printk(KERN_ERR "\n driver data not found");
- return_VALUE(-ENODEV);
+ return -ENODEV;
}
- return_VALUE(0);
+ return 0;
}
static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
{
unsigned long current_status;
- ACPI_FUNCTION_TRACE("acpi_memory_check_device");
/* Get device present/absent information from the _STA */
if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
NULL, &current_status)))
- return_VALUE(-ENODEV);
+ return -ENODEV;
/*
* Check for device status. Device should be
* present/enabled/functioning.
@@ -173,16 +170,15 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
if (!((current_status & ACPI_MEMORY_STA_PRESENT)
&& (current_status & ACPI_MEMORY_STA_ENABLED)
&& (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
- return_VALUE(-ENODEV);
+ return -ENODEV;
- return_VALUE(0);
+ return 0;
}
static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
{
int result;
- ACPI_FUNCTION_TRACE("acpi_memory_enable_device");
/* Get the range from the _CRS */
result = acpi_memory_get_device_resources(mem_device);
@@ -213,7 +209,6 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
union acpi_object arg;
unsigned long current_status;
- ACPI_FUNCTION_TRACE("acpi_memory_powerdown_device");
/* Issue the _EJ0 command */
arg_list.count = 1;
@@ -225,20 +220,20 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
/* Return on _EJ0 failure */
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed"));
- return_VALUE(-ENODEV);
+ return -ENODEV;
}
/* Evalute _STA to check if the device is disabled */
status = acpi_evaluate_integer(mem_device->handle, "_STA",
NULL, &current_status);
if (ACPI_FAILURE(status))
- return_VALUE(-ENODEV);
+ return -ENODEV;
/* Check for device status. Device should be disabled */
if (current_status & ACPI_MEMORY_STA_ENABLED)
- return_VALUE(-EINVAL);
+ return -EINVAL;
- return_VALUE(0);
+ return 0;
}
static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
@@ -247,7 +242,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
u64 start = mem_device->start_addr;
u64 len = mem_device->length;
- ACPI_FUNCTION_TRACE("acpi_memory_disable_device");
/*
* Ask the VM to offline this memory range.
@@ -255,7 +249,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
*/
result = remove_memory(start, len);
if (result)
- return_VALUE(result);
+ return result;
/* Power-off and eject the device */
result = acpi_memory_powerdown_device(mem_device);
@@ -274,7 +268,6 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
struct acpi_memory_device *mem_device;
struct acpi_device *device;
- ACPI_FUNCTION_TRACE("acpi_memory_device_notify");
switch (event) {
case ACPI_NOTIFY_BUS_CHECK:
@@ -287,7 +280,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
"\nReceived DEVICE CHECK notification for device\n"));
if (acpi_memory_get_device(handle, &mem_device)) {
printk(KERN_ERR PREFIX "Cannot find driver data\n");
- return_VOID;
+ return;
}
if (!acpi_memory_check_device(mem_device)) {
@@ -329,7 +322,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
break;
}
- return_VOID;
+ return;
}
static int acpi_memory_device_add(struct acpi_device *device)
@@ -337,14 +330,13 @@ static int acpi_memory_device_add(struct acpi_device *device)
int result;
struct acpi_memory_device *mem_device = NULL;
- ACPI_FUNCTION_TRACE("acpi_memory_device_add");
if (!device)
- return_VALUE(-EINVAL);
+ return -EINVAL;
mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
if (!mem_device)
- return_VALUE(-ENOMEM);
+ return -ENOMEM;
memset(mem_device, 0, sizeof(struct acpi_memory_device));
mem_device->handle = device->handle;
@@ -356,7 +348,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
result = acpi_memory_get_device_resources(mem_device);
if (result) {
kfree(mem_device);
- return_VALUE(result);
+ return result;
}
/* Set the device state */
@@ -364,22 +356,21 @@ static int acpi_memory_device_add(struct acpi_device *device)
printk(KERN_INFO "%s \n", acpi_device_name(device));
- return_VALUE(result);
+ return result;
}
static int acpi_memory_device_remove(struct acpi_device *device, int type)
{
struct acpi_memory_device *mem_device = NULL;
- ACPI_FUNCTION_TRACE("acpi_memory_device_remove");
if (!device || !acpi_driver_data(device))
- return_VALUE(-EINVAL);
+ return -EINVAL;
mem_device = (struct acpi_memory_device *)acpi_driver_data(device);
kfree(mem_device);
- return_VALUE(0);
+ return 0;
}
/*
@@ -392,16 +383,15 @@ static acpi_status is_memory_device(acpi_handle handle)
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_device_info *info;
- ACPI_FUNCTION_TRACE("is_memory_device");
status = acpi_get_object_info(handle, &buffer);
if (ACPI_FAILURE(status))
- return_ACPI_STATUS(status);
+ return status;
info = buffer.pointer;
if (!(info->valid & ACPI_VALID_HID)) {
acpi_os_free(buffer.pointer);
- return_ACPI_STATUS(AE_ERROR);
+ return AE_ERROR;
}
hardware_id = info->hardware_id.value;
@@ -410,7 +400,7 @@ static acpi_status is_memory_device(acpi_handle handle)
status = AE_ERROR;
acpi_os_free(buffer.pointer);
- return_ACPI_STATUS(status);
+ return status;
}
static acpi_status
@@ -419,18 +409,17 @@ acpi_memory_register_notify_handler(acpi_handle handle,
{
acpi_status status;
- ACPI_FUNCTION_TRACE("acpi_memory_register_notify_handler");
status = is_memory_device(handle);
if (ACPI_FAILURE(status)){
ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device"));
- return_ACPI_STATUS(AE_OK); /* continue */
+ return AE_OK; /* continue */
}
status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
acpi_memory_device_notify, NULL);
/* continue */
- return_ACPI_STATUS(AE_OK);
+ return AE_OK;
}
static acpi_status
@@ -439,19 +428,18 @@ acpi_memory_deregister_notify_handler(acpi_handle handle,
{
acpi_status status;
- ACPI_FUNCTION_TRACE("acpi_memory_deregister_notify_handler");
status = is_memory_device(handle);
if (ACPI_FAILURE(status)){
ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device"));
- return_ACPI_STATUS(AE_OK); /* continue */
+ return AE_OK; /* continue */
}
status = acpi_remove_notify_handler(handle,
ACPI_SYSTEM_NOTIFY,
acpi_memory_device_notify);
- return_ACPI_STATUS(AE_OK); /* continue */
+ return AE_OK; /* continue */
}
static int __init acpi_memory_device_init(void)
@@ -459,12 +447,11 @@ static int __init acpi_memory_device_init(void)
int result;
acpi_status status;
- ACPI_FUNCTION_TRACE("acpi_memory_device_init");
result = acpi_bus_register_driver(&acpi_memory_device_driver);
if (result < 0)
- return_VALUE(-ENODEV);
+ return -ENODEV;
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
@@ -474,17 +461,16 @@ static int __init acpi_memory_device_init(void)
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed"));
acpi_bus_unregister_driver(&acpi_memory_device_driver);
- return_VALUE(-ENODEV);
+ return -ENODEV;
}
- return_VALUE(0);
+ return 0;
}
static void __exit acpi_memory_device_exit(void)
{
acpi_status status;
- ACPI_FUNCTION_TRACE("acpi_memory_device_exit");
/*
* Adding this to un-install notification handlers for all the device
@@ -500,7 +486,7 @@ static void __exit acpi_memory_device_exit(void)
acpi_bus_unregister_driver(&acpi_memory_device_driver);
- return_VOID;
+ return;
}
module_init(acpi_memory_device_init);