Commit d550d98d authored by Patrick Mochel's avatar Patrick Mochel Committed by Len Brown

ACPI: delete tracing macros from drivers/acpi/*.c

Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent d7fa2589
......@@ -84,19 +84,18 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_ac_get_state");
if (!ac)
return_VALUE(-EINVAL);
return -EINVAL;
status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state"));
ac->state = ACPI_AC_STATUS_UNKNOWN;
return_VALUE(-ENODEV);
return -ENODEV;
}
return_VALUE(0);
return 0;
}
/* --------------------------------------------------------------------------
......@@ -109,14 +108,13 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_ac *ac = (struct acpi_ac *)seq->private;
ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
if (!ac)
return_VALUE(0);
return 0;
if (acpi_ac_get_state(ac)) {
seq_puts(seq, "ERROR: Unable to read AC Adapter state\n");
return_VALUE(0);
return 0;
}
seq_puts(seq, "state: ");
......@@ -132,7 +130,7 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
break;
}
return_VALUE(0);
return 0;
}
static int acpi_ac_open_fs(struct inode *inode, struct file *file)
......@@ -144,13 +142,12 @@ static int acpi_ac_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_ac_dir);
if (!acpi_device_dir(device))
return_VALUE(-ENODEV);
return -ENODEV;
acpi_device_dir(device)->owner = THIS_MODULE;
}
......@@ -158,19 +155,18 @@ static int acpi_ac_add_fs(struct acpi_device *device)
entry = create_proc_entry(ACPI_AC_FILE_STATE,
S_IRUGO, acpi_device_dir(device));
if (!entry)
return_VALUE(-ENODEV);
return -ENODEV;
else {
entry->proc_fops = &acpi_ac_fops;
entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
}
return_VALUE(0);
return 0;
}
static int acpi_ac_remove_fs(struct acpi_device *device)
{
ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device));
......@@ -179,7 +175,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL;
}
return_VALUE(0);
return 0;
}
/* --------------------------------------------------------------------------
......@@ -191,13 +187,12 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
struct acpi_ac *ac = (struct acpi_ac *)data;
struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_notify");
if (!ac)
return_VOID;
return;
if (acpi_bus_get_device(ac->handle, &device))
return_VOID;
return;
switch (event) {
case ACPI_AC_NOTIFY_STATUS:
......@@ -210,7 +205,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
break;
}
return_VOID;
return;
}
static int acpi_ac_add(struct acpi_device *device)
......@@ -219,14 +214,13 @@ static int acpi_ac_add(struct acpi_device *device)
acpi_status status = AE_OK;
struct acpi_ac *ac = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_add");
if (!device)
return_VALUE(-EINVAL);
return -EINVAL;
ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL);
if (!ac)
return_VALUE(-ENOMEM);
return -ENOMEM;
memset(ac, 0, sizeof(struct acpi_ac));
ac->handle = device->handle;
......@@ -260,7 +254,7 @@ static int acpi_ac_add(struct acpi_device *device)
kfree(ac);
}
return_VALUE(result);
return result;
}
static int acpi_ac_remove(struct acpi_device *device, int type)
......@@ -268,10 +262,9 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
acpi_status status = AE_OK;
struct acpi_ac *ac = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_remove");
if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL);
return -EINVAL;
ac = (struct acpi_ac *)acpi_driver_data(device);
......@@ -282,38 +275,36 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
kfree(ac);
return_VALUE(0);
return 0;
}
static int __init acpi_ac_init(void)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_ac_init");
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
if (!acpi_ac_dir)
return_VALUE(-ENODEV);
return -ENODEV;
acpi_ac_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0) {
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
return -ENODEV;
}
return_VALUE(0);
return 0;
}
static void __exit acpi_ac_exit(void)
{
ACPI_FUNCTION_TRACE("acpi_ac_exit");
acpi_bus_unregister_driver(&acpi_ac_driver);
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
return_VOID;
return;
}
module_init(acpi_ac_init);
......
......@@ -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);
......
......@@ -132,17 +132,16 @@ acpi_battery_get_info(struct acpi_battery *battery,
struct acpi_buffer data = { 0, NULL };
union acpi_object *package = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_get_info");
if (!battery || !bif)
return_VALUE(-EINVAL);
return -EINVAL;
/* Evalute _BIF */
status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
return_VALUE(-ENODEV);
return -ENODEV;
}
package = (union acpi_object *)buffer.pointer;
......@@ -177,7 +176,7 @@ acpi_battery_get_info(struct acpi_battery *battery,
if (!result)
(*bif) = (struct acpi_battery_info *)data.pointer;
return_VALUE(result);
return result;
}
static int
......@@ -193,17 +192,16 @@ acpi_battery_get_status(struct acpi_battery *battery,
struct acpi_buffer data = { 0, NULL };
union acpi_object *package = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_get_status");
if (!battery || !bst)
return_VALUE(-EINVAL);
return -EINVAL;
/* Evalute _BST */
status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
return_VALUE(-ENODEV);
return -ENODEV;
}
package = (union acpi_object *)buffer.pointer;
......@@ -238,7 +236,7 @@ acpi_battery_get_status(struct acpi_battery *battery,
if (!result)
(*bst) = (struct acpi_battery_status *)data.pointer;
return_VALUE(result);
return result;
}
static int
......@@ -248,25 +246,24 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list arg_list = { 1, &arg0 };
ACPI_FUNCTION_TRACE("acpi_battery_set_alarm");
if (!battery)
return_VALUE(-EINVAL);
return -EINVAL;
if (!battery->flags.alarm)
return_VALUE(-ENODEV);
return -ENODEV;
arg0.integer.value = alarm;
status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
return -ENODEV;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", (u32) alarm));
battery->alarm = alarm;
return_VALUE(0);
return 0;
}
static int acpi_battery_check(struct acpi_battery *battery)
......@@ -277,18 +274,17 @@ static int acpi_battery_check(struct acpi_battery *battery)
struct acpi_device *device = NULL;
struct acpi_battery_info *bif = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_check");
if (!battery)
return_VALUE(-EINVAL);
return -EINVAL;
result = acpi_bus_get_device(battery->handle, &device);
if (result)
return_VALUE(result);
return result;
result = acpi_bus_get_status(device);
if (result)
return_VALUE(result);
return result;
/* Insertion? */
......@@ -300,7 +296,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
result = acpi_battery_get_info(battery, &bif);
if (result)
return_VALUE(result);
return result;
battery->flags.power_unit = bif->power_unit;
battery->trips.warning = bif->design_capacity_warning;
......@@ -324,7 +320,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
battery->flags.present = device->status.battery_present;
return_VALUE(result);
return result;
}
/* --------------------------------------------------------------------------
......@@ -339,7 +335,6 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
struct acpi_battery_info *bif = NULL;
char *units = "?";