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) ...@@ -84,19 +84,18 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_ac_get_state");
if (!ac) if (!ac)
return_VALUE(-EINVAL); return -EINVAL;
status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state); status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state")); ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state"));
ac->state = ACPI_AC_STATUS_UNKNOWN; 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) ...@@ -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; struct acpi_ac *ac = (struct acpi_ac *)seq->private;
ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
if (!ac) if (!ac)
return_VALUE(0); return 0;
if (acpi_ac_get_state(ac)) { if (acpi_ac_get_state(ac)) {
seq_puts(seq, "ERROR: Unable to read AC Adapter state\n"); seq_puts(seq, "ERROR: Unable to read AC Adapter state\n");
return_VALUE(0); return 0;
} }
seq_puts(seq, "state: "); seq_puts(seq, "state: ");
...@@ -132,7 +130,7 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset) ...@@ -132,7 +130,7 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
break; break;
} }
return_VALUE(0); return 0;
} }
static int acpi_ac_open_fs(struct inode *inode, struct file *file) 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) ...@@ -144,13 +142,12 @@ static int acpi_ac_add_fs(struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_ac_dir); acpi_ac_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
} }
...@@ -158,19 +155,18 @@ static int acpi_ac_add_fs(struct acpi_device *device) ...@@ -158,19 +155,18 @@ static int acpi_ac_add_fs(struct acpi_device *device)
entry = create_proc_entry(ACPI_AC_FILE_STATE, entry = create_proc_entry(ACPI_AC_FILE_STATE,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_ac_fops; entry->proc_fops = &acpi_ac_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VALUE(0); return 0;
} }
static int acpi_ac_remove_fs(struct acpi_device *device) static int acpi_ac_remove_fs(struct acpi_device *device)
{ {
ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_AC_FILE_STATE, 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) ...@@ -179,7 +175,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; 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) ...@@ -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_ac *ac = (struct acpi_ac *)data;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_notify");
if (!ac) if (!ac)
return_VOID; return;
if (acpi_bus_get_device(ac->handle, &device)) if (acpi_bus_get_device(ac->handle, &device))
return_VOID; return;
switch (event) { switch (event) {
case ACPI_AC_NOTIFY_STATUS: case ACPI_AC_NOTIFY_STATUS:
...@@ -210,7 +205,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) ...@@ -210,7 +205,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
break; break;
} }
return_VOID; return;
} }
static int acpi_ac_add(struct acpi_device *device) static int acpi_ac_add(struct acpi_device *device)
...@@ -219,14 +214,13 @@ 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; acpi_status status = AE_OK;
struct acpi_ac *ac = NULL; struct acpi_ac *ac = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL); ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL);
if (!ac) if (!ac)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(ac, 0, sizeof(struct acpi_ac)); memset(ac, 0, sizeof(struct acpi_ac));
ac->handle = device->handle; ac->handle = device->handle;
...@@ -260,7 +254,7 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -260,7 +254,7 @@ static int acpi_ac_add(struct acpi_device *device)
kfree(ac); kfree(ac);
} }
return_VALUE(result); return result;
} }
static int acpi_ac_remove(struct acpi_device *device, int type) 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) ...@@ -268,10 +262,9 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_ac *ac = NULL; struct acpi_ac *ac = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
ac = (struct acpi_ac *)acpi_driver_data(device); ac = (struct acpi_ac *)acpi_driver_data(device);
...@@ -282,38 +275,36 @@ static int acpi_ac_remove(struct acpi_device *device, int type) ...@@ -282,38 +275,36 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
kfree(ac); kfree(ac);
return_VALUE(0); return 0;
} }
static int __init acpi_ac_init(void) static int __init acpi_ac_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_ac_init");
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
if (!acpi_ac_dir) if (!acpi_ac_dir)
return_VALUE(-ENODEV); return -ENODEV;
acpi_ac_dir->owner = THIS_MODULE; acpi_ac_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_ac_driver); result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); 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) static void __exit acpi_ac_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_ac_exit");
acpi_bus_unregister_driver(&acpi_ac_driver); acpi_bus_unregister_driver(&acpi_ac_driver);
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
return_VOID; return;
} }
module_init(acpi_ac_init); module_init(acpi_ac_init);
......
...@@ -85,12 +85,11 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) ...@@ -85,12 +85,11 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
struct acpi_resource *resource = NULL; struct acpi_resource *resource = NULL;
struct acpi_resource_address64 address64; struct acpi_resource_address64 address64;
ACPI_FUNCTION_TRACE("acpi_memory_get_device_resources");
/* Get the range from the _CRS */ /* Get the range from the _CRS */
status = acpi_get_current_resources(mem_device->handle, &buffer); status = acpi_get_current_resources(mem_device->handle, &buffer);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-EINVAL); return -EINVAL;
resource = (struct acpi_resource *)buffer.pointer; resource = (struct acpi_resource *)buffer.pointer;
status = acpi_resource_to_address64(resource, &address64); status = acpi_resource_to_address64(resource, &address64);
...@@ -106,7 +105,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) ...@@ -106,7 +105,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
} }
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_VALUE(0); return 0;
} }
static int static int
...@@ -118,7 +117,6 @@ acpi_memory_get_device(acpi_handle handle, ...@@ -118,7 +117,6 @@ acpi_memory_get_device(acpi_handle handle,
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
struct acpi_device *pdevice = NULL; struct acpi_device *pdevice = NULL;
ACPI_FUNCTION_TRACE("acpi_memory_get_device");
if (!acpi_bus_get_device(handle, &device) && device) if (!acpi_bus_get_device(handle, &device) && device)
goto end; goto end;
...@@ -126,14 +124,14 @@ acpi_memory_get_device(acpi_handle handle, ...@@ -126,14 +124,14 @@ acpi_memory_get_device(acpi_handle handle,
status = acpi_get_parent(handle, &phandle); status = acpi_get_parent(handle, &phandle);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent")); ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent"));
return_VALUE(-EINVAL); return -EINVAL;
} }
/* Get the parent device */ /* Get the parent device */
status = acpi_bus_get_device(phandle, &pdevice); status = acpi_bus_get_device(phandle, &pdevice);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device")); 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, ...@@ -143,29 +141,28 @@ acpi_memory_get_device(acpi_handle handle,
status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus")); ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus"));
return_VALUE(-EINVAL); return -EINVAL;
} }
end: end:
*mem_device = acpi_driver_data(device); *mem_device = acpi_driver_data(device);
if (!(*mem_device)) { if (!(*mem_device)) {
printk(KERN_ERR "\n driver data not found"); 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) static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
{ {
unsigned long current_status; unsigned long current_status;
ACPI_FUNCTION_TRACE("acpi_memory_check_device");
/* Get device present/absent information from the _STA */ /* Get device present/absent information from the _STA */
if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA", if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
NULL, &current_status))) NULL, &current_status)))
return_VALUE(-ENODEV); return -ENODEV;
/* /*
* Check for device status. Device should be * Check for device status. Device should be
* present/enabled/functioning. * present/enabled/functioning.
...@@ -173,16 +170,15 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device) ...@@ -173,16 +170,15 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
if (!((current_status & ACPI_MEMORY_STA_PRESENT) if (!((current_status & ACPI_MEMORY_STA_PRESENT)
&& (current_status & ACPI_MEMORY_STA_ENABLED) && (current_status & ACPI_MEMORY_STA_ENABLED)
&& (current_status & ACPI_MEMORY_STA_FUNCTIONAL))) && (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) static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
{ {
int result; int result;
ACPI_FUNCTION_TRACE("acpi_memory_enable_device");
/* Get the range from the _CRS */ /* Get the range from the _CRS */
result = acpi_memory_get_device_resources(mem_device); result = acpi_memory_get_device_resources(mem_device);
...@@ -213,7 +209,6 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) ...@@ -213,7 +209,6 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
union acpi_object arg; union acpi_object arg;
unsigned long current_status; unsigned long current_status;
ACPI_FUNCTION_TRACE("acpi_memory_powerdown_device");
/* Issue the _EJ0 command */ /* Issue the _EJ0 command */
arg_list.count = 1; arg_list.count = 1;
...@@ -225,20 +220,20 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) ...@@ -225,20 +220,20 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
/* Return on _EJ0 failure */ /* Return on _EJ0 failure */
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed")); ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed"));
return_VALUE(-ENODEV); return -ENODEV;
} }
/* Evalute _STA to check if the device is disabled */ /* Evalute _STA to check if the device is disabled */
status = acpi_evaluate_integer(mem_device->handle, "_STA", status = acpi_evaluate_integer(mem_device->handle, "_STA",
NULL, &current_status); NULL, &current_status);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
/* Check for device status. Device should be disabled */ /* Check for device status. Device should be disabled */
if (current_status & ACPI_MEMORY_STA_ENABLED) 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) 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) ...@@ -247,7 +242,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
u64 start = mem_device->start_addr; u64 start = mem_device->start_addr;
u64 len = mem_device->length; u64 len = mem_device->length;
ACPI_FUNCTION_TRACE("acpi_memory_disable_device");
/* /*
* Ask the VM to offline this memory range. * Ask the VM to offline this memory range.
...@@ -255,7 +249,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) ...@@ -255,7 +249,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
*/ */
result = remove_memory(start, len); result = remove_memory(start, len);
if (result) if (result)
return_VALUE(result); return result;
/* Power-off and eject the device */ /* Power-off and eject the device */
result = acpi_memory_powerdown_device(mem_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) ...@@ -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_memory_device *mem_device;
struct acpi_device *device; struct acpi_device *device;
ACPI_FUNCTION_TRACE("acpi_memory_device_notify");
switch (event) { switch (event) {
case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_BUS_CHECK:
...@@ -287,7 +280,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) ...@@ -287,7 +280,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
"\nReceived DEVICE CHECK notification for device\n")); "\nReceived DEVICE CHECK notification for device\n"));
if (acpi_memory_get_device(handle, &mem_device)) { if (acpi_memory_get_device(handle, &mem_device)) {
printk(KERN_ERR PREFIX "Cannot find driver data\n"); printk(KERN_ERR PREFIX "Cannot find driver data\n");
return_VOID; return;
} }
if (!acpi_memory_check_device(mem_device)) { if (!acpi_memory_check_device(mem_device)) {
...@@ -329,7 +322,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) ...@@ -329,7 +322,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
break; break;
} }
return_VOID; return;
} }
static int acpi_memory_device_add(struct acpi_device *device) static int acpi_memory_device_add(struct acpi_device *device)
...@@ -337,14 +330,13 @@ 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; int result;
struct acpi_memory_device *mem_device = NULL; struct acpi_memory_device *mem_device = NULL;
ACPI_FUNCTION_TRACE("acpi_memory_device_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL); mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
if (!mem_device) if (!mem_device)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(mem_device, 0, sizeof(struct acpi_memory_device)); memset(mem_device, 0, sizeof(struct acpi_memory_device));
mem_device->handle = device->handle; mem_device->handle = device->handle;
...@@ -356,7 +348,7 @@ static int acpi_memory_device_add(struct acpi_device *device) ...@@ -356,7 +348,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
result = acpi_memory_get_device_resources(mem_device); result = acpi_memory_get_device_resources(mem_device);
if (result) { if (result) {
kfree(mem_device); kfree(mem_device);
return_VALUE(result); return result;
} }
/* Set the device state */ /* Set the device state */
...@@ -364,22 +356,21 @@ static int acpi_memory_device_add(struct acpi_device *device) ...@@ -364,22 +356,21 @@ static int acpi_memory_device_add(struct acpi_device *device)
printk(KERN_INFO "%s \n", acpi_device_name(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) static int acpi_memory_device_remove(struct acpi_device *device, int type)
{ {
struct acpi_memory_device *mem_device = NULL; struct acpi_memory_device *mem_device = NULL;
ACPI_FUNCTION_TRACE("acpi_memory_device_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
mem_device = (struct acpi_memory_device *)acpi_driver_data(device); mem_device = (struct acpi_memory_device *)acpi_driver_data(device);
kfree(mem_device); kfree(mem_device);
return_VALUE(0); return 0;
} }
/* /*
...@@ -392,16 +383,15 @@ static acpi_status is_memory_device(acpi_handle handle) ...@@ -392,16 +383,15 @@ static acpi_status is_memory_device(acpi_handle handle)
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_device_info *info; struct acpi_device_info *info;
ACPI_FUNCTION_TRACE("is_memory_device");
status = acpi_get_object_info(handle, &buffer); status = acpi_get_object_info(handle, &buffer);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_ACPI_STATUS(status); return status;
info = buffer.pointer; info = buffer.pointer;
if (!(info->valid & ACPI_VALID_HID)) { if (!(info->valid & ACPI_VALID_HID)) {
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_ACPI_STATUS(AE_ERROR); return AE_ERROR;
} }
hardware_id = info->hardware_id.value; hardware_id = info->hardware_id.value;
...@@ -410,7 +400,7 @@ static acpi_status is_memory_device(acpi_handle handle) ...@@ -410,7 +400,7 @@ static acpi_status is_memory_device(acpi_handle handle)
status = AE_ERROR; status = AE_ERROR;
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_ACPI_STATUS(status); return status;
} }
static acpi_status static acpi_status
...@@ -419,18 +409,17 @@ acpi_memory_register_notify_handler(acpi_handle handle, ...@@ -419,18 +409,17 @@ acpi_memory_register_notify_handler(acpi_handle handle,
{ {
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE("acpi_memory_register_notify_handler");
status = is_memory_device(handle); status = is_memory_device(handle);
if (ACPI_FAILURE(status)){ if (ACPI_FAILURE(status)){
ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); 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, status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
acpi_memory_device_notify, NULL); acpi_memory_device_notify, NULL);
/* continue */ /* continue */
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
static acpi_status static acpi_status
...@@ -439,19 +428,18 @@ acpi_memory_deregister_notify_handler(acpi_handle handle, ...@@ -439,19 +428,18 @@ acpi_memory_deregister_notify_handler(acpi_handle handle,
{ {
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE("acpi_memory_deregister_notify_handler");
status = is_memory_device(handle); status = is_memory_device(handle);
if (ACPI_FAILURE(status)){ if (ACPI_FAILURE(status)){
ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); 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, status = acpi_remove_notify_handler(handle,
ACPI_SYSTEM_NOTIFY, ACPI_SYSTEM_NOTIFY,
acpi_memory_device_notify); acpi_memory_device_notify);
return_ACPI_STATUS(AE_OK); /* continue */ return AE_OK; /* continue */
} }
static int __init acpi_memory_device_init(void) static int __init acpi_memory_device_init(void)
...@@ -459,12 +447,11 @@ static int __init acpi_memory_device_init(void) ...@@ -459,12 +447,11 @@ static int __init acpi_memory_device_init(void)
int result; int result;
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE("acpi_memory_device_init");
result = acpi_bus_register_driver(&acpi_memory_device_driver); result = acpi_bus_register_driver(&acpi_memory_device_driver);
if (result < 0) if (result < 0)
return_VALUE(-ENODEV); return -ENODEV;
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, ACPI_UINT32_MAX,
...@@ -474,17 +461,16 @@ static int __init acpi_memory_device_init(void) ...@@ -474,17 +461,16 @@ static int __init acpi_memory_device_init(void)
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed"));
acpi_bus_unregister_driver(&acpi_memory_device_driver); 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) static void __exit acpi_memory_device_exit(void)
{ {
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE("acpi_memory_device_exit");
/* /*
* Adding this to un-install notification handlers for all the device * Adding this to un-install notification handlers for all the device
...@@ -500,7 +486,7 @@ static void __exit acpi_memory_device_exit(void) ...@@ -500,7 +486,7 @@ static void __exit acpi_memory_device_exit(void)
acpi_bus_unregister_driver(&acpi_memory_device_driver); acpi_bus_unregister_driver(&acpi_memory_device_driver);
return_VOID; return;
} }
module_init(acpi_memory_device_init); module_init(acpi_memory_device_init);
......
...@@ -132,17 +132,16 @@ acpi_battery_get_info(struct acpi_battery *battery, ...@@ -132,17 +132,16 @@ acpi_battery_get_info(struct acpi_battery *battery,
struct acpi_buffer data = { 0, NULL }; struct acpi_buffer data = { 0, NULL };
union acpi_object *package = NULL; union acpi_object *package = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_get_info");
if (!battery || !bif) if (!battery || !bif)
return_VALUE(-EINVAL); return -EINVAL;
/* Evalute _BIF */ /* Evalute _BIF */
status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer); status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
return_VALUE(-ENODEV); return -ENODEV;
} }
package = (union acpi_object *)buffer.pointer; package = (union acpi_object *)buffer.pointer;
...@@ -177,7 +176,7 @@ acpi_battery_get_info(struct acpi_battery *battery, ...@@ -177,7 +176,7 @@ acpi_battery_get_info(struct acpi_battery *battery,
if (!result) if (!result)
(*bif) = (struct acpi_battery_info *)data.pointer; (*bif) = (struct acpi_battery_info *)data.pointer;
return_VALUE(result); return result;
} }
static int static int
...@@ -193,17 +192,16 @@ acpi_battery_get_status(struct acpi_battery *battery, ...@@ -193,17 +192,16 @@ acpi_battery_get_status(struct acpi_battery *battery,
struct acpi_buffer data = { 0, NULL }; struct acpi_buffer data = { 0, NULL };
union acpi_object *package = NULL; union acpi_object *package = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_get_status");
if (!battery || !bst) if (!battery || !bst)
return_VALUE(-EINVAL); return -EINVAL;
/* Evalute _BST */ /* Evalute _BST */
status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer); status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
return_VALUE(-ENODEV); return -ENODEV;
} }
package = (union acpi_object *)buffer.pointer; package = (union acpi_object *)buffer.pointer;
...@@ -238,7 +236,7 @@ acpi_battery_get_status(struct acpi_battery *battery, ...@@ -238,7 +236,7 @@ acpi_battery_get_status(struct acpi_battery *battery,
if (!result) if (!result)
(*bst) = (struct acpi_battery_status *)data.pointer; (*bst) = (struct acpi_battery_status *)data.pointer;
return_VALUE(result); return result;
} }
static int static int
...@@ -248,25 +246,24 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm) ...@@ -248,25 +246,24 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)
union acpi_object arg0 = { ACPI_TYPE_INTEGER }; union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list arg_list = { 1, &arg0 }; struct acpi_object_list arg_list = { 1, &arg0 };
ACPI_FUNCTION_TRACE("acpi_battery_set_alarm");
if (!battery) if (!battery)
return_VALUE(-EINVAL); return -EINVAL;
if (!battery->flags.alarm) if (!battery->flags.alarm)
return_VALUE(-ENODEV); return -ENODEV;
arg0.integer.value = alarm; arg0.integer.value = alarm;
status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL); status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", (u32) alarm)); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", (u32) alarm));
battery->alarm = alarm; battery->alarm = alarm;
return_VALUE(0); return 0;
} }
static int acpi_battery_check(struct acpi_battery *battery) static int acpi_battery_check(struct acpi_battery *battery)
...@@ -277,18 +274,17 @@ 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_device *device = NULL;
struct acpi_battery_info *bif = NULL; struct acpi_battery_info *bif = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_check");
if (!battery) if (!battery)
return_VALUE(-EINVAL); return -EINVAL;
result = acpi_bus_get_device(battery->handle, &device); result = acpi_bus_get_device(battery->handle, &device);
if (result) if (result)
return_VALUE(result); return result;
result = acpi_bus_get_status(device); result = acpi_bus_get_status(device);
if (result) if (result)
return_VALUE(result); return result;
/* Insertion? */ /* Insertion? */
...@@ -300,7 +296,7 @@ static int acpi_battery_check(struct acpi_battery *battery) ...@@ -300,7 +296,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
result = acpi_battery_get_info(battery, &bif); result = acpi_battery_get_info(battery, &bif);
if (result) if (result)
return_VALUE(result); return result;
battery->flags.power_unit = bif->power_unit; battery->flags.power_unit = bif->power_unit;
battery->trips.warning = bif->design_capacity_warning; battery->trips.warning = bif->design_capacity_warning;
...@@ -324,7 +320,7 @@ static int acpi_battery_check(struct acpi_battery *battery) ...@@ -324,7 +320,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
battery->flags.present = device->status.battery_present; 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) ...@@ -339,7 +335,6 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
struct acpi_battery_info *bif = NULL; struct acpi_battery_info *bif = NULL;
char *units = "?"; char *units = "?";
ACPI_FUNCTION_TRACE("acpi_battery_read_info");
if (!battery) if (!battery)
goto end; goto end;
...@@ -409,7 +404,7 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) ...@@ -409,7 +404,7 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
end: end:
kfree(bif); kfree(bif);
return_VALUE(0); return 0;
} }
static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
...@@ -424,7 +419,6 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) ...@@ -424,7 +419,6 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
struct acpi_battery_status *bst = NULL; struct acpi_battery_status *bst = NULL;
char *units = "?"; char *units = "?";
ACPI_FUNCTION_TRACE("acpi_battery_read_state");
if (!battery) if (!battery)
goto end; goto end;
...@@ -487,7 +481,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) ...@@ -487,7 +481,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
end: end:
kfree(bst); kfree(bst);
return_VALUE(0); return 0;
} }
static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
...@@ -500,7 +494,6 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) ...@@ -500,7 +494,6 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
struct acpi_battery *battery = (struct acpi_battery *)seq->private; struct acpi_battery *battery = (struct acpi_battery *)seq->private;
char *units = "?"; char *units = "?";
ACPI_FUNCTION_TRACE("acpi_battery_read_alarm");
if (!battery) if (!battery)
goto end; goto end;
...@@ -525,7 +518,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) ...@@ -525,7 +518,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units); seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units);
end: end:
return_VALUE(0); return 0;
} }
static ssize_t static ssize_t
...@@ -538,25 +531,24 @@ acpi_battery_write_alarm(struct file *file, ...@@ -538,25 +531,24 @@ acpi_battery_write_alarm(struct file *file,
struct seq_file *m = (struct seq_file *)file->private_data; struct seq_file *m = (struct seq_file *)file->private_data;
struct acpi_battery *battery = (struct acpi_battery *)m->private; struct acpi_battery *battery = (struct acpi_battery *)m->private;
ACPI_FUNCTION_TRACE("acpi_battery_write_alarm");
if (!battery || (count > sizeof(alarm_string) - 1)) if (!battery || (count > sizeof(alarm_string) - 1))
return_VALUE(-EINVAL); return -EINVAL;
if (!battery->flags.present) if (!battery->flags.present)
return_VALUE(-ENODEV); return -ENODEV;
if (copy_from_user(alarm_string, buffer, count)) if (copy_from_user(alarm_string, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
alarm_string[count] = '\0'; alarm_string[count] = '\0';
result = acpi_battery_set_alarm(battery, result = acpi_battery_set_alarm(battery,
simple_strtoul(alarm_string, NULL, 0)); simple_strtoul(alarm_string, NULL, 0));
if (result) if (result)
return_VALUE(result); return result;
return_VALUE(count); return count;
} }
static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
...@@ -593,13 +585,12 @@ static int acpi_battery_add_fs(struct acpi_device *device) ...@@ -593,13 +585,12 @@ static int acpi_battery_add_fs(struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_add_fs");
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_battery_dir); acpi_battery_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
} }
...@@ -607,7 +598,7 @@ static int acpi_battery_add_fs(struct acpi_device *device) ...@@ -607,7 +598,7 @@ static int acpi_battery_add_fs(struct acpi_device *device)
entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, entry = create_proc_entry(ACPI_BATTERY_FILE_INFO,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_battery_info_ops; entry->proc_fops = &acpi_battery_info_ops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -618,7 +609,7 @@ static int acpi_battery_add_fs(struct acpi_device *device) ...@@ -618,7 +609,7 @@ static int acpi_battery_add_fs(struct acpi_device *device)
entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS, entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_battery_state_ops; entry->proc_fops = &acpi_battery_state_ops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -630,19 +621,18 @@ static int acpi_battery_add_fs(struct acpi_device *device) ...@@ -630,19 +621,18 @@ static int acpi_battery_add_fs(struct acpi_device *device)
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_battery_alarm_ops; entry->proc_fops = &acpi_battery_alarm_ops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VALUE(0); return 0;
} }
static int acpi_battery_remove_fs(struct acpi_device *device) static int acpi_battery_remove_fs(struct acpi_device *device)
{ {
ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_BATTERY_FILE_ALARM, remove_proc_entry(ACPI_BATTERY_FILE_ALARM,
...@@ -656,7 +646,7 @@ static int acpi_battery_remove_fs(struct acpi_device *device) ...@@ -656,7 +646,7 @@ static int acpi_battery_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -668,13 +658,12 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) ...@@ -668,13 +658,12 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
struct acpi_battery *battery = (struct acpi_battery *)data; struct acpi_battery *battery = (struct acpi_battery *)data;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_notify");
if (!battery) if (!battery)
return_VOID; return;
if (acpi_bus_get_device(handle, &device)) if (acpi_bus_get_device(handle, &device))
return_VOID; return;
switch (event) { switch (event) {
case ACPI_BATTERY_NOTIFY_STATUS: case ACPI_BATTERY_NOTIFY_STATUS:
...@@ -688,7 +677,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) ...@@ -688,7 +677,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
break; break;
} }
return_VOID; return;
} }
static int acpi_battery_add(struct acpi_device *device) static int acpi_battery_add(struct acpi_device *device)
...@@ -697,14 +686,13 @@ static int acpi_battery_add(struct acpi_device *device) ...@@ -697,14 +686,13 @@ static int acpi_battery_add(struct acpi_device *device)
acpi_status status = 0; acpi_status status = 0;
struct acpi_battery *battery = NULL; struct acpi_battery *battery = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
battery = kmalloc(sizeof(struct acpi_battery), GFP_KERNEL); battery = kmalloc(sizeof(struct acpi_battery), GFP_KERNEL);
if (!battery) if (!battery)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(battery, 0, sizeof(struct acpi_battery)); memset(battery, 0, sizeof(struct acpi_battery));
battery->handle = device->handle; battery->handle = device->handle;
...@@ -738,7 +726,7 @@ static int acpi_battery_add(struct acpi_device *device) ...@@ -738,7 +726,7 @@ static int acpi_battery_add(struct acpi_device *device)
kfree(battery); kfree(battery);
} }
return_VALUE(result); return result;
} }
static int acpi_battery_remove(struct acpi_device *device, int type) static int acpi_battery_remove(struct acpi_device *device, int type)
...@@ -746,10 +734,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type) ...@@ -746,10 +734,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
acpi_status status = 0; acpi_status status = 0;
struct acpi_battery *battery = NULL; struct acpi_battery *battery = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
battery = (struct acpi_battery *)acpi_driver_data(device); battery = (struct acpi_battery *)acpi_driver_data(device);
...@@ -761,38 +748,36 @@ static int acpi_battery_remove(struct acpi_device *device, int type) ...@@ -761,38 +748,36 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
kfree(battery); kfree(battery);
return_VALUE(0); return 0;
} }
static int __init acpi_battery_init(void) static int __init acpi_battery_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_battery_init");
acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
if (!acpi_battery_dir) if (!acpi_battery_dir)
return_VALUE(-ENODEV); return -ENODEV;
acpi_battery_dir->owner = THIS_MODULE; acpi_battery_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_battery_driver); result = acpi_bus_register_driver(&acpi_battery_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
static void __exit acpi_battery_exit(void) static void __exit acpi_battery_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_battery_exit");
acpi_bus_unregister_driver(&acpi_battery_driver); acpi_bus_unregister_driver(&acpi_battery_driver);
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
return_VOID; return;
} }
module_init(acpi_battery_init); module_init(acpi_battery_init);
......
...@@ -60,20 +60,19 @@ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device) ...@@ -60,20 +60,19 @@ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_bus_get_device");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
/* TBD: Support fixed-feature devices */ /* TBD: Support fixed-feature devices */
status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device); status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device);
if (ACPI_FAILURE(status) || !*device) { if (ACPI_FAILURE(status) || !*device) {
ACPI_EXCEPTION((AE_INFO, status, "No context for object [%p]", handle)); ACPI_EXCEPTION((AE_INFO, status, "No context for object [%p]", handle));
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
EXPORT_SYMBOL(acpi_bus_get_device); EXPORT_SYMBOL(acpi_bus_get_device);
...@@ -83,10 +82,9 @@ int acpi_bus_get_status(struct acpi_device *device) ...@@ -83,10 +82,9 @@ int acpi_bus_get_status(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
unsigned long sta = 0; unsigned long sta = 0;
ACPI_FUNCTION_TRACE("acpi_bus_get_status");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
/* /*
* Evaluate _STA if present. * Evaluate _STA if present.
...@@ -95,7 +93,7 @@ int acpi_bus_get_status(struct acpi_device *device) ...@@ -95,7 +93,7 @@ int acpi_bus_get_status(struct acpi_device *device)
status = status =
acpi_evaluate_integer(device->handle, "_STA", NULL, &sta); acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
STRUCT_TO_INT(device->status) = (int)sta; STRUCT_TO_INT(device->status) = (int)sta;
} }
...@@ -119,7 +117,7 @@ int acpi_bus_get_status(struct acpi_device *device) ...@@ -119,7 +117,7 @@ int acpi_bus_get_status(struct acpi_device *device)
device->pnp.bus_id, device->pnp.bus_id,
(u32) STRUCT_TO_INT(device->status))); (u32) STRUCT_TO_INT(device->status)));
return_VALUE(0); return 0;
} }
EXPORT_SYMBOL(acpi_bus_get_status); EXPORT_SYMBOL(acpi_bus_get_status);
...@@ -135,11 +133,10 @@ int acpi_bus_get_power(acpi_handle handle, int *state) ...@@ -135,11 +133,10 @@ int acpi_bus_get_power(acpi_handle handle, int *state)
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
unsigned long psc = 0; unsigned long psc = 0;
ACPI_FUNCTION_TRACE("acpi_bus_get_power");
result = acpi_bus_get_device(handle, &device); result = acpi_bus_get_device(handle, &device);
if (result) if (result)
return_VALUE(result); return result;
*state = ACPI_STATE_UNKNOWN; *state = ACPI_STATE_UNKNOWN;
...@@ -158,12 +155,12 @@ int acpi_bus_get_power(acpi_handle handle, int *state) ...@@ -158,12 +155,12 @@ int acpi_bus_get_power(acpi_handle handle, int *state)
status = acpi_evaluate_integer(device->handle, "_PSC", status = acpi_evaluate_integer(device->handle, "_PSC",
NULL, &psc); NULL, &psc);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
device->power.state = (int)psc; device->power.state = (int)psc;
} else if (device->power.flags.power_resources) { } else if (device->power.flags.power_resources) {
result = acpi_power_get_inferred_state(device); result = acpi_power_get_inferred_state(device);
if (result) if (result)
return_VALUE(result); return result;
} }
*state = device->power.state; *state = device->power.state;
...@@ -172,7 +169,7 @@ int acpi_bus_get_power(acpi_handle handle, int *state) ...@@ -172,7 +169,7 @@ int acpi_bus_get_power(acpi_handle handle, int *state)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n",
device->pnp.bus_id, device->power.state)); device->pnp.bus_id, device->power.state));
return_VALUE(0); return 0;
} }
EXPORT_SYMBOL(acpi_bus_get_power); EXPORT_SYMBOL(acpi_bus_get_power);
...@@ -184,21 +181,20 @@ int acpi_bus_set_power(acpi_handle handle, int state) ...@@ -184,21 +181,20 @@ int acpi_bus_set_power(acpi_handle handle, int state)
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' }; char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
ACPI_FUNCTION_TRACE("acpi_bus_set_power");
result = acpi_bus_get_device(handle, &device); result = acpi_bus_get_device(handle, &device);
if (result) if (result)
return_VALUE(result); return result;
if ((state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) if ((state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
return_VALUE(-EINVAL); return -EINVAL;
/* Make sure this is a valid target state */ /* Make sure this is a valid target state */
if (!device->flags.power_manageable) { if (!device->flags.power_manageable) {
printk(KERN_DEBUG "Device `[%s]is not power manageable", printk(KERN_DEBUG "Device `[%s]is not power manageable",
device->kobj.name); device->kobj.name);
return_VALUE(-ENODEV); return -ENODEV;
} }
/* /*
* Get device's current power state if it's unknown * Get device's current power state if it's unknown
...@@ -210,18 +206,18 @@ int acpi_bus_set_power(acpi_handle handle, int state) ...@@ -210,18 +206,18 @@ int acpi_bus_set_power(acpi_handle handle, int state)
if (state == device->power.state) { if (state == device->power.state) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
state)); state));
return_VALUE(0); return 0;
} }
} }
if (!device->power.states[state].flags.valid) { if (!device->power.states[state].flags.valid) {
printk(KERN_WARNING PREFIX "Device does not support D%d\n", state); printk(KERN_WARNING PREFIX "Device does not support D%d\n", state);
return_VALUE(-ENODEV); return -ENODEV;
} }
if (device->parent && (state < device->parent->power.state)) { if (device->parent && (state < device->parent->power.state)) {
printk(KERN_WARNING PREFIX printk(KERN_WARNING PREFIX
"Cannot set device to a higher-powered" "Cannot set device to a higher-powered"
" state than parent\n"); " state than parent\n");
return_VALUE(-ENODEV); return -ENODEV;
} }
/* /*
...@@ -271,7 +267,7 @@ int acpi_bus_set_power(acpi_handle handle, int state) ...@@ -271,7 +267,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)
"Device [%s] transitioned to D%d\n", "Device [%s] transitioned to D%d\n",
device->pnp.bus_id, state)); device->pnp.bus_id, state));
return_VALUE(result); return result;
} }
EXPORT_SYMBOL(acpi_bus_set_power); EXPORT_SYMBOL(acpi_bus_set_power);
...@@ -292,18 +288,17 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) ...@@ -292,18 +288,17 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
struct acpi_bus_event *event = NULL; struct acpi_bus_event *event = NULL;
unsigned long flags = 0; unsigned long flags = 0;
ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
/* drop event on the floor if no one's listening */ /* drop event on the floor if no one's listening */
if (!event_is_open) if (!event_is_open)
return_VALUE(0); return 0;
event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC); event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
if (!event) if (!event)
return_VALUE(-ENOMEM); return -ENOMEM;
strcpy(event->device_class, device->pnp.device_class); strcpy(event->device_class, device->pnp.device_class);
strcpy(event->bus_id, device->pnp.bus_id); strcpy(event->bus_id, device->pnp.bus_id);
...@@ -316,7 +311,7 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) ...@@ -316,7 +311,7 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
wake_up_interruptible(&acpi_bus_event_queue); wake_up_interruptible(&acpi_bus_event_queue);
return_VALUE(0); return 0;
} }
EXPORT_SYMBOL(acpi_bus_generate_event); EXPORT_SYMBOL(acpi_bus_generate_event);
...@@ -328,10 +323,9 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) ...@@ -328,10 +323,9 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
ACPI_FUNCTION_TRACE("acpi_bus_receive_event");
if (!event) if (!event)
return_VALUE(-EINVAL); return -EINVAL;
if (list_empty(&acpi_bus_event_list)) { if (list_empty(&acpi_bus_event_list)) {
...@@ -345,7 +339,7 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) ...@@ -345,7 +339,7 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
if (signal_pending(current)) if (signal_pending(current))
return_VALUE(-ERESTARTSYS); return -ERESTARTSYS;
} }
spin_lock_irqsave(&acpi_bus_event_lock, flags); spin_lock_irqsave(&acpi_bus_event_lock, flags);
...@@ -356,13 +350,13 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) ...@@ -356,13 +350,13 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
spin_unlock_irqrestore(&acpi_bus_event_lock, flags); spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
memcpy(event, entry, sizeof(struct acpi_bus_event)); memcpy(event, entry, sizeof(struct acpi_bus_event));
kfree(entry); kfree(entry);
return_VALUE(0); return 0;
} }
EXPORT_SYMBOL(acpi_bus_receive_event); EXPORT_SYMBOL(acpi_bus_receive_event);
...@@ -377,10 +371,9 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) ...@@ -377,10 +371,9 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
acpi_status status = 0; acpi_status status = 0;
struct acpi_device_status old_status; struct acpi_device_status old_status;
ACPI_FUNCTION_TRACE("acpi_bus_check_device");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
if (status_changed) if (status_changed)
*status_changed = 0; *status_changed = 0;
...@@ -397,15 +390,15 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) ...@@ -397,15 +390,15 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
if (status_changed) if (status_changed)
*status_changed = 1; *status_changed = 1;
} }
return_VALUE(0); return 0;
} }
status = acpi_bus_get_status(device); status = acpi_bus_get_status(device);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status)) if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status))
return_VALUE(0); return 0;
if (status_changed) if (status_changed)
*status_changed = 1; *status_changed = 1;
...@@ -421,7 +414,7 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) ...@@ -421,7 +414,7 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
/* TBD: Handle device removal */ /* TBD: Handle device removal */
} }
return_VALUE(0); return 0;
} }
static int acpi_bus_check_scope(struct acpi_device *device) static int acpi_bus_check_scope(struct acpi_device *device)
...@@ -429,25 +422,24 @@ static int acpi_bus_check_scope(struct acpi_device *device) ...@@ -429,25 +422,24 @@ static int acpi_bus_check_scope(struct acpi_device *device)
int result = 0; int result = 0;
int status_changed = 0; int status_changed = 0;
ACPI_FUNCTION_TRACE("acpi_bus_check_scope");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
/* Status Change? */ /* Status Change? */
result = acpi_bus_check_device(device, &status_changed); result = acpi_bus_check_device(device, &status_changed);
if (result) if (result)
return_VALUE(result); return result;
if (!status_changed) if (!status_changed)
return_VALUE(0); return 0;
/* /*
* TBD: Enumerate child devices within this device's scope and * TBD: Enumerate child devices within this device's scope and
* run acpi_bus_check_device()'s on them. * run acpi_bus_check_device()'s on them.
*/ */
return_VALUE(0); return 0;
} }
/** /**
...@@ -460,10 +452,9 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -460,10 +452,9 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
int result = 0; int result = 0;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_bus_notify");
if (acpi_bus_get_device(handle, &device)) if (acpi_bus_get_device(handle, &device))
return_VOID; return;
switch (type) { switch (type) {
...@@ -538,7 +529,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -538,7 +529,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
break; break;
} }
return_VOID; return;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -552,7 +543,6 @@ static int __init acpi_bus_init_irq(void) ...@@ -552,7 +543,6 @@ static int __init acpi_bus_init_irq(void)
struct acpi_object_list arg_list = { 1, &arg }; struct acpi_object_list arg_list = { 1, &arg };
char *message = NULL; char *message = NULL;
ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
/* /*
* Let the system know what interrupt model we are using by * Let the system know what interrupt model we are using by
...@@ -571,7 +561,7 @@ static int __init acpi_bus_init_irq(void) ...@@ -571,7 +561,7 @@ static int __init acpi_bus_init_irq(void)
break; break;
default: default:
printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n"); printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n");
return_VALUE(-ENODEV); return -ENODEV;
} }
printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message); printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message);
...@@ -581,10 +571,10 @@ static int __init acpi_bus_init_irq(void) ...@@ -581,10 +571,10 @@ static int __init acpi_bus_init_irq(void)
status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL); status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL);
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC"));
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
void __init acpi_early_init(void) void __init acpi_early_init(void)
...@@ -592,10 +582,9 @@ void __init acpi_early_init(void) ...@@ -592,10 +582,9 @@ void __init acpi_early_init(void)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt }; struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt };
ACPI_FUNCTION_TRACE("acpi_early_init");
if (acpi_disabled) if (acpi_disabled)
return_VOID; return;
printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION);
...@@ -655,11 +644,11 @@ void __init acpi_early_init(void) ...@@ -655,11 +644,11 @@ void __init acpi_early_init(void)
goto error0; goto error0;
} }
return_VOID; return;
error0: error0:
disable_acpi(); disable_acpi();
return_VOID; return;
} }
static int __init acpi_bus_init(void) static int __init acpi_bus_init(void)
...@@ -668,7 +657,6 @@ static int __init acpi_bus_init(void) ...@@ -668,7 +657,6 @@ static int __init acpi_bus_init(void)
acpi_status status = AE_OK; acpi_status status = AE_OK;
extern acpi_status acpi_os_initialize1(void); extern acpi_status acpi_os_initialize1(void);
ACPI_FUNCTION_TRACE("acpi_bus_init");
status = acpi_os_initialize1(); status = acpi_os_initialize1();
...@@ -730,12 +718,12 @@ static int __init acpi_bus_init(void) ...@@ -730,12 +718,12 @@ static int __init acpi_bus_init(void)
*/ */
acpi_root_dir = proc_mkdir(ACPI_BUS_FILE_ROOT, NULL); acpi_root_dir = proc_mkdir(ACPI_BUS_FILE_ROOT, NULL);
return_VALUE(0); return 0;
/* Mimic structured exception handling */ /* Mimic structured exception handling */
error1: error1:
acpi_terminate(); acpi_terminate();
return_VALUE(-ENODEV); return -ENODEV;
} }
decl_subsys(acpi, NULL, NULL); decl_subsys(acpi, NULL, NULL);
...@@ -744,11 +732,10 @@ static int __init acpi_init(void) ...@@ -744,11 +732,10 @@ static int __init acpi_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_init");
if (acpi_disabled) { if (acpi_disabled) {
printk(KERN_INFO PREFIX "Interpreter disabled.\n"); printk(KERN_INFO PREFIX "Interpreter disabled.\n");
return_VALUE(-ENODEV); return -ENODEV;
} }
firmware_register(&acpi_subsys); firmware_register(&acpi_subsys);
...@@ -769,7 +756,7 @@ static int __init acpi_init(void) ...@@ -769,7 +756,7 @@ static int __init acpi_init(void)
} else } else
disable_acpi(); disable_acpi();
return_VALUE(result); return result;
} }
subsys_initcall(acpi_init); subsys_initcall(acpi_init);
...@@ -112,15 +112,14 @@ static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) ...@@ -112,15 +112,14 @@ static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_button *button = (struct acpi_button *)seq->private; struct acpi_button *button = (struct acpi_button *)seq->private;
ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
if (!button || !button->device) if (!button || !button->device)
return_VALUE(0); return 0;
seq_printf(seq, "type: %s\n", seq_printf(seq, "type: %s\n",
acpi_device_name(button->device)); acpi_device_name(button->device));
return_VALUE(0); return 0;
} }
static int acpi_button_info_open_fs(struct inode *inode, struct file *file) static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
...@@ -134,10 +133,9 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) ...@@ -134,10 +133,9 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
acpi_status status; acpi_status status;
unsigned long state; unsigned long state;
ACPI_FUNCTION_TRACE("acpi_button_state_seq_show");
if (!button || !button->device) if (!button || !button->device)
return_VALUE(0); return 0;
status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state); status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -147,7 +145,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) ...@@ -147,7 +145,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
(state ? "open" : "closed")); (state ? "open" : "closed"));
} }
return_VALUE(0); return 0;
} }
static int acpi_button_state_open_fs(struct inode *inode, struct file *file) static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
...@@ -164,10 +162,9 @@ static int acpi_button_add_fs(struct acpi_device *device) ...@@ -164,10 +162,9 @@ static int acpi_button_add_fs(struct acpi_device *device)
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
struct acpi_button *button = NULL; struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_add_fs");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
button = acpi_driver_data(device); button = acpi_driver_data(device);
...@@ -195,19 +192,19 @@ static int acpi_button_add_fs(struct acpi_device *device) ...@@ -195,19 +192,19 @@ static int acpi_button_add_fs(struct acpi_device *device)
} }
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
/* 'info' [R] */ /* 'info' [R] */
entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_button_info_fops; entry->proc_fops = &acpi_button_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -227,14 +224,13 @@ static int acpi_button_add_fs(struct acpi_device *device) ...@@ -227,14 +224,13 @@ static int acpi_button_add_fs(struct acpi_device *device)
} }
} }
return_VALUE(0); return 0;
} }
static int acpi_button_remove_fs(struct acpi_device *device) static int acpi_button_remove_fs(struct acpi_device *device)
{ {
struct acpi_button *button = NULL; struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
button = acpi_driver_data(device); button = acpi_driver_data(device);
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
...@@ -249,7 +245,7 @@ static int acpi_button_remove_fs(struct acpi_device *device) ...@@ -249,7 +245,7 @@ static int acpi_button_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -260,10 +256,9 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) ...@@ -260,10 +256,9 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
{ {
struct acpi_button *button = (struct acpi_button *)data; struct acpi_button *button = (struct acpi_button *)data;
ACPI_FUNCTION_TRACE("acpi_button_notify");
if (!button || !button->device) if (!button || !button->device)
return_VOID; return;
switch (event) { switch (event) {
case ACPI_BUTTON_NOTIFY_STATUS: case ACPI_BUTTON_NOTIFY_STATUS:
...@@ -276,21 +271,20 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) ...@@ -276,21 +271,20 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
break; break;
} }
return_VOID; return;
} }
static acpi_status acpi_button_notify_fixed(void *data) static acpi_status acpi_button_notify_fixed(void *data)
{ {
struct acpi_button *button = (struct acpi_button *)data; struct acpi_button *button = (struct acpi_button *)data;
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
if (!button) if (!button)
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
static int acpi_button_add(struct acpi_device *device) static int acpi_button_add(struct acpi_device *device)
...@@ -299,14 +293,13 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -299,14 +293,13 @@ static int acpi_button_add(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_button *button = NULL; struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL); button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL);
if (!button) if (!button)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(button, 0, sizeof(struct acpi_button)); memset(button, 0, sizeof(struct acpi_button));
button->device = device; button->device = device;
...@@ -400,7 +393,7 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -400,7 +393,7 @@ static int acpi_button_add(struct acpi_device *device)
kfree(button); kfree(button);
} }
return_VALUE(result); return result;
} }
static int acpi_button_remove(struct acpi_device *device, int type) static int acpi_button_remove(struct acpi_device *device, int type)
...@@ -408,10 +401,9 @@ static int acpi_button_remove(struct acpi_device *device, int type) ...@@ -408,10 +401,9 @@ static int acpi_button_remove(struct acpi_device *device, int type)
acpi_status status = 0; acpi_status status = 0;
struct acpi_button *button = NULL; struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
button = acpi_driver_data(device); button = acpi_driver_data(device);
...@@ -438,31 +430,29 @@ static int acpi_button_remove(struct acpi_device *device, int type) ...@@ -438,31 +430,29 @@ static int acpi_button_remove(struct acpi_device *device, int type)
kfree(button); kfree(button);
return_VALUE(0); return 0;
} }
static int __init acpi_button_init(void) static int __init acpi_button_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_button_init");
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
if (!acpi_button_dir) if (!acpi_button_dir)
return_VALUE(-ENODEV); return -ENODEV;
acpi_button_dir->owner = THIS_MODULE; acpi_button_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_button_driver); result = acpi_bus_register_driver(&acpi_button_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
static void __exit acpi_button_exit(void) static void __exit acpi_button_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_button_exit");
acpi_bus_unregister_driver(&acpi_button_driver); acpi_bus_unregister_driver(&acpi_button_driver);
...@@ -474,7 +464,7 @@ static void __exit acpi_button_exit(void) ...@@ -474,7 +464,7 @@ static void __exit acpi_button_exit(void)
remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VOID; return;
} }
module_init(acpi_button_init); module_init(acpi_button_init);
......
...@@ -73,17 +73,16 @@ static int is_device_present(acpi_handle handle) ...@@ -73,17 +73,16 @@ static int is_device_present(acpi_handle handle)
acpi_status status; acpi_status status;
unsigned long sta; unsigned long sta;
ACPI_FUNCTION_TRACE("is_device_present");
status = acpi_get_handle(handle, "_STA", &temp); status = acpi_get_handle(handle, "_STA", &temp);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(1); /* _STA not found, assmue device present */ return 1; /* _STA not found, assmue device present */
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(0); /* Firmware error */ return 0; /* Firmware error */
return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT); return ((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
} }
/*******************************************************************/ /*******************************************************************/
...@@ -91,16 +90,15 @@ static int acpi_container_add(struct acpi_device *device) ...@@ -91,16 +90,15 @@ static int acpi_container_add(struct acpi_device *device)
{ {
struct acpi_container *container; struct acpi_container *container;
ACPI_FUNCTION_TRACE("acpi_container_add");
if (!device) { if (!device) {
printk(KERN_ERR PREFIX "device is NULL\n"); printk(KERN_ERR PREFIX "device is NULL\n");
return_VALUE(-EINVAL); return -EINVAL;
} }
container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL); container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
if (!container) if (!container)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(container, 0, sizeof(struct acpi_container)); memset(container, 0, sizeof(struct acpi_container));
container->handle = device->handle; container->handle = device->handle;
...@@ -111,7 +109,7 @@ static int acpi_container_add(struct acpi_device *device) ...@@ -111,7 +109,7 @@ static int acpi_container_add(struct acpi_device *device)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",
acpi_device_name(device), acpi_device_bid(device))); acpi_device_name(device), acpi_device_bid(device)));
return_VALUE(0); return 0;
} }
static int acpi_container_remove(struct acpi_device *device, int type) static int acpi_container_remove(struct acpi_device *device, int type)
...@@ -130,23 +128,22 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle) ...@@ -130,23 +128,22 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle)
struct acpi_device *pdev; struct acpi_device *pdev;
int result; int result;
ACPI_FUNCTION_TRACE("container_device_add");
if (acpi_get_parent(handle, &phandle)) { if (acpi_get_parent(handle, &phandle)) {
return_VALUE(-ENODEV); return -ENODEV;
} }
if (acpi_bus_get_device(phandle, &pdev)) { if (acpi_bus_get_device(phandle, &pdev)) {
return_VALUE(-ENODEV); return -ENODEV;
} }
if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) { if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) {
return_VALUE(-ENODEV); return -ENODEV;
} }
result = acpi_bus_start(*device); result = acpi_bus_start(*device);
return_VALUE(result); return result;
} }
static void container_notify_cb(acpi_handle handle, u32 type, void *context) static void container_notify_cb(acpi_handle handle, u32 type, void *context)
...@@ -156,7 +153,6 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) ...@@ -156,7 +153,6 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
int present; int present;
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE("container_notify_cb");
present = is_device_present(handle); present = is_device_present(handle);
...@@ -192,7 +188,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) ...@@ -192,7 +188,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
default: default:
break; break;
} }
return_VOID; return;
} }
static acpi_status static acpi_status
...@@ -205,11 +201,10 @@ container_walk_namespace_cb(acpi_handle handle, ...@@ -205,11 +201,10 @@ container_walk_namespace_cb(acpi_handle handle,
acpi_status status; acpi_status status;
int *action = context; int *action = context;
ACPI_FUNCTION_TRACE("container_walk_namespace_cb");
status = acpi_get_object_info(handle, &buffer); status = acpi_get_object_info(handle, &buffer);
if (ACPI_FAILURE(status) || !buffer.pointer) { if (ACPI_FAILURE(status) || !buffer.pointer) {
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
info = buffer.pointer; info = buffer.pointer;
...@@ -243,7 +238,7 @@ container_walk_namespace_cb(acpi_handle handle, ...@@ -243,7 +238,7 @@ container_walk_namespace_cb(acpi_handle handle,
end: end:
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
static int __init acpi_container_init(void) static int __init acpi_container_init(void)
...@@ -269,7 +264,6 @@ static void __exit acpi_container_exit(void) ...@@ -269,7 +264,6 @@ static void __exit acpi_container_exit(void)
{ {
int action = UNINSTALL_NOTIFY_HANDLER; int action = UNINSTALL_NOTIFY_HANDLER;
ACPI_FUNCTION_TRACE("acpi_container_exit");
acpi_walk_namespace(ACPI_TYPE_DEVICE, acpi_walk_namespace(ACPI_TYPE_DEVICE,
ACPI_ROOT_OBJECT, ACPI_ROOT_OBJECT,
...@@ -278,7 +272,7 @@ static void __exit acpi_container_exit(void) ...@@ -278,7 +272,7 @@ static void __exit acpi_container_exit(void)
acpi_bus_unregister_driver(&acpi_container_driver); acpi_bus_unregister_driver(&acpi_container_driver);
return_VOID; return;
} }
module_init(acpi_container_init); module_init(acpi_container_init);
......
...@@ -155,13 +155,12 @@ acpi_system_write_debug(struct file *file, ...@@ -155,13 +155,12 @@ acpi_system_write_debug(struct file *file,
{ {
char debug_string[12] = { '\0' }; char debug_string[12] = { '\0' };
ACPI_FUNCTION_TRACE("acpi_system_write_debug");
if (count > sizeof(debug_string) - 1) if (count > sizeof(debug_string) - 1)
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(debug_string, buffer, count)) if (copy_from_user(debug_string, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
debug_string[count] = '\0'; debug_string[count] = '\0';
...@@ -173,10 +172,10 @@ acpi_system_write_debug(struct file *file, ...@@ -173,10 +172,10 @@ acpi_system_write_debug(struct file *file,
acpi_dbg_level = simple_strtoul(debug_string, NULL, 0); acpi_dbg_level = simple_strtoul(debug_string, NULL, 0);
break; break;
default: default:
return_VALUE(-EINVAL); return -EINVAL;
} }
return_VALUE(count); return count;
} }
static int __init acpi_debug_init(void) static int __init acpi_debug_init(void)
...@@ -185,10 +184,9 @@ static int __init acpi_debug_init(void) ...@@ -185,10 +184,9 @@ static int __init acpi_debug_init(void)
int error = 0; int error = 0;
char *name; char *name;
ACPI_FUNCTION_TRACE("acpi_debug_init");
if (acpi_disabled) if (acpi_disabled)
return_VALUE(0); return 0;
/* 'debug_layer' [R/W] */ /* 'debug_layer' [R/W] */
name = ACPI_SYSTEM_FILE_DEBUG_LAYER; name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
...@@ -213,7 +211,7 @@ static int __init acpi_debug_init(void) ...@@ -213,7 +211,7 @@ static int __init acpi_debug_init(void)
goto Error; goto Error;
Done: Done:
return_VALUE(error); return error;
Error: Error:
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir);
......
...@@ -207,7 +207,6 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) ...@@ -207,7 +207,6 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_ec_wait");
ec->intr.expect_event = event; ec->intr.expect_event = event;
smp_mb(); smp_mb();
...@@ -216,7 +215,7 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) ...@@ -216,7 +215,7 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event)
case ACPI_EC_EVENT_IBE: case ACPI_EC_EVENT_IBE:
if (~acpi_ec_read_status(ec) & event) { if (~acpi_ec_read_status(ec) & event) {
ec->intr.expect_event = 0; ec->intr.expect_event = 0;
return_VALUE(0); return 0;
} }
break; break;
default: default:
...@@ -238,16 +237,16 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) ...@@ -238,16 +237,16 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event)
switch (event) { switch (event) {
case ACPI_EC_EVENT_OBF: case ACPI_EC_EVENT_OBF:
if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF)
return_VALUE(0); return 0;
break; break;
case ACPI_EC_EVENT_IBE: case ACPI_EC_EVENT_IBE:
if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)
return_VALUE(0); return 0;
break; break;
} }
return_VALUE(-ETIME); return -ETIME;
} }
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
...@@ -260,7 +259,6 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) ...@@ -260,7 +259,6 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec)
u32 tmp = 0; u32 tmp = 0;
int status = 0; int status = 0;
ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode");
status = acpi_ec_read_status(ec); status = acpi_ec_read_status(ec);
if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) {
...@@ -272,22 +270,21 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) ...@@ -272,22 +270,21 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec)
status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);
if (tmp != 0x90) { /* Burst ACK byte */ if (tmp != 0x90) { /* Burst ACK byte */
return_VALUE(-EINVAL); return -EINVAL;
} }
} }
atomic_set(&ec->intr.leaving_burst, 0); atomic_set(&ec->intr.leaving_burst, 0);
return_VALUE(0); return 0;
end: end:
ACPI_EXCEPTION ((AE_INFO, status, "EC wait, burst mode"); ACPI_EXCEPTION ((AE_INFO, status, "EC wait, burst mode");
return_VALUE(-1); return -1;
} }
int acpi_ec_leave_burst_mode(union acpi_ec *ec) int acpi_ec_leave_burst_mode(union acpi_ec *ec)
{ {
int status = 0; int status = 0;
ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode");
status = acpi_ec_read_status(ec); status = acpi_ec_read_status(ec);
if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){
...@@ -298,10 +295,10 @@ int acpi_ec_leave_burst_mode(union acpi_ec *ec) ...@@ -298,10 +295,10 @@ int acpi_ec_leave_burst_mode(union acpi_ec *ec)
acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
} }
atomic_set(&ec->intr.leaving_burst, 1); atomic_set(&ec->intr.leaving_burst, 1);
return_VALUE(0); return 0;
end: end:
ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode"); ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode");
return_VALUE(-1); return -1;
} }
#endif /* ACPI_FUTURE_USAGE */ #endif /* ACPI_FUTURE_USAGE */
...@@ -325,17 +322,16 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) ...@@ -325,17 +322,16 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data)
int result = 0; int result = 0;
u32 glk = 0; u32 glk = 0;
ACPI_FUNCTION_TRACE("acpi_ec_read");
if (!ec || !data) if (!ec || !data)
return_VALUE(-EINVAL); return -EINVAL;
*data = 0; *data = 0;
if (ec->common.global_lock) { if (ec->common.global_lock) {
status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
} }
if (down_interruptible(&ec->poll.sem)) { if (down_interruptible(&ec->poll.sem)) {
...@@ -365,7 +361,7 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) ...@@ -365,7 +361,7 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data)
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
return_VALUE(result); return result;
} }
static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data)
...@@ -374,15 +370,14 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) ...@@ -374,15 +370,14 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data)
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 glk = 0; u32 glk = 0;
ACPI_FUNCTION_TRACE("acpi_ec_write");
if (!ec) if (!ec)
return_VALUE(-EINVAL); return -EINVAL;
if (ec->common.global_lock) { if (ec->common.global_lock) {
status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
} }
if (down_interruptible(&ec->poll.sem)) { if (down_interruptible(&ec->poll.sem)) {
...@@ -415,7 +410,7 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) ...@@ -415,7 +410,7 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data)
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
return_VALUE(result); return result;
} }
static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data)
...@@ -423,17 +418,16 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) ...@@ -423,17 +418,16 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data)
int status = 0; int status = 0;
u32 glk; u32 glk;
ACPI_FUNCTION_TRACE("acpi_ec_read");
if (!ec || !data) if (!ec || !data)
return_VALUE(-EINVAL); return -EINVAL;
*data = 0; *data = 0;
if (ec->common.global_lock) { if (ec->common.global_lock) {
status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
} }
WARN_ON(in_interrupt()); WARN_ON(in_interrupt());
...@@ -467,7 +461,7 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) ...@@ -467,7 +461,7 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data)
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
return_VALUE(status); return status;
} }
static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data)
...@@ -475,15 +469,14 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) ...@@ -475,15 +469,14 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data)
int status = 0; int status = 0;
u32 glk; u32 glk;
ACPI_FUNCTION_TRACE("acpi_ec_write");
if (!ec) if (!ec)
return_VALUE(-EINVAL); return -EINVAL;
if (ec->common.global_lock) { if (ec->common.global_lock) {
status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
} }
WARN_ON(in_interrupt()); WARN_ON(in_interrupt());
...@@ -516,7 +509,7 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) ...@@ -516,7 +509,7 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data)
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
return_VALUE(status); return status;
} }
/* /*
...@@ -574,17 +567,16 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) ...@@ -574,17 +567,16 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data)
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 glk = 0; u32 glk = 0;
ACPI_FUNCTION_TRACE("acpi_ec_query");
if (!ec || !data) if (!ec || !data)
return_VALUE(-EINVAL); return -EINVAL;
*data = 0; *data = 0;
if (ec->common.global_lock) { if (ec->common.global_lock) {
status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
} }
/* /*
...@@ -613,23 +605,22 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) ...@@ -613,23 +605,22 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data)
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
return_VALUE(result); return result;
} }
static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data)
{ {
int status = 0; int status = 0;
u32 glk; u32 glk;
ACPI_FUNCTION_TRACE("acpi_ec_query");
if (!ec || !data) if (!ec || !data)
return_VALUE(-EINVAL); return -EINVAL;
*data = 0; *data = 0;
if (ec->common.global_lock) { if (ec->common.global_lock) {
status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
} }
down(&ec->intr.sem); down(&ec->intr.sem);
...@@ -662,7 +653,7 @@ static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) ...@@ -662,7 +653,7 @@ static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data)
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
return_VALUE(status); return status;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -691,13 +682,12 @@ static void acpi_ec_gpe_poll_query(void *ec_cxt) ...@@ -691,13 +682,12 @@ static void acpi_ec_gpe_poll_query(void *ec_cxt)
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
}; };
ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
if (!ec_cxt) if (!ec_cxt)
goto end; goto end;
if (down_interruptible (&ec->poll.sem)) { if (down_interruptible (&ec->poll.sem)) {
return_VOID; return;
} }
acpi_hw_low_level_read(8, &value, &ec->common.command_addr); acpi_hw_low_level_read(8, &value, &ec->common.command_addr);
up(&ec->poll.sem); up(&ec->poll.sem);
...@@ -734,7 +724,6 @@ static void acpi_ec_gpe_intr_query(void *ec_cxt) ...@@ -734,7 +724,6 @@ static void acpi_ec_gpe_intr_query(void *ec_cxt)
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
}; };
ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI)
result = acpi_ec_query(ec, &value); result = acpi_ec_query(ec, &value);
...@@ -846,15 +835,14 @@ acpi_ec_space_handler(u32 function, ...@@ -846,15 +835,14 @@ acpi_ec_space_handler(u32 function,
acpi_integer f_v = 0; acpi_integer f_v = 0;
int i = 0; int i = 0;
ACPI_FUNCTION_TRACE("acpi_ec_space_handler");
if ((address > 0xFF) || !value || !handler_context) if ((address > 0xFF) || !value || !handler_context)
return_VALUE(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
if (bit_width != 8 && acpi_strict) { if (bit_width != 8 && acpi_strict) {
printk(KERN_WARNING PREFIX printk(KERN_WARNING PREFIX
"acpi_ec_space_handler: bit_width should be 8\n"); "acpi_ec_space_handler: bit_width should be 8\n");
return_VALUE(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
} }
ec = (union acpi_ec *)handler_context; ec = (union acpi_ec *)handler_context;
...@@ -893,16 +881,16 @@ acpi_ec_space_handler(u32 function, ...@@ -893,16 +881,16 @@ acpi_ec_space_handler(u32 function,
out: out:
switch (result) { switch (result) {
case -EINVAL: case -EINVAL:
return_VALUE(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
break; break;
case -ENODEV: case -ENODEV:
return_VALUE(AE_NOT_FOUND); return AE_NOT_FOUND;
break; break;
case -ETIME: case -ETIME:
return_VALUE(AE_TIME); return AE_TIME;
break; break;
default: default:
return_VALUE(AE_OK); return AE_OK;
} }
} }
...@@ -916,7 +904,6 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset) ...@@ -916,7 +904,6 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset)
{ {
union acpi_ec *ec = (union acpi_ec *)seq->private; union acpi_ec *ec = (union acpi_ec *)seq->private;
ACPI_FUNCTION_TRACE("acpi_ec_read_info");
if (!ec) if (!ec)
goto end; goto end;
...@@ -931,7 +918,7 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset) ...@@ -931,7 +918,7 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset)
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
end: end:
return_VALUE(0); return 0;
} }
static int acpi_ec_info_open_fs(struct inode *inode, struct file *file) static int acpi_ec_info_open_fs(struct inode *inode, struct file *file)
...@@ -951,31 +938,29 @@ static int acpi_ec_add_fs(struct acpi_device *device) ...@@ -951,31 +938,29 @@ static int acpi_ec_add_fs(struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_ec_add_fs");
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_ec_dir); acpi_ec_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
} }
entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_ec_info_ops; entry->proc_fops = &acpi_ec_info_ops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VALUE(0); return 0;
} }
static int acpi_ec_remove_fs(struct acpi_device *device) static int acpi_ec_remove_fs(struct acpi_device *device)
{ {
ACPI_FUNCTION_TRACE("acpi_ec_remove_fs");
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device)); remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device));
...@@ -983,7 +968,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device) ...@@ -983,7 +968,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -996,14 +981,13 @@ static int acpi_ec_poll_add(struct acpi_device *device) ...@@ -996,14 +981,13 @@ static int acpi_ec_poll_add(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
union acpi_ec *ec = NULL; union acpi_ec *ec = NULL;
ACPI_FUNCTION_TRACE("acpi_ec_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);
if (!ec) if (!ec)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(ec, 0, sizeof(union acpi_ec)); memset(ec, 0, sizeof(union acpi_ec));
ec->common.handle = device->handle; ec->common.handle = device->handle;
...@@ -1056,7 +1040,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) ...@@ -1056,7 +1040,7 @@ static int acpi_ec_poll_add(struct acpi_device *device)
if (result) if (result)
kfree(ec); kfree(ec);
return_VALUE(result); return result;
} }
static int acpi_ec_intr_add(struct acpi_device *device) static int acpi_ec_intr_add(struct acpi_device *device)
{ {
...@@ -1064,14 +1048,13 @@ static int acpi_ec_intr_add(struct acpi_device *device) ...@@ -1064,14 +1048,13 @@ static int acpi_ec_intr_add(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
union acpi_ec *ec = NULL; union acpi_ec *ec = NULL;
ACPI_FUNCTION_TRACE("acpi_ec_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL);
if (!ec) if (!ec)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(ec, 0, sizeof(union acpi_ec)); memset(ec, 0, sizeof(union acpi_ec));
ec->common.handle = device->handle; ec->common.handle = device->handle;
...@@ -1127,17 +1110,16 @@ static int acpi_ec_intr_add(struct acpi_device *device) ...@@ -1127,17 +1110,16 @@ static int acpi_ec_intr_add(struct acpi_device *device)
if (result) if (result)
kfree(ec); kfree(ec);
return_VALUE(result); return result;
} }
static int acpi_ec_remove(struct acpi_device *device, int type) static int acpi_ec_remove(struct acpi_device *device, int type)
{ {
union acpi_ec *ec = NULL; union acpi_ec *ec = NULL;
ACPI_FUNCTION_TRACE("acpi_ec_remove");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
ec = acpi_driver_data(device); ec = acpi_driver_data(device);
...@@ -1145,7 +1127,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type) ...@@ -1145,7 +1127,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
kfree(ec); kfree(ec);
return_VALUE(0); return 0;
} }
static acpi_status static acpi_status
...@@ -1184,15 +1166,14 @@ static int acpi_ec_start(struct acpi_device *device) ...@@ -1184,15 +1166,14 @@ static int acpi_ec_start(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
union acpi_ec *ec = NULL; union acpi_ec *ec = NULL;
ACPI_FUNCTION_TRACE("acpi_ec_start");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
ec = acpi_driver_data(device); ec = acpi_driver_data(device);
if (!ec) if (!ec)
return_VALUE(-EINVAL); return -EINVAL;
/* /*
* Get I/O port addresses. Convert to GAS format. * Get I/O port addresses. Convert to GAS format.
...@@ -1202,7 +1183,7 @@ static int acpi_ec_start(struct acpi_device *device) ...@@ -1202,7 +1183,7 @@ static int acpi_ec_start(struct acpi_device *device)
if (ACPI_FAILURE(status) if (ACPI_FAILURE(status)
|| ec->common.command_addr.register_bit_width == 0) { || ec->common.command_addr.register_bit_width == 0) {
printk(KERN_ERR PREFIX "Error getting I/O port addresses\n"); printk(KERN_ERR PREFIX "Error getting I/O port addresses\n");
return_VALUE(-ENODEV); return -ENODEV;
} }
ec->common.status_addr = ec->common.command_addr; ec->common.status_addr = ec->common.command_addr;
...@@ -1219,7 +1200,7 @@ static int acpi_ec_start(struct acpi_device *device) ...@@ -1219,7 +1200,7 @@ static int acpi_ec_start(struct acpi_device *device)
ACPI_GPE_EDGE_TRIGGERED, ACPI_GPE_EDGE_TRIGGERED,
&acpi_ec_gpe_handler, ec); &acpi_ec_gpe_handler, ec);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_VALUE(-ENODEV); return -ENODEV;
} }
acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
...@@ -1231,10 +1212,10 @@ static int acpi_ec_start(struct acpi_device *device) ...@@ -1231,10 +1212,10 @@ static int acpi_ec_start(struct acpi_device *device)
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, acpi_remove_gpe_handler(NULL, ec->common.gpe_bit,
&acpi_ec_gpe_handler); &acpi_ec_gpe_handler);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(AE_OK); return AE_OK;
} }
static int acpi_ec_stop(struct acpi_device *device, int type) static int acpi_ec_stop(struct acpi_device *device, int type)
...@@ -1242,10 +1223,9 @@ static int acpi_ec_stop(struct acpi_device *device, int type) ...@@ -1242,10 +1223,9 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
acpi_status status = AE_OK; acpi_status status = AE_OK;
union acpi_ec *ec = NULL; union acpi_ec *ec = NULL;
ACPI_FUNCTION_TRACE("acpi_ec_stop");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
ec = acpi_driver_data(device); ec = acpi_driver_data(device);
...@@ -1253,15 +1233,15 @@ static int acpi_ec_stop(struct acpi_device *device, int type) ...@@ -1253,15 +1233,15 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
ACPI_ADR_SPACE_EC, ACPI_ADR_SPACE_EC,
&acpi_ec_space_handler); &acpi_ec_space_handler);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
status = status =
acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, acpi_remove_gpe_handler(NULL, ec->common.gpe_bit,
&acpi_ec_gpe_handler); &acpi_ec_gpe_handler);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
return_VALUE(0); return 0;
} }
static acpi_status __init static acpi_status __init
...@@ -1531,23 +1511,22 @@ static int __init acpi_ec_init(void) ...@@ -1531,23 +1511,22 @@ static int __init acpi_ec_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_ec_init");
if (acpi_disabled) if (acpi_disabled)
return_VALUE(0); return 0;
acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir);
if (!acpi_ec_dir) if (!acpi_ec_dir)
return_VALUE(-ENODEV); return -ENODEV;
/* Now register the driver for the EC */ /* Now register the driver for the EC */
result = acpi_bus_register_driver(&acpi_ec_driver); result = acpi_bus_register_driver(&acpi_ec_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(result); return result;
} }
subsys_initcall(acpi_ec_init); subsys_initcall(acpi_ec_init);
...@@ -1556,13 +1535,12 @@ subsys_initcall(acpi_ec_init); ...@@ -1556,13 +1535,12 @@ subsys_initcall(acpi_ec_init);
#if 0 #if 0
static void __exit acpi_ec_exit(void) static void __exit acpi_ec_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_ec_exit");
acpi_bus_unregister_driver(&acpi_ec_driver); acpi_bus_unregister_driver(&acpi_ec_driver);
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
return_VOID; return;
} }
#endif /* 0 */ #endif /* 0 */
......
...@@ -48,18 +48,17 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, ...@@ -48,18 +48,17 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
static int chars_remaining = 0; static int chars_remaining = 0;
static char *ptr; static char *ptr;
ACPI_FUNCTION_TRACE("acpi_system_read_event");
if (!chars_remaining) { if (!chars_remaining) {
memset(&event, 0, sizeof(struct acpi_bus_event)); memset(&event, 0, sizeof(struct acpi_bus_event));
if ((file->f_flags & O_NONBLOCK) if ((file->f_flags & O_NONBLOCK)
&& (list_empty(&acpi_bus_event_list))) && (list_empty(&acpi_bus_event_list)))
return_VALUE(-EAGAIN); return -EAGAIN;
result = acpi_bus_receive_event(&event); result = acpi_bus_receive_event(&event);
if (result) if (result)
return_VALUE(result); return result;
chars_remaining = sprintf(str, "%s %s %08x %08x\n", chars_remaining = sprintf(str, "%s %s %08x %08x\n",
event.device_class ? event. event.device_class ? event.
...@@ -75,13 +74,13 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, ...@@ -75,13 +74,13 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
} }
if (copy_to_user(buffer, ptr, count)) if (copy_to_user(buffer, ptr, count))
return_VALUE(-EFAULT); return -EFAULT;
*ppos += count; *ppos += count;
chars_remaining -= count; chars_remaining -= count;
ptr += count; ptr += count;
return_VALUE(count); return count;
} }
static int acpi_system_close_event(struct inode *inode, struct file *file) static int acpi_system_close_event(struct inode *inode, struct file *file)
...@@ -112,10 +111,9 @@ static int __init acpi_event_init(void) ...@@ -112,10 +111,9 @@ static int __init acpi_event_init(void)
struct proc_dir_entry *entry; struct proc_dir_entry *entry;
int error = 0; int error = 0;
ACPI_FUNCTION_TRACE("acpi_event_init");
if (acpi_disabled) if (acpi_disabled)
return_VALUE(0); return 0;
/* 'event' [R] */ /* 'event' [R] */
entry = create_proc_entry("event", S_IRUSR, acpi_root_dir); entry = create_proc_entry("event", S_IRUSR, acpi_root_dir);
...@@ -124,7 +122,7 @@ static int __init acpi_event_init(void) ...@@ -124,7 +122,7 @@ static int __init acpi_event_init(void)
else { else {
error = -ENODEV; error = -ENODEV;
} }
return_VALUE(error); return error;
} }
subsys_initcall(acpi_event_init); subsys_initcall(acpi_event_init);
...@@ -78,7 +78,6 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset) ...@@ -78,7 +78,6 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset)
struct acpi_fan *fan = seq->private; struct acpi_fan *fan = seq->private;
int state = 0; int state = 0;
ACPI_FUNCTION_TRACE("acpi_fan_read_state");
if (fan) { if (fan) {
if (acpi_bus_get_power(fan->handle, &state)) if (acpi_bus_get_power(fan->handle, &state))
...@@ -87,7 +86,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset) ...@@ -87,7 +86,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset)
seq_printf(seq, "status: %s\n", seq_printf(seq, "status: %s\n",
!state ? "on" : "off"); !state ? "on" : "off");
} }
return_VALUE(0); return 0;
} }
static int acpi_fan_state_open_fs(struct inode *inode, struct file *file) static int acpi_fan_state_open_fs(struct inode *inode, struct file *file)
...@@ -104,22 +103,21 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, ...@@ -104,22 +103,21 @@ acpi_fan_write_state(struct file *file, const char __user * buffer,
struct acpi_fan *fan = (struct acpi_fan *)m->private; struct acpi_fan *fan = (struct acpi_fan *)m->private;
char state_string[12] = { '\0' }; char state_string[12] = { '\0' };
ACPI_FUNCTION_TRACE("acpi_fan_write_state");
if (!fan || (count > sizeof(state_string) - 1)) if (!fan || (count > sizeof(state_string) - 1))
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(state_string, buffer, count)) if (copy_from_user(state_string, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
state_string[count] = '\0'; state_string[count] = '\0';
result = acpi_bus_set_power(fan->handle, result = acpi_bus_set_power(fan->handle,
simple_strtoul(state_string, NULL, 0)); simple_strtoul(state_string, NULL, 0));
if (result) if (result)
return_VALUE(result); return result;
return_VALUE(count); return count;
} }
static struct file_operations acpi_fan_state_ops = { static struct file_operations acpi_fan_state_ops = {
...@@ -135,16 +133,15 @@ static int acpi_fan_add_fs(struct acpi_device *device) ...@@ -135,16 +133,15 @@ static int acpi_fan_add_fs(struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_fan_add_fs");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_fan_dir); acpi_fan_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
} }
...@@ -153,19 +150,18 @@ static int acpi_fan_add_fs(struct acpi_device *device) ...@@ -153,19 +150,18 @@ static int acpi_fan_add_fs(struct acpi_device *device)
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_fan_state_ops; entry->proc_fops = &acpi_fan_state_ops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VALUE(0); return 0;
} }
static int acpi_fan_remove_fs(struct acpi_device *device) static int acpi_fan_remove_fs(struct acpi_device *device)
{ {
ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device)); remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device));
...@@ -173,7 +169,7 @@ static int acpi_fan_remove_fs(struct acpi_device *device) ...@@ -173,7 +169,7 @@ static int acpi_fan_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -186,14 +182,13 @@ static int acpi_fan_add(struct acpi_device *device) ...@@ -186,14 +182,13 @@ static int acpi_fan_add(struct acpi_device *device)
struct acpi_fan *fan = NULL; struct acpi_fan *fan = NULL;
int state = 0; int state = 0;
ACPI_FUNCTION_TRACE("acpi_fan_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL); fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL);
if (!fan) if (!fan)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(fan, 0, sizeof(struct acpi_fan)); memset(fan, 0, sizeof(struct acpi_fan));
fan->handle = device->handle; fan->handle = device->handle;
...@@ -223,17 +218,16 @@ static int acpi_fan_add(struct acpi_device *device) ...@@ -223,17 +218,16 @@ static int acpi_fan_add(struct acpi_device *device)
if (result) if (result)
kfree(fan); kfree(fan);
return_VALUE(result); return result;
} }
static int acpi_fan_remove(struct acpi_device *device, int type) static int acpi_fan_remove(struct acpi_device *device, int type)
{ {
struct acpi_fan *fan = NULL; struct acpi_fan *fan = NULL;
ACPI_FUNCTION_TRACE("acpi_fan_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
fan = (struct acpi_fan *)acpi_driver_data(device); fan = (struct acpi_fan *)acpi_driver_data(device);
...@@ -241,7 +235,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type) ...@@ -241,7 +235,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
kfree(fan); kfree(fan);
return_VALUE(0); return 0;
} }
static int acpi_fan_suspend(struct acpi_device *device, int state) static int acpi_fan_suspend(struct acpi_device *device, int state)
...@@ -280,31 +274,29 @@ static int __init acpi_fan_init(void) ...@@ -280,31 +274,29 @@ static int __init acpi_fan_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_fan_init");
acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
if (!acpi_fan_dir) if (!acpi_fan_dir)
return_VALUE(-ENODEV); return -ENODEV;
acpi_fan_dir->owner = THIS_MODULE; acpi_fan_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_fan_driver); result = acpi_bus_register_driver(&acpi_fan_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
static void __exit acpi_fan_exit(void) static void __exit acpi_fan_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_fan_exit");
acpi_bus_unregister_driver(&acpi_fan_driver); acpi_bus_unregister_driver(&acpi_fan_driver);
remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
return_VOID; return;
} }
module_init(acpi_fan_init); module_init(acpi_fan_init);
......
...@@ -231,11 +231,10 @@ struct list_head hotkey_entries; /* head of the list of hotkey_list */ ...@@ -231,11 +231,10 @@ struct list_head hotkey_entries; /* head of the list of hotkey_list */
static int hotkey_info_seq_show(struct seq_file *seq, void *offset) static int hotkey_info_seq_show(struct seq_file *seq, void *offset)
{ {
ACPI_FUNCTION_TRACE("hotkey_info_seq_show");
seq_printf(seq, "Hotkey generic driver ver: %s\n", HOTKEY_ACPI_VERSION); seq_printf(seq, "Hotkey generic driver ver: %s\n", HOTKEY_ACPI_VERSION);
return_VALUE(0); return 0;
} }
static int hotkey_info_open_fs(struct inode *inode, struct file *file) static int hotkey_info_open_fs(struct inode *inode, struct file *file)
...@@ -266,7 +265,6 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) ...@@ -266,7 +265,6 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset)
(struct acpi_polling_hotkey *)seq->private; (struct acpi_polling_hotkey *)seq->private;
char *buf; char *buf;
ACPI_FUNCTION_TRACE("hotkey_polling_seq_show");
if (poll_hotkey->poll_result) { if (poll_hotkey->poll_result) {
buf = format_result(poll_hotkey->poll_result); buf = format_result(poll_hotkey->poll_result);
...@@ -274,7 +272,7 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) ...@@ -274,7 +272,7 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset)
seq_printf(seq, "%s", buf); seq_printf(seq, "%s", buf);
kfree(buf); kfree(buf);
} }
return_VALUE(0); return 0;
} }
static int hotkey_polling_open_fs(struct inode *inode, struct file *file) static int hotkey_polling_open_fs(struct inode *inode, struct file *file)
...@@ -293,7 +291,6 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) ...@@ -293,7 +291,6 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list)
struct list_head *entries; struct list_head *entries;
int val = -1; int val = -1;
ACPI_FUNCTION_TRACE("hotkey_get_internal_event");
list_for_each(entries, list->entries) { list_for_each(entries, list->entries) {
union acpi_hotkey *key = union acpi_hotkey *key =
...@@ -305,7 +302,7 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) ...@@ -305,7 +302,7 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list)
} }
} }
return_VALUE(val); return val;
} }
static void static void
...@@ -314,15 +311,14 @@ acpi_hotkey_notify_handler(acpi_handle handle, u32 event, void *data) ...@@ -314,15 +311,14 @@ acpi_hotkey_notify_handler(acpi_handle handle, u32 event, void *data)
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
u32 internal_event; u32 internal_event;
ACPI_FUNCTION_TRACE("acpi_hotkey_notify_handler");
if (acpi_bus_get_device(handle, &device)) if (acpi_bus_get_device(handle, &device))
return_VOID; return;
internal_event = hotkey_get_internal_event(event, &global_hotkey_list); internal_event = hotkey_get_internal_event(event, &global_hotkey_list);
acpi_bus_generate_event(device, internal_event, 0); acpi_bus_generate_event(device, internal_event, 0);
return_VOID; return;
} }
/* Need to invent automatically hotkey add method */ /* Need to invent automatically hotkey add method */
...@@ -346,7 +342,6 @@ static int create_polling_proc(union acpi_hotkey *device) ...@@ -346,7 +342,6 @@ static int create_polling_proc(union acpi_hotkey *device)
char proc_name[80]; char proc_name[80];
mode_t mode; mode_t mode;
ACPI_FUNCTION_TRACE("create_polling_proc");
mode = S_IFREG | S_IRUGO | S_IWUGO; mode = S_IFREG | S_IRUGO | S_IWUGO;
sprintf(proc_name, "%d", device->link.hotkey_standard_num); sprintf(proc_name, "%d", device->link.hotkey_standard_num);
...@@ -356,7 +351,7 @@ static int create_polling_proc(union acpi_hotkey *device) ...@@ -356,7 +351,7 @@ static int create_polling_proc(union acpi_hotkey *device)
proc = create_proc_entry(proc_name, mode, hotkey_proc_dir); proc = create_proc_entry(proc_name, mode, hotkey_proc_dir);
if (!proc) { if (!proc) {
return_VALUE(-ENODEV); return -ENODEV;
} else { } else {
proc->proc_fops = &hotkey_polling_fops; proc->proc_fops = &hotkey_polling_fops;
proc->owner = THIS_MODULE; proc->owner = THIS_MODULE;
...@@ -365,7 +360,7 @@ static int create_polling_proc(union acpi_hotkey *device) ...@@ -365,7 +360,7 @@ static int create_polling_proc(union acpi_hotkey *device)
proc->gid = 0; proc->gid = 0;
device->poll_hotkey.proc = proc; device->poll_hotkey.proc = proc;
} }
return_VALUE(0); return 0;
} }
static int hotkey_add(union acpi_hotkey *device) static int hotkey_add(union acpi_hotkey *device)
...@@ -373,7 +368,6 @@ static int hotkey_add(union acpi_hotkey *device) ...@@ -373,7 +368,6 @@ static int hotkey_add(union acpi_hotkey *device)
int status = 0; int status = 0;
struct acpi_device *dev = NULL; struct acpi_device *dev = NULL;
ACPI_FUNCTION_TRACE("hotkey_add");
if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) { if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) {
acpi_bus_get_device(device->event_hotkey.bus_handle, &dev); acpi_bus_get_device(device->event_hotkey.bus_handle, &dev);
...@@ -388,14 +382,13 @@ static int hotkey_add(union acpi_hotkey *device) ...@@ -388,14 +382,13 @@ static int hotkey_add(union acpi_hotkey *device)
list_add_tail(&device->link.entries, global_hotkey_list.entries); list_add_tail(&device->link.entries, global_hotkey_list.entries);
return_VALUE(status); return status;
} }
static int hotkey_remove(union acpi_hotkey *device) static int hotkey_remove(union acpi_hotkey *device)
{ {
struct list_head *entries, *next; struct list_head *entries, *next;
ACPI_FUNCTION_TRACE("hotkey_remove");
list_for_each_safe(entries, next, global_hotkey_list.entries) { list_for_each_safe(entries, next, global_hotkey_list.entries) {
union acpi_hotkey *key = union acpi_hotkey *key =
...@@ -409,14 +402,13 @@ static int hotkey_remove(union acpi_hotkey *device) ...@@ -409,14 +402,13 @@ static int hotkey_remove(union acpi_hotkey *device)
} }
} }
kfree(device); kfree(device);
return_VALUE(0); return 0;
} }
static int hotkey_update(union acpi_hotkey *key) static int hotkey_update(union acpi_hotkey *key)
{ {
struct list_head *entries; struct list_head *entries;
ACPI_FUNCTION_TRACE("hotkey_update");
list_for_each(entries, global_hotkey_list.entries) { list_for_each(entries, global_hotkey_list.entries) {
union acpi_hotkey *tmp = union acpi_hotkey *tmp =
...@@ -458,19 +450,18 @@ static int hotkey_update(union acpi_hotkey *key) ...@@ -458,19 +450,18 @@ static int hotkey_update(union acpi_hotkey *key)
*/ */
kfree(key); kfree(key);
} }
return_VALUE(0); return 0;
break; break;
} }
} }
return_VALUE(-ENODEV); return -ENODEV;
} }
static void free_hotkey_device(union acpi_hotkey *key) static void free_hotkey_device(union acpi_hotkey *key)
{ {
struct acpi_device *dev; struct acpi_device *dev;
ACPI_FUNCTION_TRACE("free_hotkey_device");
if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) {
acpi_bus_get_device(key->event_hotkey.bus_handle, &dev); acpi_bus_get_device(key->event_hotkey.bus_handle, &dev);
...@@ -490,7 +481,7 @@ static void free_hotkey_device(union acpi_hotkey *key) ...@@ -490,7 +481,7 @@ static void free_hotkey_device(union acpi_hotkey *key)
free_poll_hotkey_buffer(key); free_poll_hotkey_buffer(key);
} }
kfree(key); kfree(key);
return_VOID; return;
} }
static void free_hotkey_buffer(union acpi_hotkey *key) static void free_hotkey_buffer(union acpi_hotkey *key)
...@@ -511,7 +502,6 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, ...@@ -511,7 +502,6 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
acpi_handle tmp_handle; acpi_handle tmp_handle;
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("init_hotkey_device");
if (std_num < 0 || IS_POLL(std_num) || !key) if (std_num < 0 || IS_POLL(std_num) || !key)
goto do_fail; goto do_fail;
...@@ -538,9 +528,9 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, ...@@ -538,9 +528,9 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
method, &tmp_handle); method, &tmp_handle);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
goto do_fail; goto do_fail;
return_VALUE(AE_OK); return AE_OK;
do_fail: do_fail:
return_VALUE(-ENODEV); return -ENODEV;
} }
static int static int
...@@ -552,7 +542,6 @@ init_poll_hotkey_device(union acpi_hotkey *key, ...@@ -552,7 +542,6 @@ init_poll_hotkey_device(union acpi_hotkey *key,
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_handle tmp_handle; acpi_handle tmp_handle;
ACPI_FUNCTION_TRACE("init_poll_hotkey_device");
if (std_num < 0 || IS_EVENT(std_num) || !key) if (std_num < 0 || IS_EVENT(std_num) || !key)
goto do_fail; goto do_fail;
...@@ -587,22 +576,20 @@ init_poll_hotkey_device(union acpi_hotkey *key, ...@@ -587,22 +576,20 @@ init_poll_hotkey_device(union acpi_hotkey *key,
(union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL);
if (!key->poll_hotkey.poll_result) if (!key->poll_hotkey.poll_result)
goto do_fail; goto do_fail;
return_VALUE(AE_OK); return AE_OK;
do_fail: do_fail:
return_VALUE(-ENODEV); return -ENODEV;
} }
static int hotkey_open_config(struct inode *inode, struct file *file) static int hotkey_open_config(struct inode *inode, struct file *file)
{ {
ACPI_FUNCTION_TRACE("hotkey_open_config"); return (single_open
return_VALUE(single_open
(file, hotkey_config_seq_show, PDE(inode)->data)); (file, hotkey_config_seq_show, PDE(inode)->data));
} }
static int hotkey_poll_open_config(struct inode *inode, struct file *file) static int hotkey_poll_open_config(struct inode *inode, struct file *file)
{ {
ACPI_FUNCTION_TRACE("hotkey_poll_open_config"); return (single_open
return_VALUE(single_open
(file, hotkey_poll_config_seq_show, PDE(inode)->data)); (file, hotkey_poll_config_seq_show, PDE(inode)->data));
} }
...@@ -615,7 +602,6 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset) ...@@ -615,7 +602,6 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset)
struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name };
struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name };
ACPI_FUNCTION_TRACE(("hotkey_config_seq_show"));
list_for_each(entries, hotkey_list->entries) { list_for_each(entries, hotkey_list->entries) {
union acpi_hotkey *key = union acpi_hotkey *key =
...@@ -633,7 +619,7 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset) ...@@ -633,7 +619,7 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset)
} }
} }
seq_puts(seq, "\n"); seq_puts(seq, "\n");
return_VALUE(0); return 0;
} }
static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset) static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset)
...@@ -645,7 +631,6 @@ static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset) ...@@ -645,7 +631,6 @@ static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset)
struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name };
struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name };
ACPI_FUNCTION_TRACE(("hotkey_config_seq_show"));
list_for_each(entries, hotkey_list->entries) { list_for_each(entries, hotkey_list->entries) {
union acpi_hotkey *key = union acpi_hotkey *key =
...@@ -663,7 +648,7 @@ static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset) ...@@ -663,7 +648,7 @@ static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset)
} }
} }
seq_puts(seq, "\n"); seq_puts(seq, "\n");
return_VALUE(0); return 0;
} }
static int static int
...@@ -675,7 +660,6 @@ get_parms(char *config_record, ...@@ -675,7 +660,6 @@ get_parms(char *config_record,
char **method, int *internal_event_num, int *external_event_num) char **method, int *internal_event_num, int *external_event_num)
{ {
char *tmp, *tmp1, count; char *tmp, *tmp1, count;
ACPI_FUNCTION_TRACE(("get_parms"));
sscanf(config_record, "%d", cmd); sscanf(config_record, "%d", cmd);
...@@ -741,9 +725,9 @@ get_parms(char *config_record, ...@@ -741,9 +725,9 @@ get_parms(char *config_record,
0) 0)
goto do_fail; goto do_fail;
return_VALUE(6); return 6;
do_fail: do_fail:
return_VALUE(-1); return -1;
} }
/* count is length for one input record */ /* count is length for one input record */
...@@ -760,16 +744,15 @@ static ssize_t hotkey_write_config(struct file *file, ...@@ -760,16 +744,15 @@ static ssize_t hotkey_write_config(struct file *file,
int ret = 0; int ret = 0;
union acpi_hotkey *key = NULL; union acpi_hotkey *key = NULL;
ACPI_FUNCTION_TRACE(("hotkey_write_config"));
config_record = (char *)kmalloc(count + 1, GFP_KERNEL); config_record = (char *)kmalloc(count + 1, GFP_KERNEL);
if (!config_record) if (!config_record)
return_VALUE(-ENOMEM); return -ENOMEM;
if (copy_from_user(config_record, buffer, count)) { if (copy_from_user(config_record, buffer, count)) {
kfree(config_record); kfree(config_record);
printk(KERN_ERR PREFIX "Invalid data\n"); printk(KERN_ERR PREFIX "Invalid data\n");
return_VALUE(-EINVAL); return -EINVAL;
} }
config_record[count] = 0; config_record[count] = 0;
...@@ -790,7 +773,7 @@ static ssize_t hotkey_write_config(struct file *file, ...@@ -790,7 +773,7 @@ static ssize_t hotkey_write_config(struct file *file,
kfree(action_handle); kfree(action_handle);
kfree(method); kfree(method);
printk(KERN_ERR PREFIX "Invalid data format ret=%d\n", ret); printk(KERN_ERR PREFIX "Invalid data format ret=%d\n", ret);
return_VALUE(-EINVAL); return -EINVAL;
} }
key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL);
...@@ -825,7 +808,7 @@ static ssize_t hotkey_write_config(struct file *file, ...@@ -825,7 +808,7 @@ static ssize_t hotkey_write_config(struct file *file,
free_poll_hotkey_buffer(key); free_poll_hotkey_buffer(key);
kfree(key); kfree(key);
printk(KERN_ERR PREFIX "Invalid hotkey\n"); printk(KERN_ERR PREFIX "Invalid hotkey\n");
return_VALUE(-EINVAL); return -EINVAL;
} }
cont_cmd: cont_cmd:
...@@ -851,7 +834,7 @@ static ssize_t hotkey_write_config(struct file *file, ...@@ -851,7 +834,7 @@ static ssize_t hotkey_write_config(struct file *file,
goto fail_out; goto fail_out;
break; break;
} }
return_VALUE(count); return count;
fail_out: fail_out:
if (IS_EVENT(internal_event_num)) if (IS_EVENT(internal_event_num))
free_hotkey_buffer(key); free_hotkey_buffer(key);
...@@ -859,7 +842,7 @@ static ssize_t hotkey_write_config(struct file *file, ...@@ -859,7 +842,7 @@ static ssize_t hotkey_write_config(struct file *file,
free_poll_hotkey_buffer(key); free_poll_hotkey_buffer(key);
kfree(key); kfree(key);
printk(KERN_ERR PREFIX "invalid key\n"); printk(KERN_ERR PREFIX "invalid key\n");
return_VALUE(-EINVAL); return -EINVAL;
} }
/* /*
...@@ -876,7 +859,6 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val, ...@@ -876,7 +859,6 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
union acpi_object in_obj; /* the only param we use */ union acpi_object in_obj; /* the only param we use */
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE("write_acpi_int");
params.count = 1; params.count = 1;
params.pointer = &in_obj; params.pointer = &in_obj;
in_obj.type = ACPI_TYPE_INTEGER; in_obj.type = ACPI_TYPE_INTEGER;
...@@ -884,7 +866,7 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val, ...@@ -884,7 +866,7 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
status = acpi_evaluate_object(handle, (char *)method, &params, output); status = acpi_evaluate_object(handle, (char *)method, &params, output);
return_VALUE(status == AE_OK); return (status == AE_OK);
} }
static int read_acpi_int(acpi_handle handle, const char *method, static int read_acpi_int(acpi_handle handle, const char *method,
...@@ -894,7 +876,6 @@ static int read_acpi_int(acpi_handle handle, const char *method, ...@@ -894,7 +876,6 @@ static int read_acpi_int(acpi_handle handle, const char *method,
union acpi_object out_obj; union acpi_object out_obj;
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE("read_acpi_int");
output.length = sizeof(out_obj); output.length = sizeof(out_obj);
output.pointer = &out_obj; output.pointer = &out_obj;
...@@ -904,7 +885,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, ...@@ -904,7 +885,7 @@ static int read_acpi_int(acpi_handle handle, const char *method,
val->type = out_obj.type; val->type = out_obj.type;
} else } else
printk(KERN_ERR PREFIX "null val pointer\n"); printk(KERN_ERR PREFIX "null val pointer\n");
return_VALUE((status == AE_OK) return ((status == AE_OK)
&& (out_obj.type == ACPI_TYPE_INTEGER)); && (out_obj.type == ACPI_TYPE_INTEGER));
} }
...@@ -941,24 +922,23 @@ static ssize_t hotkey_execute_aml_method(struct file *file, ...@@ -941,24 +922,23 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
int event, method_type, type, value; int event, method_type, type, value;
union acpi_hotkey *key; union acpi_hotkey *key;
ACPI_FUNCTION_TRACE("hotkey_execte_aml_method");
arg = (char *)kmalloc(count + 1, GFP_KERNEL); arg = (char *)kmalloc(count + 1, GFP_KERNEL);
if (!arg) if (!arg)
return_VALUE(-ENOMEM); return -ENOMEM;
arg[count] = 0; arg[count] = 0;
if (copy_from_user(arg, buffer, count)) { if (copy_from_user(arg, buffer, count)) {
kfree(arg); kfree(arg);
printk(KERN_ERR PREFIX "Invalid argument 2\n"); printk(KERN_ERR PREFIX "Invalid argument 2\n");
return_VALUE(-EINVAL); return -EINVAL;
} }
if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) !=
4) { 4) {
kfree(arg); kfree(arg);
printk(KERN_ERR PREFIX "Invalid argument 3\n"); printk(KERN_ERR PREFIX "Invalid argument 3\n");
return_VALUE(-EINVAL); return -EINVAL;
} }
kfree(arg); kfree(arg);
if (type == ACPI_TYPE_INTEGER) { if (type == ACPI_TYPE_INTEGER) {
...@@ -984,11 +964,11 @@ static ssize_t hotkey_execute_aml_method(struct file *file, ...@@ -984,11 +964,11 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
} }
} else { } else {
printk(KERN_WARNING "Not supported\n"); printk(KERN_WARNING "Not supported\n");
return_VALUE(-EINVAL); return -EINVAL;
} }
return_VALUE(count); return count;
do_fail: do_fail:
return_VALUE(-EINVAL); return -EINVAL;
} }
...@@ -997,7 +977,6 @@ static int __init hotkey_init(void) ...@@ -997,7 +977,6 @@ static int __init hotkey_init(void)
int result; int result;
mode_t mode = S_IFREG | S_IRUGO | S_IWUGO; mode_t mode = S_IFREG | S_IRUGO | S_IWUGO;
ACPI_FUNCTION_TRACE("hotkey_init");
if (acpi_disabled) if (acpi_disabled)
return -ENODEV; return -ENODEV;
...@@ -1084,7 +1063,6 @@ static void __exit hotkey_exit(void) ...@@ -1084,7 +1063,6 @@ static void __exit hotkey_exit(void)
{ {
struct list_head *entries, *next; struct list_head *entries, *next;
ACPI_FUNCTION_TRACE("hotkey_exit");
list_for_each_safe(entries, next, global_hotkey_list.entries) { list_for_each_safe(entries, next, global_hotkey_list.entries) {
union acpi_hotkey *key = union acpi_hotkey *key =
......
...@@ -52,13 +52,12 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) ...@@ -52,13 +52,12 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
{ {
struct resource *requested_res = NULL; struct resource *requested_res = NULL;
ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges");
if (res->type == ACPI_RESOURCE_TYPE_IO) { if (res->type == ACPI_RESOURCE_TYPE_IO) {
struct acpi_resource_io *io_res = &res->data.io; struct acpi_resource_io *io_res = &res->data.io;
if (io_res->minimum != io_res->maximum) if (io_res->minimum != io_res->maximum)
return_VALUE(AE_OK); return AE_OK;
if (IS_RESERVED_ADDR if (IS_RESERVED_ADDR
(io_res->minimum, io_res->address_length)) { (io_res->minimum, io_res->address_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
...@@ -92,7 +91,7 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) ...@@ -92,7 +91,7 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
if (requested_res) if (requested_res)
requested_res->flags &= ~IORESOURCE_BUSY; requested_res->flags &= ~IORESOURCE_BUSY;
return_VALUE(AE_OK); return AE_OK;
} }
static int acpi_motherboard_add(struct acpi_device *device) static int acpi_motherboard_add(struct acpi_device *device)
......
...@@ -587,19 +587,18 @@ static void acpi_os_execute_deferred(void *context) ...@@ -587,19 +587,18 @@ static void acpi_os_execute_deferred(void *context)
{ {
struct acpi_os_dpc *dpc = NULL; struct acpi_os_dpc *dpc = NULL;
ACPI_FUNCTION_TRACE("os_execute_deferred");
dpc = (struct acpi_os_dpc *)context; dpc = (struct acpi_os_dpc *)context;
if (!dpc) { if (!dpc) {
printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
return_VOID; return;
} }
dpc->function(dpc->context); dpc->function(dpc->context);
kfree(dpc); kfree(dpc);
return_VOID; return;
} }
static int acpi_os_execute_thread(void *context) static int acpi_os_execute_thread(void *context)
...@@ -693,7 +692,6 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle) ...@@ -693,7 +692,6 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle)
{ {
spinlock_t *lock_ptr; spinlock_t *lock_ptr;
ACPI_FUNCTION_TRACE("os_create_lock");
lock_ptr = acpi_os_allocate(sizeof(spinlock_t)); lock_ptr = acpi_os_allocate(sizeof(spinlock_t));
...@@ -703,7 +701,7 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle) ...@@ -703,7 +701,7 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle)
*out_handle = lock_ptr; *out_handle = lock_ptr;
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
/* /*
...@@ -711,13 +709,12 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle) ...@@ -711,13 +709,12 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle)
*/ */
void acpi_os_delete_lock(acpi_handle handle) void acpi_os_delete_lock(acpi_handle handle)
{ {
ACPI_FUNCTION_TRACE("os_create_lock");
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle)); ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle));
acpi_os_free(handle); acpi_os_free(handle);
return_VOID; return;
} }
acpi_status acpi_status
...@@ -725,11 +722,10 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) ...@@ -725,11 +722,10 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
{ {
struct semaphore *sem = NULL; struct semaphore *sem = NULL;
ACPI_FUNCTION_TRACE("os_create_semaphore");
sem = acpi_os_allocate(sizeof(struct semaphore)); sem = acpi_os_allocate(sizeof(struct semaphore));
if (!sem) if (!sem)
return_ACPI_STATUS(AE_NO_MEMORY); return AE_NO_MEMORY;
memset(sem, 0, sizeof(struct semaphore)); memset(sem, 0, sizeof(struct semaphore));
sema_init(sem, initial_units); sema_init(sem, initial_units);
...@@ -739,7 +735,7 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) ...@@ -739,7 +735,7 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n",
*handle, initial_units)); *handle, initial_units));
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
EXPORT_SYMBOL(acpi_os_create_semaphore); EXPORT_SYMBOL(acpi_os_create_semaphore);
...@@ -755,17 +751,16 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle) ...@@ -755,17 +751,16 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle)
{ {
struct semaphore *sem = (struct semaphore *)handle; struct semaphore *sem = (struct semaphore *)handle;
ACPI_FUNCTION_TRACE("os_delete_semaphore");
if (!sem) if (!sem)
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
acpi_os_free(sem); acpi_os_free(sem);
sem = NULL; sem = NULL;
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
EXPORT_SYMBOL(acpi_os_delete_semaphore); EXPORT_SYMBOL(acpi_os_delete_semaphore);
...@@ -785,13 +780,12 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) ...@@ -785,13 +780,12 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
struct semaphore *sem = (struct semaphore *)handle; struct semaphore *sem = (struct semaphore *)handle;
int ret = 0; int ret = 0;
ACPI_FUNCTION_TRACE("os_wait_semaphore");
if (!sem || (units < 1)) if (!sem || (units < 1))
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
if (units > 1) if (units > 1)
return_ACPI_STATUS(AE_SUPPORT); return AE_SUPPORT;
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
handle, units, timeout)); handle, units, timeout));
...@@ -850,7 +844,7 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) ...@@ -850,7 +844,7 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
units, timeout)); units, timeout));
} }
return_ACPI_STATUS(status); return status;
} }
EXPORT_SYMBOL(acpi_os_wait_semaphore); EXPORT_SYMBOL(acpi_os_wait_semaphore);
...@@ -862,20 +856,19 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) ...@@ -862,20 +856,19 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
{ {
struct semaphore *sem = (struct semaphore *)handle; struct semaphore *sem = (struct semaphore *)handle;
ACPI_FUNCTION_TRACE("os_signal_semaphore");
if (!sem || (units < 1)) if (!sem || (units < 1))
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
if (units > 1) if (units > 1)
return_ACPI_STATUS(AE_SUPPORT); return AE_SUPPORT;
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle,
units)); units));
up(sem); up(sem);
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
EXPORT_SYMBOL(acpi_os_signal_semaphore); EXPORT_SYMBOL(acpi_os_signal_semaphore);
......
...@@ -47,11 +47,10 @@ struct acpi_pci_data { ...@@ -47,11 +47,10 @@ struct acpi_pci_data {
static void acpi_pci_data_handler(acpi_handle handle, u32 function, static void acpi_pci_data_handler(acpi_handle handle, u32 function,
void *context) void *context)
{ {
ACPI_FUNCTION_TRACE("acpi_pci_data_handler");
/* TBD: Anything we need to do here? */ /* TBD: Anything we need to do here? */
return_VOID; return;
} }
/** /**
...@@ -68,17 +67,16 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) ...@@ -68,17 +67,16 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
struct acpi_pci_data *data = NULL; struct acpi_pci_data *data = NULL;
ACPI_FUNCTION_TRACE("acpi_get_pci_id");
if (!id) if (!id)
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
result = acpi_bus_get_device(handle, &device); result = acpi_bus_get_device(handle, &device);
if (result) { if (result) {
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Invalid ACPI Bus context for device %s\n", "Invalid ACPI Bus context for device %s\n",
acpi_device_bid(device)); acpi_device_bid(device));
return_ACPI_STATUS(AE_NOT_EXIST); return AE_NOT_EXIST;
} }
status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data); status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data);
...@@ -86,7 +84,7 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) ...@@ -86,7 +84,7 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
"Invalid ACPI-PCI context for device %s", "Invalid ACPI-PCI context for device %s",
acpi_device_bid(device))); acpi_device_bid(device)));
return_ACPI_STATUS(status); return status;
} }
*id = data->id; *id = data->id;
...@@ -103,7 +101,7 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) ...@@ -103,7 +101,7 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
acpi_device_bid(device), id->segment, id->bus, acpi_device_bid(device), id->segment, id->bus,
id->device, id->function)); id->device, id->function));
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
EXPORT_SYMBOL(acpi_get_pci_id); EXPORT_SYMBOL(acpi_get_pci_id);
...@@ -120,14 +118,13 @@ int acpi_pci_bind(struct acpi_device *device) ...@@ -120,14 +118,13 @@ int acpi_pci_bind(struct acpi_device *device)
struct pci_dev *dev; struct pci_dev *dev;
struct pci_bus *bus; struct pci_bus *bus;
ACPI_FUNCTION_TRACE("acpi_pci_bind");
if (!device || !device->parent) if (!device || !device->parent)
return_VALUE(-EINVAL); return -EINVAL;
pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
if (!pathname) if (!pathname)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(pathname, 0, ACPI_PATHNAME_MAX); memset(pathname, 0, ACPI_PATHNAME_MAX);
buffer.length = ACPI_PATHNAME_MAX; buffer.length = ACPI_PATHNAME_MAX;
buffer.pointer = pathname; buffer.pointer = pathname;
...@@ -135,7 +132,7 @@ int acpi_pci_bind(struct acpi_device *device) ...@@ -135,7 +132,7 @@ int acpi_pci_bind(struct acpi_device *device)
data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
if (!data) { if (!data) {
kfree(pathname); kfree(pathname);
return_VALUE(-ENOMEM); return -ENOMEM;
} }
memset(data, 0, sizeof(struct acpi_pci_data)); memset(data, 0, sizeof(struct acpi_pci_data));
...@@ -269,7 +266,7 @@ int acpi_pci_bind(struct acpi_device *device) ...@@ -269,7 +266,7 @@ int acpi_pci_bind(struct acpi_device *device)
if (result) if (result)
kfree(data); kfree(data);
return_VALUE(result); return result;
} }
int acpi_pci_unbind(struct acpi_device *device) int acpi_pci_unbind(struct acpi_device *device)
...@@ -280,14 +277,13 @@ int acpi_pci_unbind(struct acpi_device *device) ...@@ -280,14 +277,13 @@ int acpi_pci_unbind(struct acpi_device *device)
char *pathname = NULL; char *pathname = NULL;
struct acpi_buffer buffer = { 0, NULL }; struct acpi_buffer buffer = { 0, NULL };
ACPI_FUNCTION_TRACE("acpi_pci_unbind");
if (!device || !device->parent) if (!device || !device->parent)
return_VALUE(-EINVAL); return -EINVAL;
pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
if (!pathname) if (!pathname)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(pathname, 0, ACPI_PATHNAME_MAX); memset(pathname, 0, ACPI_PATHNAME_MAX);
buffer.length = ACPI_PATHNAME_MAX; buffer.length = ACPI_PATHNAME_MAX;
...@@ -322,7 +318,7 @@ int acpi_pci_unbind(struct acpi_device *device) ...@@ -322,7 +318,7 @@ int acpi_pci_unbind(struct acpi_device *device)
kfree(data); kfree(data);
end: end:
return_VALUE(result); return result;
} }
int int
...@@ -335,11 +331,10 @@ acpi_pci_bind_root(struct acpi_device *device, ...@@ -335,11 +331,10 @@ acpi_pci_bind_root(struct acpi_device *device,
char *pathname = NULL; char *pathname = NULL;
struct acpi_buffer buffer = { 0, NULL }; struct acpi_buffer buffer = { 0, NULL };
ACPI_FUNCTION_TRACE("acpi_pci_bind_root");
pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
if (!pathname) if (!pathname)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(pathname, 0, ACPI_PATHNAME_MAX); memset(pathname, 0, ACPI_PATHNAME_MAX);
buffer.length = ACPI_PATHNAME_MAX; buffer.length = ACPI_PATHNAME_MAX;
...@@ -347,13 +342,13 @@ acpi_pci_bind_root(struct acpi_device *device, ...@@ -347,13 +342,13 @@ acpi_pci_bind_root(struct acpi_device *device,
if (!device || !id || !bus) { if (!device || !id || !bus) {
kfree(pathname); kfree(pathname);
return_VALUE(-EINVAL); return -EINVAL;
} }
data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
if (!data) { if (!data) {
kfree(pathname); kfree(pathname);
return_VALUE(-ENOMEM); return -ENOMEM;
} }
memset(data, 0, sizeof(struct acpi_pci_data)); memset(data, 0, sizeof(struct acpi_pci_data));
...@@ -381,5 +376,5 @@ acpi_pci_bind_root(struct acpi_device *device, ...@@ -381,5 +376,5 @@ acpi_pci_bind_root(struct acpi_device *device,
if (result != 0) if (result != 0)
kfree(data); kfree(data);
return_VALUE(result); return result;
} }
...@@ -55,10 +55,9 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, ...@@ -55,10 +55,9 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
struct list_head *node = NULL; struct list_head *node = NULL;
struct acpi_prt_entry *entry = NULL; struct acpi_prt_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry");
if (!acpi_prt.count) if (!acpi_prt.count)
return_PTR(NULL); return NULL;
/* /*
* Parse through all PRT entries looking for a match on the specified * Parse through all PRT entries looking for a match on the specified
...@@ -73,12 +72,12 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, ...@@ -73,12 +72,12 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
&& (device == entry->id.device) && (device == entry->id.device)
&& (pin == entry->pin)) { && (pin == entry->pin)) {
spin_unlock(&acpi_prt_lock); spin_unlock(&acpi_prt_lock);
return_PTR(entry); return entry;
} }
} }
spin_unlock(&acpi_prt_lock); spin_unlock(&acpi_prt_lock);
return_PTR(NULL); return NULL;
} }
static int static int
...@@ -87,14 +86,13 @@ acpi_pci_irq_add_entry(acpi_handle handle, ...@@ -87,14 +86,13 @@ acpi_pci_irq_add_entry(acpi_handle handle,
{ {
struct acpi_prt_entry *entry = NULL; struct acpi_prt_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_pci_irq_add_entry");
if (!prt) if (!prt)
return_VALUE(-EINVAL); return -EINVAL;
entry = kmalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL); entry = kmalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL);
if (!entry) if (!entry)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(entry, 0, sizeof(struct acpi_prt_entry)); memset(entry, 0, sizeof(struct acpi_prt_entry));
entry->id.segment = segment; entry->id.segment = segment;
...@@ -141,7 +139,7 @@ acpi_pci_irq_add_entry(acpi_handle handle, ...@@ -141,7 +139,7 @@ acpi_pci_irq_add_entry(acpi_handle handle,
acpi_prt.count++; acpi_prt.count++;
spin_unlock(&acpi_prt_lock); spin_unlock(&acpi_prt_lock);
return_VALUE(0); return 0;
} }
static void static void
...@@ -163,11 +161,10 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) ...@@ -163,11 +161,10 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
struct acpi_pci_routing_table *entry = NULL; struct acpi_pci_routing_table *entry = NULL;
static int first_time = 1; static int first_time = 1;
ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt");
pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
if (!pathname) if (!pathname)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(pathname, 0, ACPI_PATHNAME_MAX); memset(pathname, 0, ACPI_PATHNAME_MAX);
if (first_time) { if (first_time) {
...@@ -199,12 +196,12 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) ...@@ -199,12 +196,12 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
if (status != AE_BUFFER_OVERFLOW) { if (status != AE_BUFFER_OVERFLOW) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]",
acpi_format_exception(status))); acpi_format_exception(status)));
return_VALUE(-ENODEV); return -ENODEV;
} }
prt = kmalloc(buffer.length, GFP_KERNEL); prt = kmalloc(buffer.length, GFP_KERNEL);
if (!prt) { if (!prt) {
return_VALUE(-ENOMEM); return -ENOMEM;
} }
memset(prt, 0, buffer.length); memset(prt, 0, buffer.length);
buffer.pointer = prt; buffer.pointer = prt;
...@@ -214,7 +211,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) ...@@ -214,7 +211,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]",
acpi_format_exception(status))); acpi_format_exception(status)));
kfree(buffer.pointer); kfree(buffer.pointer);
return_VALUE(-ENODEV); return -ENODEV;
} }
entry = prt; entry = prt;
...@@ -227,7 +224,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) ...@@ -227,7 +224,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
kfree(prt); kfree(prt);
return_VALUE(0); return 0;
} }
void acpi_pci_irq_del_prt(int segment, int bus) void acpi_pci_irq_del_prt(int segment, int bus)
...@@ -262,7 +259,6 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, ...@@ -262,7 +259,6 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
{ {
int irq; int irq;
ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq");
if (entry->link.handle) { if (entry->link.handle) {
irq = acpi_pci_link_allocate_irq(entry->link.handle, irq = acpi_pci_link_allocate_irq(entry->link.handle,
...@@ -271,7 +267,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, ...@@ -271,7 +267,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
if (irq < 0) { if (irq < 0) {
printk(KERN_WARNING PREFIX printk(KERN_WARNING PREFIX
"Invalid IRQ link routing entry\n"); "Invalid IRQ link routing entry\n");
return_VALUE(-1); return -1;
} }
} else { } else {
irq = entry->link.index; irq = entry->link.index;
...@@ -280,7 +276,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, ...@@ -280,7 +276,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
} }
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq));
return_VALUE(irq); return irq;
} }
static int static int
...@@ -289,13 +285,12 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry, ...@@ -289,13 +285,12 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry,
{ {
int irq; int irq;
ACPI_FUNCTION_TRACE("acpi_pci_free_irq");
if (entry->link.handle) { if (entry->link.handle) {
irq = acpi_pci_link_free_irq(entry->link.handle); irq = acpi_pci_link_free_irq(entry->link.handle);
} else { } else {
irq = entry->link.index; irq = entry->link.index;
} }
return_VALUE(irq); return irq;
} }
/* /*
...@@ -315,7 +310,6 @@ acpi_pci_irq_lookup(struct pci_bus *bus, ...@@ -315,7 +310,6 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
int bus_nr = bus->number; int bus_nr = bus->number;
int ret; int ret;
ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup");
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Searching for PRT entry for %02x:%02x:%02x[%c]\n", "Searching for PRT entry for %02x:%02x:%02x[%c]\n",
...@@ -324,11 +318,11 @@ acpi_pci_irq_lookup(struct pci_bus *bus, ...@@ -324,11 +318,11 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
if (!entry) { if (!entry) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n"));
return_VALUE(-1); return -1;
} }
ret = func(entry, triggering, polarity, link); ret = func(entry, triggering, polarity, link);
return_VALUE(ret); return ret;
} }
/* /*
...@@ -346,10 +340,9 @@ acpi_pci_irq_derive(struct pci_dev *dev, ...@@ -346,10 +340,9 @@ acpi_pci_irq_derive(struct pci_dev *dev,
int irq = -1; int irq = -1;
u8 bridge_pin = 0; u8 bridge_pin = 0;
ACPI_FUNCTION_TRACE("acpi_pci_irq_derive");
if (!dev) if (!dev)
return_VALUE(-EINVAL); return -EINVAL;
/* /*
* Attempt to derive an IRQ for this device from a parent bridge's * Attempt to derive an IRQ for this device from a parent bridge's
...@@ -366,7 +359,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, ...@@ -366,7 +359,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"No interrupt pin configured for device %s\n", "No interrupt pin configured for device %s\n",
pci_name(bridge))); pci_name(bridge)));
return_VALUE(-1); return -1;
} }
/* Pin is from 0 to 3 */ /* Pin is from 0 to 3 */
bridge_pin--; bridge_pin--;
...@@ -381,13 +374,13 @@ acpi_pci_irq_derive(struct pci_dev *dev, ...@@ -381,13 +374,13 @@ acpi_pci_irq_derive(struct pci_dev *dev,
if (irq < 0) { if (irq < 0) {
printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n", printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n",
pci_name(dev)); pci_name(dev));
return_VALUE(-1); return -1;
} }
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n",
irq, pci_name(dev), pci_name(bridge))); irq, pci_name(dev), pci_name(bridge)));
return_VALUE(irq); return irq;
} }
/* /*
...@@ -405,23 +398,22 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -405,23 +398,22 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
char *link = NULL; char *link = NULL;
int rc; int rc;
ACPI_FUNCTION_TRACE("acpi_pci_irq_enable");
if (!dev) if (!dev)
return_VALUE(-EINVAL); return -EINVAL;
pin = dev->pin; pin = dev->pin;
if (!pin) { if (!pin) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"No interrupt pin configured for device %s\n", "No interrupt pin configured for device %s\n",
pci_name(dev))); pci_name(dev)));
return_VALUE(0); return 0;
} }
pin--; pin--;
if (!dev->bus) { if (!dev->bus) {
printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n"); printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n");
return_VALUE(-ENODEV); return -ENODEV;
} }
/* /*
...@@ -453,10 +445,10 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -453,10 +445,10 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
printk(" - using IRQ %d\n", dev->irq); printk(" - using IRQ %d\n", dev->irq);
acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE,
ACPI_ACTIVE_LOW); ACPI_ACTIVE_LOW);
return_VALUE(0); return 0;
} else { } else {
printk("\n"); printk("\n");
return_VALUE(0); return 0;
} }
} }
...@@ -464,7 +456,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -464,7 +456,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
if (rc < 0) { if (rc < 0) {
printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed "
"to register GSI\n", pci_name(dev), ('A' + pin)); "to register GSI\n", pci_name(dev), ('A' + pin));
return_VALUE(rc); return rc;
} }
dev->irq = rc; dev->irq = rc;
...@@ -478,7 +470,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -478,7 +470,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
(triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
(polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
return_VALUE(0); return 0;
} }
EXPORT_SYMBOL(acpi_pci_irq_enable); EXPORT_SYMBOL(acpi_pci_irq_enable);
...@@ -495,14 +487,13 @@ void acpi_pci_irq_disable(struct pci_dev *dev) ...@@ -495,14 +487,13 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
int triggering = ACPI_LEVEL_SENSITIVE; int triggering = ACPI_LEVEL_SENSITIVE;
int polarity = ACPI_ACTIVE_LOW; int polarity = ACPI_ACTIVE_LOW;
ACPI_FUNCTION_TRACE("acpi_pci_irq_disable");
if (!dev || !dev->bus) if (!dev || !dev->bus)
return_VOID; return;
pin = dev->pin; pin = dev->pin;
if (!pin) if (!pin)
return_VOID; return;
pin--; pin--;
/* /*
...@@ -520,7 +511,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) ...@@ -520,7 +511,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
&triggering, &polarity, NULL, &triggering, &polarity, NULL,
acpi_pci_free_irq); acpi_pci_free_irq);
if (gsi < 0) if (gsi < 0)
return_VOID; return;
/* /*
* TBD: It might be worth clearing dev->irq by magic constant * TBD: It might be worth clearing dev->irq by magic constant
...@@ -532,5 +523,5 @@ void acpi_pci_irq_disable(struct pci_dev *dev) ...@@ -532,5 +523,5 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
acpi_unregister_gsi(gsi); acpi_unregister_gsi(gsi);
return_VOID; return;
} }
...@@ -107,17 +107,16 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) ...@@ -107,17 +107,16 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
struct acpi_pci_link *link = (struct acpi_pci_link *)context; struct acpi_pci_link *link = (struct acpi_pci_link *)context;
u32 i = 0; u32 i = 0;
ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible");
switch (resource->type) { switch (resource->type) {
case ACPI_RESOURCE_TYPE_START_DEPENDENT: case ACPI_RESOURCE_TYPE_START_DEPENDENT:
return_ACPI_STATUS(AE_OK); return AE_OK;
case ACPI_RESOURCE_TYPE_IRQ: case ACPI_RESOURCE_TYPE_IRQ:
{ {
struct acpi_resource_irq *p = &resource->data.irq; struct acpi_resource_irq *p = &resource->data.irq;
if (!p || !p->interrupt_count) { if (!p || !p->interrupt_count) {
printk(KERN_WARNING PREFIX "Blank IRQ resource\n"); printk(KERN_WARNING PREFIX "Blank IRQ resource\n");
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
for (i = 0; for (i = 0;
(i < p->interrupt_count (i < p->interrupt_count
...@@ -142,7 +141,7 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) ...@@ -142,7 +141,7 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
if (!p || !p->interrupt_count) { if (!p || !p->interrupt_count) {
printk(KERN_WARNING PREFIX printk(KERN_WARNING PREFIX
"Blank EXT IRQ resource\n"); "Blank EXT IRQ resource\n");
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
for (i = 0; for (i = 0;
(i < p->interrupt_count (i < p->interrupt_count
...@@ -162,33 +161,32 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) ...@@ -162,33 +161,32 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
} }
default: default:
printk(KERN_ERR PREFIX "Resource is not an IRQ entry\n"); printk(KERN_ERR PREFIX "Resource is not an IRQ entry\n");
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
return_ACPI_STATUS(AE_CTRL_TERMINATE); return AE_CTRL_TERMINATE;
} }
static int acpi_pci_link_get_possible(struct acpi_pci_link *link) static int acpi_pci_link_get_possible(struct acpi_pci_link *link)
{ {
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE("acpi_pci_link_get_possible");
if (!link) if (!link)
return_VALUE(-EINVAL); return -EINVAL;
status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, status = acpi_walk_resources(link->handle, METHOD_NAME__PRS,
acpi_pci_link_check_possible, link); acpi_pci_link_check_possible, link);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS"));
return_VALUE(-ENODEV); return -ENODEV;
} }
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Found %d possible IRQs\n", "Found %d possible IRQs\n",
link->irq.possible_count)); link->irq.possible_count));
return_VALUE(0); return 0;
} }
static acpi_status static acpi_status
...@@ -196,7 +194,6 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) ...@@ -196,7 +194,6 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
{ {
int *irq = (int *)context; int *irq = (int *)context;
ACPI_FUNCTION_TRACE("acpi_pci_link_check_current");
switch (resource->type) { switch (resource->type) {
case ACPI_RESOURCE_TYPE_IRQ: case ACPI_RESOURCE_TYPE_IRQ:
...@@ -209,7 +206,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) ...@@ -209,7 +206,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Blank IRQ resource\n")); "Blank IRQ resource\n"));
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
*irq = p->interrupts[0]; *irq = p->interrupts[0];
break; break;
...@@ -225,7 +222,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) ...@@ -225,7 +222,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
*/ */
printk(KERN_WARNING PREFIX printk(KERN_WARNING PREFIX
"Blank EXT IRQ resource\n"); "Blank EXT IRQ resource\n");
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
*irq = p->interrupts[0]; *irq = p->interrupts[0];
break; break;
...@@ -234,9 +231,9 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) ...@@ -234,9 +231,9 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
default: default:
printk(KERN_ERR PREFIX "Resource %d isn't an IRQ\n", resource->type); printk(KERN_ERR PREFIX "Resource %d isn't an IRQ\n", resource->type);
case ACPI_RESOURCE_TYPE_END_TAG: case ACPI_RESOURCE_TYPE_END_TAG:
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
return_ACPI_STATUS(AE_CTRL_TERMINATE); return AE_CTRL_TERMINATE;
} }
/* /*
...@@ -252,10 +249,9 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) ...@@ -252,10 +249,9 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
acpi_status status = AE_OK; acpi_status status = AE_OK;
int irq = 0; int irq = 0;
ACPI_FUNCTION_TRACE("acpi_pci_link_get_current");
if (!link || !link->handle) if (!link || !link->handle)
return_VALUE(-EINVAL); return -EINVAL;
link->irq.active = 0; link->irq.active = 0;
...@@ -270,7 +266,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) ...@@ -270,7 +266,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
if (!link->device->status.enabled) { if (!link->device->status.enabled) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link disabled\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link disabled\n"));
return_VALUE(0); return 0;
} }
} }
...@@ -296,7 +292,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) ...@@ -296,7 +292,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active));
end: end:
return_VALUE(result); return result;
} }
static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
...@@ -309,14 +305,13 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) ...@@ -309,14 +305,13 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
} *resource; } *resource;
struct acpi_buffer buffer = { 0, NULL }; struct acpi_buffer buffer = { 0, NULL };
ACPI_FUNCTION_TRACE("acpi_pci_link_set");
if (!link || !irq) if (!link || !irq)
return_VALUE(-EINVAL); return -EINVAL;
resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC); resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC);
if (!resource) if (!resource)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(resource, 0, sizeof(*resource) + 1); memset(resource, 0, sizeof(*resource) + 1);
buffer.length = sizeof(*resource) + 1; buffer.length = sizeof(*resource) + 1;
...@@ -413,7 +408,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) ...@@ -413,7 +408,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
end: end:
kfree(resource); kfree(resource);
return_VALUE(result); return result;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -487,7 +482,6 @@ int __init acpi_irq_penalty_init(void) ...@@ -487,7 +482,6 @@ int __init acpi_irq_penalty_init(void)
struct acpi_pci_link *link = NULL; struct acpi_pci_link *link = NULL;
int i = 0; int i = 0;
ACPI_FUNCTION_TRACE("acpi_irq_penalty_init");
/* /*
* Update penalties to facilitate IRQ balancing. * Update penalties to facilitate IRQ balancing.
...@@ -524,7 +518,7 @@ int __init acpi_irq_penalty_init(void) ...@@ -524,7 +518,7 @@ int __init acpi_irq_penalty_init(void)
/* Add a penalty for the SCI */ /* Add a penalty for the SCI */
acpi_irq_penalty[acpi_fadt.sci_int] += PIRQ_PENALTY_PCI_USING; acpi_irq_penalty[acpi_fadt.sci_int] += PIRQ_PENALTY_PCI_USING;
return_VALUE(0); return 0;
} }
static int acpi_irq_balance; /* 0: static, 1: balance */ static int acpi_irq_balance; /* 0: static, 1: balance */
...@@ -534,13 +528,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) ...@@ -534,13 +528,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
int irq; int irq;
int i; int i;
ACPI_FUNCTION_TRACE("acpi_pci_link_allocate");
if (link->irq.initialized) { if (link->irq.initialized) {
if (link->refcnt == 0) if (link->refcnt == 0)
/* This means the link is disabled but initialized */ /* This means the link is disabled but initialized */
acpi_pci_link_set(link, link->irq.active); acpi_pci_link_set(link, link->irq.active);
return_VALUE(0); return 0;
} }
/* /*
...@@ -587,7 +580,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) ...@@ -587,7 +580,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
"Try pci=noacpi or acpi=off\n", "Try pci=noacpi or acpi=off\n",
acpi_device_name(link->device), acpi_device_name(link->device),
acpi_device_bid(link->device)); acpi_device_bid(link->device));
return_VALUE(-ENODEV); return -ENODEV;
} else { } else {
acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING;
printk(PREFIX "%s [%s] enabled at IRQ %d\n", printk(PREFIX "%s [%s] enabled at IRQ %d\n",
...@@ -597,7 +590,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) ...@@ -597,7 +590,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
link->irq.initialized = 1; link->irq.initialized = 1;
return_VALUE(0); return 0;
} }
/* /*
...@@ -615,36 +608,35 @@ acpi_pci_link_allocate_irq(acpi_handle handle, ...@@ -615,36 +608,35 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
struct acpi_pci_link *link = NULL; struct acpi_pci_link *link = NULL;
ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq");
result = acpi_bus_get_device(handle, &device); result = acpi_bus_get_device(handle, &device);
if (result) { if (result) {
printk(KERN_ERR PREFIX "Invalid link device\n"); printk(KERN_ERR PREFIX "Invalid link device\n");
return_VALUE(-1); return -1;
} }
link = (struct acpi_pci_link *)acpi_driver_data(device); link = (struct acpi_pci_link *)acpi_driver_data(device);
if (!link) { if (!link) {
printk(KERN_ERR PREFIX "Invalid link context\n"); printk(KERN_ERR PREFIX "Invalid link context\n");
return_VALUE(-1); return -1;
} }
/* TBD: Support multiple index (IRQ) entries per Link Device */ /* TBD: Support multiple index (IRQ) entries per Link Device */
if (index) { if (index) {
printk(KERN_ERR PREFIX "Invalid index %d\n", index); printk(KERN_ERR PREFIX "Invalid index %d\n", index);
return_VALUE(-1); return -1;
} }
mutex_lock(&acpi_link_lock); mutex_lock(&acpi_link_lock);
if (acpi_pci_link_allocate(link)) { if (acpi_pci_link_allocate(link)) {
mutex_unlock(&acpi_link_lock); mutex_unlock(&acpi_link_lock);
return_VALUE(-1); return -1;
} }
if (!link->irq.active) { if (!link->irq.active) {
mutex_unlock(&acpi_link_lock); mutex_unlock(&acpi_link_lock);
printk(KERN_ERR PREFIX "Link active IRQ is 0!\n"); printk(KERN_ERR PREFIX "Link active IRQ is 0!\n");
return_VALUE(-1); return -1;
} }
link->refcnt++; link->refcnt++;
mutex_unlock(&acpi_link_lock); mutex_unlock(&acpi_link_lock);
...@@ -658,7 +650,7 @@ acpi_pci_link_allocate_irq(acpi_handle handle, ...@@ -658,7 +650,7 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Link %s is referenced\n", "Link %s is referenced\n",
acpi_device_bid(link->device))); acpi_device_bid(link->device)));
return_VALUE(link->irq.active); return (link->irq.active);
} }
/* /*
...@@ -671,25 +663,24 @@ int acpi_pci_link_free_irq(acpi_handle handle) ...@@ -671,25 +663,24 @@ int acpi_pci_link_free_irq(acpi_handle handle)
struct acpi_pci_link *link = NULL; struct acpi_pci_link *link = NULL;
acpi_status result; acpi_status result;
ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq");
result = acpi_bus_get_device(handle, &device); result = acpi_bus_get_device(handle, &device);
if (result) { if (result) {
printk(KERN_ERR PREFIX "Invalid link device\n"); printk(KERN_ERR PREFIX "Invalid link device\n");
return_VALUE(-1); return -1;
} }
link = (struct acpi_pci_link *)acpi_driver_data(device); link = (struct acpi_pci_link *)acpi_driver_data(device);
if (!link) { if (!link) {
printk(KERN_ERR PREFIX "Invalid link context\n"); printk(KERN_ERR PREFIX "Invalid link context\n");
return_VALUE(-1); return -1;
} }
mutex_lock(&acpi_link_lock); mutex_lock(&acpi_link_lock);
if (!link->irq.initialized) { if (!link->irq.initialized) {
mutex_unlock(&acpi_link_lock); mutex_unlock(&acpi_link_lock);
printk(KERN_ERR PREFIX "Link isn't initialized\n"); printk(KERN_ERR PREFIX "Link isn't initialized\n");
return_VALUE(-1); return -1;
} }
#ifdef FUTURE_USE #ifdef FUTURE_USE
/* /*
...@@ -711,7 +702,7 @@ int acpi_pci_link_free_irq(acpi_handle handle) ...@@ -711,7 +702,7 @@ int acpi_pci_link_free_irq(acpi_handle handle)
acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
} }
mutex_unlock(&acpi_link_lock); mutex_unlock(&acpi_link_lock);
return_VALUE(link->irq.active); return (link->irq.active);
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -725,14 +716,13 @@ static int acpi_pci_link_add(struct acpi_device *device) ...@@ -725,14 +716,13 @@ static int acpi_pci_link_add(struct acpi_device *device)
int i = 0; int i = 0;
int found = 0; int found = 0;
ACPI_FUNCTION_TRACE("acpi_pci_link_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL);
if (!link) if (!link)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(link, 0, sizeof(struct acpi_pci_link)); memset(link, 0, sizeof(struct acpi_pci_link));
link->device = device; link->device = device;
...@@ -781,17 +771,16 @@ static int acpi_pci_link_add(struct acpi_device *device) ...@@ -781,17 +771,16 @@ static int acpi_pci_link_add(struct acpi_device *device)
if (result) if (result)
kfree(link); kfree(link);
return_VALUE(result); return result;
} }
static int acpi_pci_link_resume(struct acpi_pci_link *link) static int acpi_pci_link_resume(struct acpi_pci_link *link)
{ {
ACPI_FUNCTION_TRACE("acpi_pci_link_resume");
if (link->refcnt && link->irq.active && link->irq.initialized) if (link->refcnt && link->irq.active && link->irq.initialized)
return_VALUE(acpi_pci_link_set(link, link->irq.active)); return (acpi_pci_link_set(link, link->irq.active));
else else
return_VALUE(0); return 0;
} }
/* /*
...@@ -804,7 +793,6 @@ static int irqrouter_resume(struct sys_device *dev) ...@@ -804,7 +793,6 @@ static int irqrouter_resume(struct sys_device *dev)
struct list_head *node = NULL; struct list_head *node = NULL;
struct acpi_pci_link *link = NULL; struct acpi_pci_link *link = NULL;
ACPI_FUNCTION_TRACE("irqrouter_resume");
/* Make sure SCI is enabled again (Apple firmware bug?) */ /* Make sure SCI is enabled again (Apple firmware bug?) */
acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK); acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK);
...@@ -819,17 +807,16 @@ static int irqrouter_resume(struct sys_device *dev) ...@@ -819,17 +807,16 @@ static int irqrouter_resume(struct sys_device *dev)
acpi_pci_link_resume(link); acpi_pci_link_resume(link);
} }
acpi_in_resume = 0; acpi_in_resume = 0;
return_VALUE(0); return 0;
} }
static int acpi_pci_link_remove(struct acpi_device *device, int type) static int acpi_pci_link_remove(struct acpi_device *device, int type)
{ {
struct acpi_pci_link *link = NULL; struct acpi_pci_link *link = NULL;
ACPI_FUNCTION_TRACE("acpi_pci_link_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
link = (struct acpi_pci_link *)acpi_driver_data(device); link = (struct acpi_pci_link *)acpi_driver_data(device);
...@@ -839,7 +826,7 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) ...@@ -839,7 +826,7 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type)
kfree(link); kfree(link);
return_VALUE(0); return 0;
} }
/* /*
...@@ -945,34 +932,32 @@ static int __init irqrouter_init_sysfs(void) ...@@ -945,34 +932,32 @@ static int __init irqrouter_init_sysfs(void)
{ {
int error; int error;
ACPI_FUNCTION_TRACE("irqrouter_init_sysfs");
if (acpi_disabled || acpi_noirq) if (acpi_disabled || acpi_noirq)
return_VALUE(0); return 0;
error = sysdev_class_register(&irqrouter_sysdev_class); error = sysdev_class_register(&irqrouter_sysdev_class);
if (!error) if (!error)
error = sysdev_register(&device_irqrouter); error = sysdev_register(&device_irqrouter);
return_VALUE(error); return error;
} }
device_initcall(irqrouter_init_sysfs); device_initcall(irqrouter_init_sysfs);
static int __init acpi_pci_link_init(void) static int __init acpi_pci_link_init(void)
{ {
ACPI_FUNCTION_TRACE("acpi_pci_link_init");
if (acpi_noirq) if (acpi_noirq)
return_VALUE(0); return 0;
acpi_link.count = 0; acpi_link.count = 0;
INIT_LIST_HEAD(&acpi_link.entries); INIT_LIST_HEAD(&acpi_link.entries);
if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0)
return_VALUE(-ENODEV); return -ENODEV;
return_VALUE(0); return 0;
} }
subsys_initcall(acpi_pci_link_init); subsys_initcall(acpi_pci_link_init);
...@@ -160,14 +160,13 @@ static int acpi_pci_root_add(struct acpi_device *device) ...@@ -160,14 +160,13 @@ static int acpi_pci_root_add(struct acpi_device *device)
unsigned long value = 0; unsigned long value = 0;
acpi_handle handle = NULL; acpi_handle handle = NULL;
ACPI_FUNCTION_TRACE("acpi_pci_root_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
root = kmalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); root = kmalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
if (!root) if (!root)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(root, 0, sizeof(struct acpi_pci_root)); memset(root, 0, sizeof(struct acpi_pci_root));
INIT_LIST_HEAD(&root->node); INIT_LIST_HEAD(&root->node);
...@@ -307,46 +306,43 @@ static int acpi_pci_root_add(struct acpi_device *device) ...@@ -307,46 +306,43 @@ static int acpi_pci_root_add(struct acpi_device *device)
kfree(root); kfree(root);
} }
return_VALUE(result); return result;
} }
static int acpi_pci_root_start(struct acpi_device *device) static int acpi_pci_root_start(struct acpi_device *device)
{ {
struct acpi_pci_root *root; struct acpi_pci_root *root;
ACPI_FUNCTION_TRACE("acpi_pci_root_start");
list_for_each_entry(root, &acpi_pci_roots, node) { list_for_each_entry(root, &acpi_pci_roots, node) {
if (root->handle == device->handle) { if (root->handle == device->handle) {
pci_bus_add_devices(root->bus); pci_bus_add_devices(root->bus);
return_VALUE(0); return 0;
} }
} }
return_VALUE(-ENODEV); return -ENODEV;
} }
static int acpi_pci_root_remove(struct acpi_device *device, int type) static int acpi_pci_root_remove(struct acpi_device *device, int type)
{ {
struct acpi_pci_root *root = NULL; struct acpi_pci_root *root = NULL;
ACPI_FUNCTION_TRACE("acpi_pci_root_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
root = (struct acpi_pci_root *)acpi_driver_data(device); root = (struct acpi_pci_root *)acpi_driver_data(device);
kfree(root); kfree(root);
return_VALUE(0); return 0;
} }
static int __init acpi_pci_root_init(void) static int __init acpi_pci_root_init(void)
{ {
ACPI_FUNCTION_TRACE("acpi_pci_root_init");
if (acpi_pci_disabled) if (acpi_pci_disabled)
return_VALUE(0); return 0;
/* DEBUG: /* DEBUG:
acpi_dbg_layer = ACPI_PCI_COMPONENT; acpi_dbg_layer = ACPI_PCI_COMPONENT;
...@@ -354,9 +350,9 @@ static int __init acpi_pci_root_init(void) ...@@ -354,9 +350,9 @@ static int __init acpi_pci_root_init(void)
*/ */
if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0)
return_VALUE(-ENODEV); return -ENODEV;
return_VALUE(0); return 0;
} }
subsys_initcall(acpi_pci_root_init); subsys_initcall(acpi_pci_root_init);
...@@ -98,22 +98,21 @@ acpi_power_get_context(acpi_handle handle, ...@@ -98,22 +98,21 @@ acpi_power_get_context(acpi_handle handle,
int result = 0; int result = 0;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_power_get_context");
if (!resource) if (!resource)
return_VALUE(-ENODEV); return -ENODEV;
result = acpi_bus_get_device(handle, &device); result = acpi_bus_get_device(handle, &device);
if (result) { if (result) {
printk(KERN_WARNING PREFIX "Getting context [%p]\n", handle); printk(KERN_WARNING PREFIX "Getting context [%p]\n", handle);
return_VALUE(result); return result;
} }
*resource = (struct acpi_power_resource *)acpi_driver_data(device); *resource = (struct acpi_power_resource *)acpi_driver_data(device);
if (!resource) if (!resource)
return_VALUE(-ENODEV); return -ENODEV;
return_VALUE(0); return 0;
} }
static int acpi_power_get_state(struct acpi_power_resource *resource) static int acpi_power_get_state(struct acpi_power_resource *resource)
...@@ -121,14 +120,13 @@ static int acpi_power_get_state(struct acpi_power_resource *resource) ...@@ -121,14 +120,13 @@ static int acpi_power_get_state(struct acpi_power_resource *resource)
acpi_status status = AE_OK; acpi_status status = AE_OK;
unsigned long sta = 0; unsigned long sta = 0;
ACPI_FUNCTION_TRACE("acpi_power_get_state");
if (!resource) if (!resource)
return_VALUE(-EINVAL); return -EINVAL;
status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta); status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
if (sta & 0x01) if (sta & 0x01)
resource->state = ACPI_POWER_RESOURCE_STATE_ON; resource->state = ACPI_POWER_RESOURCE_STATE_ON;
...@@ -138,7 +136,7 @@ static int acpi_power_get_state(struct acpi_power_resource *resource) ...@@ -138,7 +136,7 @@ static int acpi_power_get_state(struct acpi_power_resource *resource)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n",
resource->name, resource->state ? "on" : "off")); resource->name, resource->state ? "on" : "off"));
return_VALUE(0); return 0;
} }
static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
...@@ -147,20 +145,19 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) ...@@ -147,20 +145,19 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
struct acpi_power_resource *resource = NULL; struct acpi_power_resource *resource = NULL;
u32 i = 0; u32 i = 0;
ACPI_FUNCTION_TRACE("acpi_power_get_list_state");
if (!list || !state) if (!list || !state)
return_VALUE(-EINVAL); return -EINVAL;
/* The state of the list is 'on' IFF all resources are 'on'. */ /* The state of the list is 'on' IFF all resources are 'on'. */
for (i = 0; i < list->count; i++) { for (i = 0; i < list->count; i++) {
result = acpi_power_get_context(list->handles[i], &resource); result = acpi_power_get_context(list->handles[i], &resource);
if (result) if (result)
return_VALUE(result); return result;
result = acpi_power_get_state(resource); result = acpi_power_get_state(resource);
if (result) if (result)
return_VALUE(result); return result;
*state = resource->state; *state = resource->state;
...@@ -171,7 +168,7 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) ...@@ -171,7 +168,7 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n",
*state ? "on" : "off")); *state ? "on" : "off"));
return_VALUE(result); return result;
} }
static int acpi_power_on(acpi_handle handle) static int acpi_power_on(acpi_handle handle)
...@@ -181,11 +178,10 @@ static int acpi_power_on(acpi_handle handle) ...@@ -181,11 +178,10 @@ static int acpi_power_on(acpi_handle handle)
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
struct acpi_power_resource *resource = NULL; struct acpi_power_resource *resource = NULL;
ACPI_FUNCTION_TRACE("acpi_power_on");
result = acpi_power_get_context(handle, &resource); result = acpi_power_get_context(handle, &resource);
if (result) if (result)
return_VALUE(result); return result;
resource->references++; resource->references++;
...@@ -193,29 +189,29 @@ static int acpi_power_on(acpi_handle handle) ...@@ -193,29 +189,29 @@ static int acpi_power_on(acpi_handle handle)
|| (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) { || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n",
resource->name)); resource->name));
return_VALUE(0); return 0;
} }
status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL); status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
result = acpi_power_get_state(resource); result = acpi_power_get_state(resource);
if (result) if (result)
return_VALUE(result); return result;
if (resource->state != ACPI_POWER_RESOURCE_STATE_ON) if (resource->state != ACPI_POWER_RESOURCE_STATE_ON)
return_VALUE(-ENOEXEC); return -ENOEXEC;
/* Update the power resource's _device_ power state */ /* Update the power resource's _device_ power state */
result = acpi_bus_get_device(resource->handle, &device); result = acpi_bus_get_device(resource->handle, &device);
if (result) if (result)
return_VALUE(result); return result;
device->power.state = ACPI_STATE_D0; device->power.state = ACPI_STATE_D0;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n",
resource->name)); resource->name));
return_VALUE(0); return 0;
} }
static int acpi_power_off_device(acpi_handle handle) static int acpi_power_off_device(acpi_handle handle)
...@@ -225,11 +221,10 @@ static int acpi_power_off_device(acpi_handle handle) ...@@ -225,11 +221,10 @@ static int acpi_power_off_device(acpi_handle handle)
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
struct acpi_power_resource *resource = NULL; struct acpi_power_resource *resource = NULL;
ACPI_FUNCTION_TRACE("acpi_power_off_device");
result = acpi_power_get_context(handle, &resource); result = acpi_power_get_context(handle, &resource);
if (result) if (result)
return_VALUE(result); return result;
if (resource->references) if (resource->references)
resource->references--; resource->references--;
...@@ -238,35 +233,35 @@ static int acpi_power_off_device(acpi_handle handle) ...@@ -238,35 +233,35 @@ static int acpi_power_off_device(acpi_handle handle)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Resource [%s] is still in use, dereferencing\n", "Resource [%s] is still in use, dereferencing\n",
device->pnp.bus_id)); device->pnp.bus_id));
return_VALUE(0); return 0;
} }
if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) { if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n",
device->pnp.bus_id)); device->pnp.bus_id));
return_VALUE(0); return 0;
} }
status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL); status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
result = acpi_power_get_state(resource); result = acpi_power_get_state(resource);
if (result) if (result)
return_VALUE(result); return result;
if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF) if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF)
return_VALUE(-ENOEXEC); return -ENOEXEC;
/* Update the power resource's _device_ power state */ /* Update the power resource's _device_ power state */
result = acpi_bus_get_device(resource->handle, &device); result = acpi_bus_get_device(resource->handle, &device);
if (result) if (result)
return_VALUE(result); return result;
device->power.state = ACPI_STATE_D3; device->power.state = ACPI_STATE_D3;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n",
resource->name)); resource->name));
return_VALUE(0); return 0;
} }
/* /*
...@@ -282,9 +277,8 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) ...@@ -282,9 +277,8 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev)
int i; int i;
int ret = 0; int ret = 0;
ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_power");
if (!dev || !dev->wakeup.flags.valid) if (!dev || !dev->wakeup.flags.valid)
return_VALUE(-1); return -1;
arg.integer.value = 1; arg.integer.value = 1;
/* Open power resource */ /* Open power resource */
...@@ -293,7 +287,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) ...@@ -293,7 +287,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev)
if (ret) { if (ret) {
printk(KERN_ERR PREFIX "Transition power state\n"); printk(KERN_ERR PREFIX "Transition power state\n");
dev->wakeup.flags.valid = 0; dev->wakeup.flags.valid = 0;
return_VALUE(-1); return -1;
} }
} }
...@@ -305,7 +299,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) ...@@ -305,7 +299,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev)
ret = -1; ret = -1;
} }
return_VALUE(ret); return ret;
} }
/* /*
...@@ -321,10 +315,9 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) ...@@ -321,10 +315,9 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)
int i; int i;
int ret = 0; int ret = 0;
ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device_power");
if (!dev || !dev->wakeup.flags.valid) if (!dev || !dev->wakeup.flags.valid)
return_VALUE(-1); return -1;
arg.integer.value = 0; arg.integer.value = 0;
/* Execute PSW */ /* Execute PSW */
...@@ -332,7 +325,7 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) ...@@ -332,7 +325,7 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
printk(KERN_ERR PREFIX "Evaluate _PSW\n"); printk(KERN_ERR PREFIX "Evaluate _PSW\n");
dev->wakeup.flags.valid = 0; dev->wakeup.flags.valid = 0;
return_VALUE(-1); return -1;
} }
/* Close power resource */ /* Close power resource */
...@@ -341,11 +334,11 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) ...@@ -341,11 +334,11 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)
if (ret) { if (ret) {
printk(KERN_ERR PREFIX "Transition power state\n"); printk(KERN_ERR PREFIX "Transition power state\n");
dev->wakeup.flags.valid = 0; dev->wakeup.flags.valid = 0;
return_VALUE(-1); return -1;
} }
} }
return_VALUE(ret); return ret;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -359,10 +352,9 @@ int acpi_power_get_inferred_state(struct acpi_device *device) ...@@ -359,10 +352,9 @@ int acpi_power_get_inferred_state(struct acpi_device *device)
int list_state = 0; int list_state = 0;
int i = 0; int i = 0;
ACPI_FUNCTION_TRACE("acpi_power_get_inferred_state");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
device->power.state = ACPI_STATE_UNKNOWN; device->power.state = ACPI_STATE_UNKNOWN;
...@@ -377,17 +369,17 @@ int acpi_power_get_inferred_state(struct acpi_device *device) ...@@ -377,17 +369,17 @@ int acpi_power_get_inferred_state(struct acpi_device *device)
result = acpi_power_get_list_state(list, &list_state); result = acpi_power_get_list_state(list, &list_state);
if (result) if (result)
return_VALUE(result); return result;
if (list_state == ACPI_POWER_RESOURCE_STATE_ON) { if (list_state == ACPI_POWER_RESOURCE_STATE_ON) {
device->power.state = i; device->power.state = i;
return_VALUE(0); return 0;
} }
} }
device->power.state = ACPI_STATE_D3; device->power.state = ACPI_STATE_D3;
return_VALUE(0); return 0;
} }
int acpi_power_transition(struct acpi_device *device, int state) int acpi_power_transition(struct acpi_device *device, int state)
...@@ -397,14 +389,13 @@ int acpi_power_transition(struct acpi_device *device, int state) ...@@ -397,14 +389,13 @@ int acpi_power_transition(struct acpi_device *device, int state)
struct acpi_handle_list *tl = NULL; /* Target Resources */ struct acpi_handle_list *tl = NULL; /* Target Resources */
int i = 0; int i = 0;
ACPI_FUNCTION_TRACE("acpi_power_transition");
if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
return_VALUE(-EINVAL); return -EINVAL;
if ((device->power.state < ACPI_STATE_D0) if ((device->power.state < ACPI_STATE_D0)
|| (device->power.state > ACPI_STATE_D3)) || (device->power.state > ACPI_STATE_D3))
return_VALUE(-ENODEV); return -ENODEV;
cl = &device->power.states[device->power.state].resources; cl = &device->power.states[device->power.state].resources;
tl = &device->power.states[state].resources; tl = &device->power.states[state].resources;
...@@ -444,7 +435,7 @@ int acpi_power_transition(struct acpi_device *device, int state) ...@@ -444,7 +435,7 @@ int acpi_power_transition(struct acpi_device *device, int state)
printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n",
device->pnp.bus_id, state); device->pnp.bus_id, state);
return_VALUE(result); return result;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -457,7 +448,6 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset) ...@@ -457,7 +448,6 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_power_resource *resource = NULL; struct acpi_power_resource *resource = NULL;
ACPI_FUNCTION_TRACE("acpi_power_seq_show");
resource = (struct acpi_power_resource *)seq->private; resource = (struct acpi_power_resource *)seq->private;
...@@ -484,7 +474,7 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset) ...@@ -484,7 +474,7 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset)
resource->order, resource->references); resource->order, resource->references);
end: end:
return_VALUE(0); return 0;
} }
static int acpi_power_open_fs(struct inode *inode, struct file *file) static int acpi_power_open_fs(struct inode *inode, struct file *file)
...@@ -496,34 +486,32 @@ static int acpi_power_add_fs(struct acpi_device *device) ...@@ -496,34 +486,32 @@ static int acpi_power_add_fs(struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_power_add_fs");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_power_dir); acpi_power_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
} }
/* 'status' [R] */ /* 'status' [R] */
entry = create_proc_entry(ACPI_POWER_FILE_STATUS, entry = create_proc_entry(ACPI_POWER_FILE_STATUS,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-EIO); return -EIO;
else { else {
entry->proc_fops = &acpi_power_fops; entry->proc_fops = &acpi_power_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
} }
return_VALUE(0); return 0;
} }
static int acpi_power_remove_fs(struct acpi_device *device) static int acpi_power_remove_fs(struct acpi_device *device)
{ {
ACPI_FUNCTION_TRACE("acpi_power_remove_fs");
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_POWER_FILE_STATUS, remove_proc_entry(ACPI_POWER_FILE_STATUS,
...@@ -532,7 +520,7 @@ static int acpi_power_remove_fs(struct acpi_device *device) ...@@ -532,7 +520,7 @@ static int acpi_power_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -547,14 +535,13 @@ static int acpi_power_add(struct acpi_device *device) ...@@ -547,14 +535,13 @@ static int acpi_power_add(struct acpi_device *device)
union acpi_object acpi_object; union acpi_object acpi_object;
struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object }; struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object };
ACPI_FUNCTION_TRACE("acpi_power_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL); resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL);
if (!resource) if (!resource)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(resource, 0, sizeof(struct acpi_power_resource)); memset(resource, 0, sizeof(struct acpi_power_resource));
resource->handle = device->handle; resource->handle = device->handle;
...@@ -599,17 +586,16 @@ static int acpi_power_add(struct acpi_device *device) ...@@ -599,17 +586,16 @@ static int acpi_power_add(struct acpi_device *device)
if (result) if (result)
kfree(resource); kfree(resource);
return_VALUE(result); return result;
} }
static int acpi_power_remove(struct acpi_device *device, int type) static int acpi_power_remove(struct acpi_device *device, int type)
{ {
struct acpi_power_resource *resource = NULL; struct acpi_power_resource *resource = NULL;
ACPI_FUNCTION_TRACE("acpi_power_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
resource = (struct acpi_power_resource *)acpi_driver_data(device); resource = (struct acpi_power_resource *)acpi_driver_data(device);
...@@ -617,31 +603,30 @@ static int acpi_power_remove(struct acpi_device *device, int type) ...@@ -617,31 +603,30 @@ static int acpi_power_remove(struct acpi_device *device, int type)
kfree(resource); kfree(resource);
return_VALUE(0); return 0;
} }
static int __init acpi_power_init(void) static int __init acpi_power_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_power_init");
if (acpi_disabled) if (acpi_disabled)
return_VALUE(0); return 0;
INIT_LIST_HEAD(&acpi_power_resource_list); INIT_LIST_HEAD(&acpi_power_resource_list);
acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir);
if (!acpi_power_dir) if (!acpi_power_dir)
return_VALUE(-ENODEV); return -ENODEV;
result = acpi_bus_register_driver(&acpi_power_driver); result = acpi_bus_register_driver(&acpi_power_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir); remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
subsys_initcall(acpi_power_init); subsys_initcall(acpi_power_init);
...@@ -122,10 +122,9 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev) ...@@ -122,10 +122,9 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
u8 value1 = 0; u8 value1 = 0;
u8 value2 = 0; u8 value2 = 0;
ACPI_FUNCTION_TRACE("acpi_processor_errata_piix4");
if (!dev) if (!dev)
return_VALUE(-EINVAL); return -EINVAL;
/* /*
* Note that 'dev' references the PIIX4 ACPI Controller. * Note that 'dev' references the PIIX4 ACPI Controller.
...@@ -218,7 +217,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev) ...@@ -218,7 +217,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Type-F DMA livelock erratum (C3 disabled)\n")); "Type-F DMA livelock erratum (C3 disabled)\n"));
return_VALUE(0); return 0;
} }
static int acpi_processor_errata(struct acpi_processor *pr) static int acpi_processor_errata(struct acpi_processor *pr)
...@@ -226,10 +225,9 @@ static int acpi_processor_errata(struct acpi_processor *pr) ...@@ -226,10 +225,9 @@ static int acpi_processor_errata(struct acpi_processor *pr)
int result = 0; int result = 0;
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
ACPI_FUNCTION_TRACE("acpi_processor_errata");
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
/* /*
* PIIX4 * PIIX4
...@@ -242,7 +240,7 @@ static int acpi_processor_errata(struct acpi_processor *pr) ...@@ -242,7 +240,7 @@ static int acpi_processor_errata(struct acpi_processor *pr)
pci_dev_put(dev); pci_dev_put(dev);
} }
return_VALUE(result); return result;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -258,10 +256,9 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr) ...@@ -258,10 +256,9 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr)
struct acpi_object_list *pdc_in = pr->pdc; struct acpi_object_list *pdc_in = pr->pdc;
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_processor_set_pdc");
if (!pdc_in) if (!pdc_in)
return_VALUE(status); return status;
status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL);
...@@ -269,7 +266,7 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr) ...@@ -269,7 +266,7 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Could not evaluate _PDC, using legacy perf. control...\n")); "Could not evaluate _PDC, using legacy perf. control...\n"));
return_VALUE(status); return status;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -282,7 +279,6 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) ...@@ -282,7 +279,6 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_processor *pr = (struct acpi_processor *)seq->private; struct acpi_processor *pr = (struct acpi_processor *)seq->private;
ACPI_FUNCTION_TRACE("acpi_processor_info_seq_show");
if (!pr) if (!pr)
goto end; goto end;
...@@ -301,7 +297,7 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) ...@@ -301,7 +297,7 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset)
pr->flags.limit ? "yes" : "no"); pr->flags.limit ? "yes" : "no");
end: end:
return_VALUE(0); return 0;
} }
static int acpi_processor_info_open_fs(struct inode *inode, struct file *file) static int acpi_processor_info_open_fs(struct inode *inode, struct file *file)
...@@ -314,13 +310,12 @@ static int acpi_processor_add_fs(struct acpi_device *device) ...@@ -314,13 +310,12 @@ static int acpi_processor_add_fs(struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_processor_add_fs");
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_processor_dir); acpi_processor_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
} }
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
...@@ -328,7 +323,7 @@ static int acpi_processor_add_fs(struct acpi_device *device) ...@@ -328,7 +323,7 @@ static int acpi_processor_add_fs(struct acpi_device *device)
entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-EIO); return -EIO;
else { else {
entry->proc_fops = &acpi_processor_info_fops; entry->proc_fops = &acpi_processor_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -340,7 +335,7 @@ static int acpi_processor_add_fs(struct acpi_device *device) ...@@ -340,7 +335,7 @@ static int acpi_processor_add_fs(struct acpi_device *device)
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-EIO); return -EIO;
else { else {
entry->proc_fops = &acpi_processor_throttling_fops; entry->proc_fops = &acpi_processor_throttling_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -352,19 +347,18 @@ static int acpi_processor_add_fs(struct acpi_device *device) ...@@ -352,19 +347,18 @@ static int acpi_processor_add_fs(struct acpi_device *device)
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE( -EIO); return -EIO;
else { else {
entry->proc_fops = &acpi_processor_limit_fops; entry->proc_fops = &acpi_processor_limit_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VALUE(0); return 0;
} }
static int acpi_processor_remove_fs(struct acpi_device *device) static int acpi_processor_remove_fs(struct acpi_device *device)
{ {
ACPI_FUNCTION_TRACE("acpi_processor_remove_fs");
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, remove_proc_entry(ACPI_PROCESSOR_FILE_INFO,
...@@ -377,7 +371,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) ...@@ -377,7 +371,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* Use the acpiid in MADT to map cpus in case of SMP */ /* Use the acpiid in MADT to map cpus in case of SMP */
...@@ -424,10 +418,9 @@ static int acpi_processor_get_info(struct acpi_processor *pr) ...@@ -424,10 +418,9 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
int cpu_index; int cpu_index;
static int cpu0_initialized; static int cpu0_initialized;
ACPI_FUNCTION_TRACE("acpi_processor_get_info");
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
if (num_online_cpus() > 1) if (num_online_cpus() > 1)
errata.smp = TRUE; errata.smp = TRUE;
...@@ -454,7 +447,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) ...@@ -454,7 +447,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Evaluating processor object\n"); printk(KERN_ERR PREFIX "Evaluating processor object\n");
return_VALUE(-ENODEV); return -ENODEV;
} }
/* /*
...@@ -486,7 +479,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) ...@@ -486,7 +479,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Getting cpuindex for acpiid 0x%x\n", "Getting cpuindex for acpiid 0x%x\n",
pr->acpi_id); pr->acpi_id);
return_VALUE(-ENODEV); return -ENODEV;
} }
} }
...@@ -521,7 +514,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) ...@@ -521,7 +514,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
acpi_processor_get_throttling_info(pr); acpi_processor_get_throttling_info(pr);
acpi_processor_get_limit_info(pr); acpi_processor_get_limit_info(pr);
return_VALUE(0); return 0;
} }
static void *processor_device_array[NR_CPUS]; static void *processor_device_array[NR_CPUS];
...@@ -532,14 +525,13 @@ static int acpi_processor_start(struct acpi_device *device) ...@@ -532,14 +525,13 @@ static int acpi_processor_start(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_processor *pr; struct acpi_processor *pr;
ACPI_FUNCTION_TRACE("acpi_processor_start");
pr = acpi_driver_data(device); pr = acpi_driver_data(device);
result = acpi_processor_get_info(pr); result = acpi_processor_get_info(pr);
if (result) { if (result) {
/* Processor is physically not present */ /* Processor is physically not present */
return_VALUE(0); return 0;
} }
BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0));
...@@ -553,7 +545,7 @@ static int acpi_processor_start(struct acpi_device *device) ...@@ -553,7 +545,7 @@ static int acpi_processor_start(struct acpi_device *device)
processor_device_array[pr->id] != (void *)device) { processor_device_array[pr->id] != (void *)device) {
printk(KERN_WARNING "BIOS reported wrong ACPI id" printk(KERN_WARNING "BIOS reported wrong ACPI id"
"for the processor\n"); "for the processor\n");
return_VALUE(-ENODEV); return -ENODEV;
} }
processor_device_array[pr->id] = (void *)device; processor_device_array[pr->id] = (void *)device;
...@@ -581,7 +573,7 @@ static int acpi_processor_start(struct acpi_device *device) ...@@ -581,7 +573,7 @@ static int acpi_processor_start(struct acpi_device *device)
end: end:
return_VALUE(result); return result;
} }
static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
...@@ -589,13 +581,12 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) ...@@ -589,13 +581,12 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
struct acpi_processor *pr = (struct acpi_processor *)data; struct acpi_processor *pr = (struct acpi_processor *)data;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_processor_notify");
if (!pr) if (!pr)
return_VOID; return;
if (acpi_bus_get_device(pr->handle, &device)) if (acpi_bus_get_device(pr->handle, &device))
return_VOID; return;
switch (event) { switch (event) {
case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
...@@ -613,21 +604,20 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) ...@@ -613,21 +604,20 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
break; break;
} }
return_VOID; return;
} }
static int acpi_processor_add(struct acpi_device *device) static int acpi_processor_add(struct acpi_device *device)
{ {
struct acpi_processor *pr = NULL; struct acpi_processor *pr = NULL;
ACPI_FUNCTION_TRACE("acpi_processor_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
pr = kmalloc(sizeof(struct acpi_processor), GFP_KERNEL); pr = kmalloc(sizeof(struct acpi_processor), GFP_KERNEL);
if (!pr) if (!pr)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(pr, 0, sizeof(struct acpi_processor)); memset(pr, 0, sizeof(struct acpi_processor));
pr->handle = device->handle; pr->handle = device->handle;
...@@ -635,7 +625,7 @@ static int acpi_processor_add(struct acpi_device *device) ...@@ -635,7 +625,7 @@ static int acpi_processor_add(struct acpi_device *device)
strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
acpi_driver_data(device) = pr; acpi_driver_data(device) = pr;
return_VALUE(0); return 0;
} }
static int acpi_processor_remove(struct acpi_device *device, int type) static int acpi_processor_remove(struct acpi_device *device, int type)
...@@ -643,21 +633,20 @@ static int acpi_processor_remove(struct acpi_device *device, int type) ...@@ -643,21 +633,20 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_processor *pr = NULL; struct acpi_processor *pr = NULL;
ACPI_FUNCTION_TRACE("acpi_processor_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
pr = (struct acpi_processor *)acpi_driver_data(device); pr = (struct acpi_processor *)acpi_driver_data(device);
if (pr->id >= NR_CPUS) { if (pr->id >= NR_CPUS) {
kfree(pr); kfree(pr);
return_VALUE(0); return 0;
} }
if (type == ACPI_BUS_REMOVAL_EJECT) { if (type == ACPI_BUS_REMOVAL_EJECT) {
if (acpi_processor_handle_eject(pr)) if (acpi_processor_handle_eject(pr))
return_VALUE(-EINVAL); return -EINVAL;
} }
acpi_processor_power_exit(pr, device); acpi_processor_power_exit(pr, device);
...@@ -671,7 +660,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type) ...@@ -671,7 +660,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
kfree(pr); kfree(pr);
return_VALUE(0); return 0;
} }
#ifdef CONFIG_ACPI_HOTPLUG_CPU #ifdef CONFIG_ACPI_HOTPLUG_CPU
...@@ -686,14 +675,13 @@ static int is_processor_present(acpi_handle handle) ...@@ -686,14 +675,13 @@ static int is_processor_present(acpi_handle handle)
acpi_status status; acpi_status status;
unsigned long sta = 0; unsigned long sta = 0;
ACPI_FUNCTION_TRACE("is_processor_present");
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) { if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) {
ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present"));
return_VALUE(0); return 0;
} }
return_VALUE(1); return 1;
} }
static static
...@@ -703,30 +691,29 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) ...@@ -703,30 +691,29 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
struct acpi_device *pdev; struct acpi_device *pdev;
struct acpi_processor *pr; struct acpi_processor *pr;
ACPI_FUNCTION_TRACE("acpi_processor_device_add");
if (acpi_get_parent(handle, &phandle)) { if (acpi_get_parent(handle, &phandle)) {
return_VALUE(-ENODEV); return -ENODEV;
} }
if (acpi_bus_get_device(phandle, &pdev)) { if (acpi_bus_get_device(phandle, &pdev)) {
return_VALUE(-ENODEV); return -ENODEV;
} }
if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) { if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) {
return_VALUE(-ENODEV); return -ENODEV;
} }
acpi_bus_start(*device); acpi_bus_start(*device);
pr = acpi_driver_data(*device); pr = acpi_driver_data(*device);
if (!pr) if (!pr)
return_VALUE(-ENODEV); return -ENODEV;
if ((pr->id >= 0) && (pr->id < NR_CPUS)) { if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
kobject_uevent(&(*device)->kobj, KOBJ_ONLINE); kobject_uevent(&(*device)->kobj, KOBJ_ONLINE);
} }
return_VALUE(0); return 0;
} }
static void static void
...@@ -736,7 +723,6 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) ...@@ -736,7 +723,6 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
int result; int result;
ACPI_FUNCTION_TRACE("acpi_processor_hotplug_notify");
switch (event) { switch (event) {
case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_BUS_CHECK:
...@@ -788,7 +774,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) ...@@ -788,7 +774,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
if (!pr) { if (!pr) {
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Driver data is NULL, dropping EJECT\n"); "Driver data is NULL, dropping EJECT\n");
return_VOID; return;
} }
if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
...@@ -800,7 +786,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) ...@@ -800,7 +786,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
break; break;
} }
return_VOID; return;
} }
static acpi_status static acpi_status
...@@ -839,21 +825,20 @@ processor_walk_namespace_cb(acpi_handle handle, ...@@ -839,21 +825,20 @@ processor_walk_namespace_cb(acpi_handle handle,
static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu)
{ {
ACPI_FUNCTION_TRACE("acpi_processor_hotadd_init");
if (!is_processor_present(handle)) { if (!is_processor_present(handle)) {
return_VALUE(AE_ERROR); return AE_ERROR;
} }
if (acpi_map_lsapic(handle, p_cpu)) if (acpi_map_lsapic(handle, p_cpu))
return_VALUE(AE_ERROR); return AE_ERROR;
if (arch_register_cpu(*p_cpu)) { if (arch_register_cpu(*p_cpu)) {
acpi_unmap_lsapic(*p_cpu); acpi_unmap_lsapic(*p_cpu);
return_VALUE(AE_ERROR); return AE_ERROR;
} }
return_VALUE(AE_OK); return AE_OK;
} }
static int acpi_processor_handle_eject(struct acpi_processor *pr) static int acpi_processor_handle_eject(struct acpi_processor *pr)
...@@ -910,20 +895,19 @@ static int __init acpi_processor_init(void) ...@@ -910,20 +895,19 @@ static int __init acpi_processor_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_processor_init");
memset(&processors, 0, sizeof(processors)); memset(&processors, 0, sizeof(processors));
memset(&errata, 0, sizeof(errata)); memset(&errata, 0, sizeof(errata));
acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
if (!acpi_processor_dir) if (!acpi_processor_dir)
return_VALUE(0); return 0;
acpi_processor_dir->owner = THIS_MODULE; acpi_processor_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_processor_driver); result = acpi_bus_register_driver(&acpi_processor_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
return_VALUE(0); return 0;
} }
acpi_processor_install_hotplug_notify(); acpi_processor_install_hotplug_notify();
...@@ -932,12 +916,11 @@ static int __init acpi_processor_init(void) ...@@ -932,12 +916,11 @@ static int __init acpi_processor_init(void)
acpi_processor_ppc_init(); acpi_processor_ppc_init();
return_VALUE(0); return 0;
} }
static void __exit acpi_processor_exit(void) static void __exit acpi_processor_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_processor_exit");
acpi_processor_ppc_exit(); acpi_processor_ppc_exit();
...@@ -949,7 +932,7 @@ static void __exit acpi_processor_exit(void) ...@@ -949,7 +932,7 @@ static void __exit acpi_processor_exit(void)
remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
return_VOID; return;
} }
module_init(acpi_processor_init); module_init(acpi_processor_init);
......
...@@ -517,10 +517,9 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) ...@@ -517,10 +517,9 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr)
struct acpi_processor_cx *higher = NULL; struct acpi_processor_cx *higher = NULL;
struct acpi_processor_cx *cx; struct acpi_processor_cx *cx;
ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy");
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
/* /*
* This function sets the default Cx state policy (OS idle handler). * This function sets the default Cx state policy (OS idle handler).
...@@ -544,7 +543,7 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) ...@@ -544,7 +543,7 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr)
} }
if (!state_is_set) if (!state_is_set)
return_VALUE(-ENODEV); return -ENODEV;
/* demotion */ /* demotion */
for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
...@@ -583,18 +582,17 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) ...@@ -583,18 +582,17 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr)
higher = cx; higher = cx;
} }
return_VALUE(0); return 0;
} }
static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
{ {
ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt");
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
if (!pr->pblk) if (!pr->pblk)
return_VALUE(-ENODEV); return -ENODEV;
/* if info is obtained from pblk/fadt, type equals state */ /* if info is obtained from pblk/fadt, type equals state */
pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2;
...@@ -606,7 +604,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) ...@@ -606,7 +604,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
* an SMP system. * an SMP system.
*/ */
if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up) if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up)
return_VALUE(-ENODEV); return -ENODEV;
#endif #endif
/* determine C2 and C3 address from pblk */ /* determine C2 and C3 address from pblk */
...@@ -622,12 +620,11 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) ...@@ -622,12 +620,11 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
pr->power.states[ACPI_STATE_C2].address, pr->power.states[ACPI_STATE_C2].address,
pr->power.states[ACPI_STATE_C3].address)); pr->power.states[ACPI_STATE_C3].address));
return_VALUE(0); return 0;
} }
static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr)
{ {
ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1");
/* Zero initialize all the C-states info. */ /* Zero initialize all the C-states info. */
memset(pr->power.states, 0, sizeof(pr->power.states)); memset(pr->power.states, 0, sizeof(pr->power.states));
...@@ -640,7 +637,7 @@ static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) ...@@ -640,7 +637,7 @@ static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr)
pr->power.states[ACPI_STATE_C0].valid = 1; pr->power.states[ACPI_STATE_C0].valid = 1;
pr->power.states[ACPI_STATE_C1].valid = 1; pr->power.states[ACPI_STATE_C1].valid = 1;
return_VALUE(0); return 0;
} }
static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
...@@ -652,10 +649,9 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) ...@@ -652,10 +649,9 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *cst; union acpi_object *cst;
ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst");
if (nocst) if (nocst)
return_VALUE(-ENODEV); return -ENODEV;
current_count = 1; current_count = 1;
...@@ -667,7 +663,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) ...@@ -667,7 +663,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n"));
return_VALUE(-ENODEV); return -ENODEV;
} }
cst = (union acpi_object *)buffer.pointer; cst = (union acpi_object *)buffer.pointer;
...@@ -773,15 +769,14 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) ...@@ -773,15 +769,14 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
end: end:
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_VALUE(status); return status;
} }
static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
{ {
ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c2");
if (!cx->address) if (!cx->address)
return_VOID; return;
/* /*
* C2 latency must be less than or equal to 100 * C2 latency must be less than or equal to 100
...@@ -790,7 +785,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) ...@@ -790,7 +785,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"latency too large [%d]\n", cx->latency)); "latency too large [%d]\n", cx->latency));
return_VOID; return;
} }
/* /*
...@@ -800,7 +795,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) ...@@ -800,7 +795,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
cx->valid = 1; cx->valid = 1;
cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
return_VOID; return;
} }
static void acpi_processor_power_verify_c3(struct acpi_processor *pr, static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
...@@ -808,10 +803,9 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, ...@@ -808,10 +803,9 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
{ {
static int bm_check_flag; static int bm_check_flag;
ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3");
if (!cx->address) if (!cx->address)
return_VOID; return;
/* /*
* C3 latency must be less than or equal to 1000 * C3 latency must be less than or equal to 1000
...@@ -820,7 +814,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, ...@@ -820,7 +814,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"latency too large [%d]\n", cx->latency)); "latency too large [%d]\n", cx->latency));
return_VOID; return;
} }
/* /*
...@@ -833,7 +827,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, ...@@ -833,7 +827,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
else if (errata.piix4.fdma) { else if (errata.piix4.fdma) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"C3 not supported on PIIX4 with Type-F DMA\n")); "C3 not supported on PIIX4 with Type-F DMA\n"));
return_VOID; return;
} }
/* All the logic here assumes flags.bm_check is same across all CPUs */ /* All the logic here assumes flags.bm_check is same across all CPUs */
...@@ -850,7 +844,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, ...@@ -850,7 +844,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
if (!pr->flags.bm_control) { if (!pr->flags.bm_control) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"C3 support requires bus mastering control\n")); "C3 support requires bus mastering control\n"));
return_VOID; return;
} }
} else { } else {
/* /*
...@@ -861,7 +855,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, ...@@ -861,7 +855,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Cache invalidation should work properly" "Cache invalidation should work properly"
" for C3 to be enabled on SMP systems\n")); " for C3 to be enabled on SMP systems\n"));
return_VOID; return;
} }
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD,
0, ACPI_MTX_DO_NOT_LOCK); 0, ACPI_MTX_DO_NOT_LOCK);
...@@ -876,7 +870,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, ...@@ -876,7 +870,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
cx->valid = 1; cx->valid = 1;
cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
return_VOID; return;
} }
static int acpi_processor_power_verify(struct acpi_processor *pr) static int acpi_processor_power_verify(struct acpi_processor *pr)
...@@ -935,7 +929,6 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) ...@@ -935,7 +929,6 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
unsigned int i; unsigned int i;
int result; int result;
ACPI_FUNCTION_TRACE("acpi_processor_get_power_info");
/* NOTE: the idle thread may not be running while calling /* NOTE: the idle thread may not be running while calling
* this function */ * this function */
...@@ -958,7 +951,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) ...@@ -958,7 +951,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
*/ */
result = acpi_processor_set_power_policy(pr); result = acpi_processor_set_power_policy(pr);
if (result) if (result)
return_VALUE(result); return result;
/* /*
* if one state of type C2 or C3 is available, mark this * if one state of type C2 or C3 is available, mark this
...@@ -972,24 +965,23 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) ...@@ -972,24 +965,23 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
} }
} }
return_VALUE(0); return 0;
} }
int acpi_processor_cst_has_changed(struct acpi_processor *pr) int acpi_processor_cst_has_changed(struct acpi_processor *pr)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_processor_cst_has_changed");
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
if (nocst) { if (nocst) {
return_VALUE(-ENODEV); return -ENODEV;
} }
if (!pr->flags.power_setup_done) if (!pr->flags.power_setup_done)
return_VALUE(-ENODEV); return -ENODEV;
/* Fall back to the default idle loop */ /* Fall back to the default idle loop */
pm_idle = pm_idle_save; pm_idle = pm_idle_save;
...@@ -1000,7 +992,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) ...@@ -1000,7 +992,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
pm_idle = acpi_processor_idle; pm_idle = acpi_processor_idle;
return_VALUE(result); return result;
} }
/* proc interface */ /* proc interface */
...@@ -1010,7 +1002,6 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) ...@@ -1010,7 +1002,6 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
struct acpi_processor *pr = (struct acpi_processor *)seq->private; struct acpi_processor *pr = (struct acpi_processor *)seq->private;
unsigned int i; unsigned int i;
ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show");
if (!pr) if (!pr)
goto end; goto end;
...@@ -1068,7 +1059,7 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) ...@@ -1068,7 +1059,7 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
} }
end: end:
return_VALUE(0); return 0;
} }
static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) static int acpi_processor_power_open_fs(struct inode *inode, struct file *file)
...@@ -1092,7 +1083,6 @@ int acpi_processor_power_init(struct acpi_processor *pr, ...@@ -1092,7 +1083,6 @@ int acpi_processor_power_init(struct acpi_processor *pr,
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
unsigned int i; unsigned int i;
ACPI_FUNCTION_TRACE("acpi_processor_power_init");
if (!first_run) { if (!first_run) {
dmi_check_system(processor_power_dmi_table); dmi_check_system(processor_power_dmi_table);
...@@ -1104,7 +1094,7 @@ int acpi_processor_power_init(struct acpi_processor *pr, ...@@ -1104,7 +1094,7 @@ int acpi_processor_power_init(struct acpi_processor *pr,
} }
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
if (acpi_fadt.cst_cnt && !nocst) { if (acpi_fadt.cst_cnt && !nocst) {
status = status =
...@@ -1149,13 +1139,12 @@ int acpi_processor_power_init(struct acpi_processor *pr, ...@@ -1149,13 +1139,12 @@ int acpi_processor_power_init(struct acpi_processor *pr,
pr->flags.power_setup_done = 1; pr->flags.power_setup_done = 1;
return_VALUE(0); return 0;
} }
int acpi_processor_power_exit(struct acpi_processor *pr, int acpi_processor_power_exit(struct acpi_processor *pr,
struct acpi_device *device) struct acpi_device *device)
{ {
ACPI_FUNCTION_TRACE("acpi_processor_power_exit");
pr->flags.power_setup_done = 0; pr->flags.power_setup_done = 0;
...@@ -1175,5 +1164,5 @@ int acpi_processor_power_exit(struct acpi_processor *pr, ...@@ -1175,5 +1164,5 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
cpu_idle_wait(); cpu_idle_wait();
} }
return_VALUE(0); return 0;
} }
...@@ -108,10 +108,9 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) ...@@ -108,10 +108,9 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
acpi_status status = 0; acpi_status status = 0;
unsigned long ppc = 0; unsigned long ppc = 0;
ACPI_FUNCTION_TRACE("acpi_processor_get_platform_limit");
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
/* /*
* _PPC indicates the maximum state currently supported by the platform * _PPC indicates the maximum state currently supported by the platform
...@@ -124,12 +123,12 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) ...@@ -124,12 +123,12 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC"));
return_VALUE(-ENODEV); return -ENODEV;
} }
pr->performance_platform_limit = (int)ppc; pr->performance_platform_limit = (int)ppc;
return_VALUE(0); return 0;
} }
int acpi_processor_ppc_has_changed(struct acpi_processor *pr) int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
...@@ -168,12 +167,11 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) ...@@ -168,12 +167,11 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
union acpi_object *pct = NULL; union acpi_object *pct = NULL;
union acpi_object obj = { 0 }; union acpi_object obj = { 0 };
ACPI_FUNCTION_TRACE("acpi_processor_get_performance_control");
status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PCT")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PCT"));
return_VALUE(-ENODEV); return -ENODEV;
} }
pct = (union acpi_object *)buffer.pointer; pct = (union acpi_object *)buffer.pointer;
...@@ -220,7 +218,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) ...@@ -220,7 +218,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
end: end:
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_VALUE(result); return result;
} }
static int acpi_processor_get_performance_states(struct acpi_processor *pr) static int acpi_processor_get_performance_states(struct acpi_processor *pr)
...@@ -233,12 +231,11 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) ...@@ -233,12 +231,11 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
union acpi_object *pss = NULL; union acpi_object *pss = NULL;
int i; int i;
ACPI_FUNCTION_TRACE("acpi_processor_get_performance_states");
status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PSS")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PSS"));
return_VALUE(-ENODEV); return -ENODEV;
} }
pss = (union acpi_object *)buffer.pointer; pss = (union acpi_object *)buffer.pointer;
...@@ -299,7 +296,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) ...@@ -299,7 +296,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
end: end:
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_VALUE(result); return result;
} }
static int acpi_processor_get_performance_info(struct acpi_processor *pr) static int acpi_processor_get_performance_info(struct acpi_processor *pr)
...@@ -308,31 +305,30 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr) ...@@ -308,31 +305,30 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_handle handle = NULL; acpi_handle handle = NULL;
ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info");
if (!pr || !pr->performance || !pr->handle) if (!pr || !pr->performance || !pr->handle)
return_VALUE(-EINVAL); return -EINVAL;
status = acpi_get_handle(pr->handle, "_PCT", &handle); status = acpi_get_handle(pr->handle, "_PCT", &handle);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"ACPI-based processor performance control unavailable\n")); "ACPI-based processor performance control unavailable\n"));
return_VALUE(-ENODEV); return -ENODEV;
} }
result = acpi_processor_get_performance_control(pr); result = acpi_processor_get_performance_control(pr);
if (result) if (result)
return_VALUE(result); return result;
result = acpi_processor_get_performance_states(pr); result = acpi_processor_get_performance_states(pr);
if (result) if (result)
return_VALUE(result); return result;
result = acpi_processor_get_platform_limit(pr); result = acpi_processor_get_platform_limit(pr);
if (result) if (result)
return_VALUE(result); return result;
return_VALUE(0); return 0;
} }
int acpi_processor_notify_smm(struct module *calling_module) int acpi_processor_notify_smm(struct module *calling_module)
...@@ -340,13 +336,12 @@ int acpi_processor_notify_smm(struct module *calling_module) ...@@ -340,13 +336,12 @@ int acpi_processor_notify_smm(struct module *calling_module)
acpi_status status; acpi_status status;
static int is_done = 0; static int is_done = 0;
ACPI_FUNCTION_TRACE("acpi_processor_notify_smm");
if (!(acpi_processor_ppc_status & PPC_REGISTERED)) if (!(acpi_processor_ppc_status & PPC_REGISTERED))
return_VALUE(-EBUSY); return -EBUSY;
if (!try_module_get(calling_module)) if (!try_module_get(calling_module))
return_VALUE(-EINVAL); return -EINVAL;
/* is_done is set to negative if an error occured, /* is_done is set to negative if an error occured,
* and to postitive if _no_ error occured, but SMM * and to postitive if _no_ error occured, but SMM
...@@ -355,10 +350,10 @@ int acpi_processor_notify_smm(struct module *calling_module) ...@@ -355,10 +350,10 @@ int acpi_processor_notify_smm(struct module *calling_module)
*/ */
if (is_done > 0) { if (is_done > 0) {
module_put(calling_module); module_put(calling_module);
return_VALUE(0); return 0;
} else if (is_done < 0) { } else if (is_done < 0) {
module_put(calling_module); module_put(calling_module);
return_VALUE(is_done); return is_done;
} }
is_done = -EIO; is_done = -EIO;
...@@ -367,7 +362,7 @@ int acpi_processor_notify_smm(struct module *calling_module) ...@@ -367,7 +362,7 @@ int acpi_processor_notify_smm(struct module *calling_module)
if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) { if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_cnt\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_cnt\n"));
module_put(calling_module); module_put(calling_module);
return_VALUE(0); return 0;
} }
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
...@@ -389,7 +384,7 @@ int acpi_processor_notify_smm(struct module *calling_module) ...@@ -389,7 +384,7 @@ int acpi_processor_notify_smm(struct module *calling_module)
"smi_cmd [0x%x]", acpi_fadt.pstate_cnt, "smi_cmd [0x%x]", acpi_fadt.pstate_cnt,
acpi_fadt.smi_cmd)); acpi_fadt.smi_cmd));
module_put(calling_module); module_put(calling_module);
return_VALUE(status); return status;
} }
/* Success. If there's no _PPC, we need to fear nothing, so /* Success. If there's no _PPC, we need to fear nothing, so
...@@ -399,7 +394,7 @@ int acpi_processor_notify_smm(struct module *calling_module) ...@@ -399,7 +394,7 @@ int acpi_processor_notify_smm(struct module *calling_module)
if (!(acpi_processor_ppc_status & PPC_IN_USE)) if (!(acpi_processor_ppc_status & PPC_IN_USE))
module_put(calling_module); module_put(calling_module);
return_VALUE(0); return 0;
} }
EXPORT_SYMBOL(acpi_processor_notify_smm); EXPORT_SYMBOL(acpi_processor_notify_smm);
...@@ -420,7 +415,6 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) ...@@ -420,7 +415,6 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset)
struct acpi_processor *pr = (struct acpi_processor *)seq->private; struct acpi_processor *pr = (struct acpi_processor *)seq->private;
int i; int i;
ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show");
if (!pr) if (!pr)
goto end; goto end;
...@@ -444,7 +438,7 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) ...@@ -444,7 +438,7 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset)
(u32) pr->performance->states[i].transition_latency); (u32) pr->performance->states[i].transition_latency);
end: end:
return_VALUE(0); return 0;
} }
static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
...@@ -466,23 +460,22 @@ acpi_processor_write_performance(struct file *file, ...@@ -466,23 +460,22 @@ acpi_processor_write_performance(struct file *file,
unsigned int new_state = 0; unsigned int new_state = 0;
struct cpufreq_policy policy; struct cpufreq_policy policy;
ACPI_FUNCTION_TRACE("acpi_processor_write_performance");
if (!pr || (count > sizeof(state_string) - 1)) if (!pr || (count > sizeof(state_string) - 1))
return_VALUE(-EINVAL); return -EINVAL;
perf = pr->performance; perf = pr->performance;
if (!perf) if (!perf)
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(state_string, buffer, count)) if (copy_from_user(state_string, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
state_string[count] = '\0'; state_string[count] = '\0';
new_state = simple_strtoul(state_string, NULL, 0); new_state = simple_strtoul(state_string, NULL, 0);
if (new_state >= perf->state_count) if (new_state >= perf->state_count)
return_VALUE(-EINVAL); return -EINVAL;
cpufreq_get_policy(&policy, pr->id); cpufreq_get_policy(&policy, pr->id);
...@@ -492,9 +485,9 @@ acpi_processor_write_performance(struct file *file, ...@@ -492,9 +485,9 @@ acpi_processor_write_performance(struct file *file,
result = cpufreq_set_policy(&policy); result = cpufreq_set_policy(&policy);
if (result) if (result)
return_VALUE(result); return result;
return_VALUE(count); return count;
} }
static void acpi_cpufreq_add_file(struct acpi_processor *pr) static void acpi_cpufreq_add_file(struct acpi_processor *pr)
...@@ -502,10 +495,9 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr) ...@@ -502,10 +495,9 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr)
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile");
if (acpi_bus_get_device(pr->handle, &device)) if (acpi_bus_get_device(pr->handle, &device))
return_VOID; return;
/* add file 'performance' [R/W] */ /* add file 'performance' [R/W] */
entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
...@@ -517,23 +509,22 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr) ...@@ -517,23 +509,22 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr)
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VOID; return;
} }
static void acpi_cpufreq_remove_file(struct acpi_processor *pr) static void acpi_cpufreq_remove_file(struct acpi_processor *pr)
{ {
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile");
if (acpi_bus_get_device(pr->handle, &device)) if (acpi_bus_get_device(pr->handle, &device))
return_VOID; return;
/* remove file 'performance' */ /* remove file 'performance' */
remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
acpi_device_dir(device)); acpi_device_dir(device));
return_VOID; return;
} }
#else #else
...@@ -777,22 +768,21 @@ acpi_processor_register_performance(struct acpi_processor_performance ...@@ -777,22 +768,21 @@ acpi_processor_register_performance(struct acpi_processor_performance
{ {
struct acpi_processor *pr; struct acpi_processor *pr;
ACPI_FUNCTION_TRACE("acpi_processor_register_performance");
if (!(acpi_processor_ppc_status & PPC_REGISTERED)) if (!(acpi_processor_ppc_status & PPC_REGISTERED))
return_VALUE(-EINVAL); return -EINVAL;
mutex_lock(&performance_mutex); mutex_lock(&performance_mutex);
pr = processors[cpu]; pr = processors[cpu];
if (!pr) { if (!pr) {
mutex_unlock(&performance_mutex); mutex_unlock(&performance_mutex);
return_VALUE(-ENODEV); return -ENODEV;
} }
if (pr->performance) { if (pr->performance) {
mutex_unlock(&performance_mutex); mutex_unlock(&performance_mutex);
return_VALUE(-EBUSY); return -EBUSY;
} }
WARN_ON(!performance); WARN_ON(!performance);
...@@ -802,13 +792,13 @@ acpi_processor_register_performance(struct acpi_processor_performance ...@@ -802,13 +792,13 @@ acpi_processor_register_performance(struct acpi_processor_performance
if (acpi_processor_get_performance_info(pr)) { if (acpi_processor_get_performance_info(pr)) {
pr->performance = NULL; pr->performance = NULL;
mutex_unlock(&performance_mutex); mutex_unlock(&performance_mutex);
return_VALUE(-EIO); return -EIO;
} }
acpi_cpufreq_add_file(pr); acpi_cpufreq_add_file(pr);
mutex_unlock(&performance_mutex); mutex_unlock(&performance_mutex);
return_VALUE(0); return 0;
} }
EXPORT_SYMBOL(acpi_processor_register_performance); EXPORT_SYMBOL(acpi_processor_register_performance);
...@@ -819,14 +809,13 @@ acpi_processor_unregister_performance(struct acpi_processor_performance ...@@ -819,14 +809,13 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
{ {
struct acpi_processor *pr; struct acpi_processor *pr;
ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance");
mutex_lock(&performance_mutex); mutex_lock(&performance_mutex);
pr = processors[cpu]; pr = processors[cpu];
if (!pr) { if (!pr) {
mutex_unlock(&performance_mutex); mutex_unlock(&performance_mutex);
return_VOID; return;
} }
if (pr->performance) if (pr->performance)
...@@ -837,7 +826,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance ...@@ -837,7 +826,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
mutex_unlock(&performance_mutex); mutex_unlock(&performance_mutex);
return_VOID; return;
} }
EXPORT_SYMBOL(acpi_processor_unregister_performance); EXPORT_SYMBOL(acpi_processor_unregister_performance);
...@@ -54,13 +54,12 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) ...@@ -54,13 +54,12 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr)
u16 px = 0; u16 px = 0;
u16 tx = 0; u16 tx = 0;
ACPI_FUNCTION_TRACE("acpi_processor_apply_limit");
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
if (!pr->flags.limit) if (!pr->flags.limit)
return_VALUE(-ENODEV); return -ENODEV;
if (pr->flags.throttling) { if (pr->flags.throttling) {
if (pr->limit.user.tx > tx) if (pr->limit.user.tx > tx)
...@@ -84,7 +83,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) ...@@ -84,7 +83,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr)
if (result) if (result)
printk(KERN_ERR PREFIX "Unable to set limit\n"); printk(KERN_ERR PREFIX "Unable to set limit\n");
return_VALUE(result); return result;
} }
#ifdef CONFIG_CPU_FREQ #ifdef CONFIG_CPU_FREQ
...@@ -200,19 +199,18 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) ...@@ -200,19 +199,18 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type)
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
int tx = 0, max_tx_px = 0; int tx = 0, max_tx_px = 0;
ACPI_FUNCTION_TRACE("acpi_processor_set_thermal_limit");
if ((type < ACPI_PROCESSOR_LIMIT_NONE) if ((type < ACPI_PROCESSOR_LIMIT_NONE)
|| (type > ACPI_PROCESSOR_LIMIT_DECREMENT)) || (type > ACPI_PROCESSOR_LIMIT_DECREMENT))
return_VALUE(-EINVAL); return -EINVAL;
result = acpi_bus_get_device(handle, &device); result = acpi_bus_get_device(handle, &device);
if (result) if (result)
return_VALUE(result); return result;
pr = (struct acpi_processor *)acpi_driver_data(device); pr = (struct acpi_processor *)acpi_driver_data(device);
if (!pr) if (!pr)
return_VALUE(-ENODEV); return -ENODEV;
/* Thermal limits are always relative to the current Px/Tx state. */ /* Thermal limits are always relative to the current Px/Tx state. */
if (pr->flags.throttling) if (pr->flags.throttling)
...@@ -296,22 +294,21 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) ...@@ -296,22 +294,21 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type)
} else } else
result = 0; result = 0;
if (max_tx_px) if (max_tx_px)
return_VALUE(1); return 1;
else else
return_VALUE(result); return result;
} }
int acpi_processor_get_limit_info(struct acpi_processor *pr) int acpi_processor_get_limit_info(struct acpi_processor *pr)
{ {
ACPI_FUNCTION_TRACE("acpi_processor_get_limit_info");
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
if (pr->flags.throttling) if (pr->flags.throttling)
pr->flags.limit = 1; pr->flags.limit = 1;
return_VALUE(0); return 0;
} }
/* /proc interface */ /* /proc interface */
...@@ -320,7 +317,6 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) ...@@ -320,7 +317,6 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_processor *pr = (struct acpi_processor *)seq->private; struct acpi_processor *pr = (struct acpi_processor *)seq->private;
ACPI_FUNCTION_TRACE("acpi_processor_limit_seq_show");
if (!pr) if (!pr)
goto end; goto end;
...@@ -338,7 +334,7 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) ...@@ -338,7 +334,7 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
pr->limit.thermal.px, pr->limit.thermal.tx); pr->limit.thermal.px, pr->limit.thermal.tx);
end: end:
return_VALUE(0); return 0;
} }
static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file)
...@@ -358,34 +354,33 @@ static ssize_t acpi_processor_write_limit(struct file * file, ...@@ -358,34 +354,33 @@ static ssize_t acpi_processor_write_limit(struct file * file,
int px = 0; int px = 0;
int tx = 0; int tx = 0;
ACPI_FUNCTION_TRACE("acpi_processor_write_limit");
if (!pr || (count > sizeof(limit_string) - 1)) { if (!pr || (count > sizeof(limit_string) - 1)) {
return_VALUE(-EINVAL); return -EINVAL;
} }
if (copy_from_user(limit_string, buffer, count)) { if (copy_from_user(limit_string, buffer, count)) {
return_VALUE(-EFAULT); return -EFAULT;
} }
limit_string[count] = '\0'; limit_string[count] = '\0';
if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) {
printk(KERN_ERR PREFIX "Invalid data format\n"); printk(KERN_ERR PREFIX "Invalid data format\n");
return_VALUE(-EINVAL); return -EINVAL;
} }
if (pr->flags.throttling) { if (pr->flags.throttling) {
if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) {
printk(KERN_ERR PREFIX "Invalid tx\n"); printk(KERN_ERR PREFIX "Invalid tx\n");
return_VALUE(-EINVAL); return -EINVAL;
} }
pr->limit.user.tx = tx; pr->limit.user.tx = tx;
} }
result = acpi_processor_apply_limit(pr); result = acpi_processor_apply_limit(pr);
return_VALUE(count); return count;
} }
struct file_operations acpi_processor_limit_fops = { struct file_operations acpi_processor_limit_fops = {
......
...@@ -55,13 +55,12 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) ...@@ -55,13 +55,12 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr)
u32 duty_mask = 0; u32 duty_mask = 0;
u32 duty_value = 0; u32 duty_value = 0;
ACPI_FUNCTION_TRACE("acpi_processor_get_throttling");
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
if (!pr->flags.throttling) if (!pr->flags.throttling)
return_VALUE(-ENODEV); return -ENODEV;
pr->throttling.state = 0; pr->throttling.state = 0;
...@@ -93,7 +92,7 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) ...@@ -93,7 +92,7 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr)
"Throttling state is T%d (%d%% throttling applied)\n", "Throttling state is T%d (%d%% throttling applied)\n",
state, pr->throttling.states[state].performance)); state, pr->throttling.states[state].performance));
return_VALUE(0); return 0;
} }
int acpi_processor_set_throttling(struct acpi_processor *pr, int state) int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
...@@ -102,19 +101,18 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) ...@@ -102,19 +101,18 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
u32 duty_mask = 0; u32 duty_mask = 0;
u32 duty_value = 0; u32 duty_value = 0;
ACPI_FUNCTION_TRACE("acpi_processor_set_throttling");
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
if ((state < 0) || (state > (pr->throttling.state_count - 1))) if ((state < 0) || (state > (pr->throttling.state_count - 1)))
return_VALUE(-EINVAL); return -EINVAL;
if (!pr->flags.throttling) if (!pr->flags.throttling)
return_VALUE(-ENODEV); return -ENODEV;
if (state == pr->throttling.state) if (state == pr->throttling.state)
return_VALUE(0); return 0;
/* /*
* Calculate the duty_value and duty_mask. * Calculate the duty_value and duty_mask.
...@@ -165,7 +163,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) ...@@ -165,7 +163,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
(pr->throttling.states[state].performance ? pr-> (pr->throttling.states[state].performance ? pr->
throttling.states[state].performance / 10 : 0))); throttling.states[state].performance / 10 : 0)));
return_VALUE(0); return 0;
} }
int acpi_processor_get_throttling_info(struct acpi_processor *pr) int acpi_processor_get_throttling_info(struct acpi_processor *pr)
...@@ -174,7 +172,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) ...@@ -174,7 +172,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
int step = 0; int step = 0;
int i = 0; int i = 0;
ACPI_FUNCTION_TRACE("acpi_processor_get_throttling_info");
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
...@@ -183,21 +180,21 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) ...@@ -183,21 +180,21 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
pr->throttling.duty_width)); pr->throttling.duty_width));
if (!pr) if (!pr)
return_VALUE(-EINVAL); return -EINVAL;
/* TBD: Support ACPI 2.0 objects */ /* TBD: Support ACPI 2.0 objects */
if (!pr->throttling.address) { if (!pr->throttling.address) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
return_VALUE(0); return 0;
} else if (!pr->throttling.duty_width) { } else if (!pr->throttling.duty_width) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n"));
return_VALUE(0); return 0;
} }
/* TBD: Support duty_cycle values that span bit 4. */ /* TBD: Support duty_cycle values that span bit 4. */
else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n");
return_VALUE(0); return 0;
} }
/* /*
...@@ -208,7 +205,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) ...@@ -208,7 +205,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
if (errata.piix4.throttle) { if (errata.piix4.throttle) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Throttling not supported on PIIX4 A- or B-step\n")); "Throttling not supported on PIIX4 A- or B-step\n"));
return_VALUE(0); return 0;
} }
pr->throttling.state_count = 1 << acpi_fadt.duty_width; pr->throttling.state_count = 1 << acpi_fadt.duty_width;
...@@ -254,7 +251,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) ...@@ -254,7 +251,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
if (result) if (result)
pr->flags.throttling = 0; pr->flags.throttling = 0;
return_VALUE(result); return result;
} }
/* proc interface */ /* proc interface */
...@@ -266,7 +263,6 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, ...@@ -266,7 +263,6 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq,
int i = 0; int i = 0;
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_processor_throttling_seq_show");
if (!pr) if (!pr)
goto end; goto end;
...@@ -296,7 +292,7 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, ...@@ -296,7 +292,7 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq,
throttling.states[i].performance / 10 : 0)); throttling.states[i].performance / 10 : 0));
end: end:
return_VALUE(0); return 0;
} }
static int acpi_processor_throttling_open_fs(struct inode *inode, static int acpi_processor_throttling_open_fs(struct inode *inode,
...@@ -315,13 +311,12 @@ static ssize_t acpi_processor_write_throttling(struct file * file, ...@@ -315,13 +311,12 @@ static ssize_t acpi_processor_write_throttling(struct file * file,
struct acpi_processor *pr = (struct acpi_processor *)m->private; struct acpi_processor *pr = (struct acpi_processor *)m->private;
char state_string[12] = { '\0' }; char state_string[12] = { '\0' };
ACPI_FUNCTION_TRACE("acpi_processor_write_throttling");
if (!pr || (count > sizeof(state_string) - 1)) if (!pr || (count > sizeof(state_string) - 1))
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(state_string, buffer, count)) if (copy_from_user(state_string, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
state_string[count] = '\0'; state_string[count] = '\0';
...@@ -329,9 +324,9 @@ static ssize_t acpi_processor_write_throttling(struct file * file, ...@@ -329,9 +324,9 @@ static ssize_t acpi_processor_write_throttling(struct file * file,
simple_strtoul(state_string, simple_strtoul(state_string,
NULL, 0)); NULL, 0));
if (result) if (result)
return_VALUE(result); return result;
return_VALUE(count); return count;
} }
struct file_operations acpi_processor_throttling_fops = { struct file_operations acpi_processor_throttling_fops = {
......
...@@ -162,11 +162,10 @@ static void acpi_device_unregister(struct acpi_device *device, int type) ...@@ -162,11 +162,10 @@ static void acpi_device_unregister(struct acpi_device *device, int type)
void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context)
{ {
ACPI_FUNCTION_TRACE("acpi_bus_data_handler");
/* TBD */ /* TBD */
return_VOID; return;
} }
static int acpi_bus_get_power_flags(struct acpi_device *device) static int acpi_bus_get_power_flags(struct acpi_device *device)
...@@ -175,7 +174,6 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) ...@@ -175,7 +174,6 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
acpi_handle handle = NULL; acpi_handle handle = NULL;
u32 i = 0; u32 i = 0;
ACPI_FUNCTION_TRACE("acpi_bus_get_power_flags");
/* /*
* Power Management Flags * Power Management Flags
...@@ -228,7 +226,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) ...@@ -228,7 +226,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
device->power.state = ACPI_STATE_UNKNOWN; device->power.state = ACPI_STATE_UNKNOWN;
return_VALUE(0); return 0;
} }
int acpi_match_ids(struct acpi_device *device, char *ids) int acpi_match_ids(struct acpi_device *device, char *ids)
...@@ -306,7 +304,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) ...@@ -306,7 +304,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *package = NULL; union acpi_object *package = NULL;
ACPI_FUNCTION_TRACE("acpi_bus_get_wakeup_flags");
/* _PRW */ /* _PRW */
status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer);
...@@ -332,7 +329,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) ...@@ -332,7 +329,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
end: end:
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
device->flags.wake_capable = 0; device->flags.wake_capable = 0;
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -488,19 +485,18 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) ...@@ -488,19 +485,18 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_bus_driver_init");
if (!device || !driver) if (!device || !driver)
return_VALUE(-EINVAL); return -EINVAL;
if (!driver->ops.add) if (!driver->ops.add)
return_VALUE(-ENOSYS); return -ENOSYS;
result = driver->ops.add(device); result = driver->ops.add(device);
if (result) { if (result) {
device->driver = NULL; device->driver = NULL;
acpi_driver_data(device) = NULL; acpi_driver_data(device) = NULL;
return_VALUE(result); return result;
} }
device->driver = driver; device->driver = driver;
...@@ -512,7 +508,7 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) ...@@ -512,7 +508,7 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Driver successfully bound to device\n")); "Driver successfully bound to device\n"));
return_VALUE(0); return 0;
} }
static int acpi_start_single_object(struct acpi_device *device) static int acpi_start_single_object(struct acpi_device *device)
...@@ -520,10 +516,9 @@ static int acpi_start_single_object(struct acpi_device *device) ...@@ -520,10 +516,9 @@ static int acpi_start_single_object(struct acpi_device *device)
int result = 0; int result = 0;
struct acpi_driver *driver; struct acpi_driver *driver;
ACPI_FUNCTION_TRACE("acpi_start_single_object");
if (!(driver = device->driver)) if (!(driver = device->driver))
return_VALUE(0); return 0;
if (driver->ops.start) { if (driver->ops.start) {
result = driver->ops.start(device); result = driver->ops.start(device);
...@@ -531,14 +526,13 @@ static int acpi_start_single_object(struct acpi_device *device) ...@@ -531,14 +526,13 @@ static int acpi_start_single_object(struct acpi_device *device)
driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL); driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL);
} }
return_VALUE(result); return result;
} }
static void acpi_driver_attach(struct acpi_driver *drv) static void acpi_driver_attach(struct acpi_driver *drv)
{ {
struct list_head *node, *next; struct list_head *node, *next;
ACPI_FUNCTION_TRACE("acpi_driver_attach");
spin_lock(&acpi_device_lock); spin_lock(&acpi_device_lock);
list_for_each_safe(node, next, &acpi_device_list) { list_for_each_safe(node, next, &acpi_device_list) {
...@@ -567,7 +561,6 @@ static void acpi_driver_detach(struct acpi_driver *drv) ...@@ -567,7 +561,6 @@ static void acpi_driver_detach(struct acpi_driver *drv)
{ {
struct list_head *node, *next; struct list_head *node, *next;
ACPI_FUNCTION_TRACE("acpi_driver_detach");
spin_lock(&acpi_device_lock); spin_lock(&acpi_device_lock);
list_for_each_safe(node, next, &acpi_device_list) { list_for_each_safe(node, next, &acpi_device_list) {
...@@ -597,17 +590,16 @@ static void acpi_driver_detach(struct acpi_driver *drv) ...@@ -597,17 +590,16 @@ static void acpi_driver_detach(struct acpi_driver *drv)
*/ */
int acpi_bus_register_driver(struct acpi_driver *driver) int acpi_bus_register_driver(struct acpi_driver *driver)
{ {
ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
if (acpi_disabled) if (acpi_disabled)
return_VALUE(-ENODEV); return -ENODEV;
spin_lock(&acpi_device_lock); spin_lock(&acpi_device_lock);
list_add_tail(&driver->node, &acpi_bus_drivers); list_add_tail(&driver->node, &acpi_bus_drivers);
spin_unlock(&acpi_device_lock); spin_unlock(&acpi_device_lock);
acpi_driver_attach(driver); acpi_driver_attach(driver);
return_VALUE(0); return 0;
} }
EXPORT_SYMBOL(acpi_bus_register_driver); EXPORT_SYMBOL(acpi_bus_register_driver);
...@@ -645,7 +637,6 @@ static int acpi_bus_find_driver(struct acpi_device *device) ...@@ -645,7 +637,6 @@ static int acpi_bus_find_driver(struct acpi_device *device)
int result = 0; int result = 0;
struct list_head *node, *next; struct list_head *node, *next;
ACPI_FUNCTION_TRACE("acpi_bus_find_driver");
spin_lock(&acpi_device_lock); spin_lock(&acpi_device_lock);
list_for_each_safe(node, next, &acpi_bus_drivers) { list_for_each_safe(node, next, &acpi_bus_drivers) {
...@@ -665,7 +656,7 @@ static int acpi_bus_find_driver(struct acpi_device *device) ...@@ -665,7 +656,7 @@ static int acpi_bus_find_driver(struct acpi_device *device)
spin_unlock(&acpi_device_lock); spin_unlock(&acpi_device_lock);
Done: Done:
return_VALUE(result); return result;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -677,7 +668,6 @@ static int acpi_bus_get_flags(struct acpi_device *device) ...@@ -677,7 +668,6 @@ static int acpi_bus_get_flags(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_handle temp = NULL; acpi_handle temp = NULL;
ACPI_FUNCTION_TRACE("acpi_bus_get_flags");
/* Presence of _STA indicates 'dynamic_status' */ /* Presence of _STA indicates 'dynamic_status' */
status = acpi_get_handle(device->handle, "_STA", &temp); status = acpi_get_handle(device->handle, "_STA", &temp);
...@@ -723,7 +713,7 @@ static int acpi_bus_get_flags(struct acpi_device *device) ...@@ -723,7 +713,7 @@ static int acpi_bus_get_flags(struct acpi_device *device)
/* TBD: Peformance management */ /* TBD: Peformance management */
return_VALUE(0); return 0;
} }
static void acpi_device_get_busid(struct acpi_device *device, static void acpi_device_get_busid(struct acpi_device *device,
...@@ -917,10 +907,9 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) ...@@ -917,10 +907,9 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
int result = 0; int result = 0;
struct acpi_driver *driver; struct acpi_driver *driver;
ACPI_FUNCTION_TRACE("acpi_bus_remove");
if (!dev) if (!dev)
return_VALUE(-EINVAL); return -EINVAL;
driver = dev->driver; driver = dev->driver;
...@@ -929,12 +918,12 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) ...@@ -929,12 +918,12 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
if (driver->ops.stop) { if (driver->ops.stop) {
result = driver->ops.stop(dev, ACPI_BUS_REMOVAL_EJECT); result = driver->ops.stop(dev, ACPI_BUS_REMOVAL_EJECT);
if (result) if (result)
return_VALUE(result); return result;
} }
result = dev->driver->ops.remove(dev, ACPI_BUS_REMOVAL_EJECT); result = dev->driver->ops.remove(dev, ACPI_BUS_REMOVAL_EJECT);
if (result) { if (result) {
return_VALUE(result); return result;
} }
atomic_dec(&dev->driver->references); atomic_dec(&dev->driver->references);
...@@ -943,7 +932,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) ...@@ -943,7 +932,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
} }
if (!rmdevice) if (!rmdevice)
return_VALUE(0); return 0;
if (dev->flags.bus_address) { if (dev->flags.bus_address) {
if ((dev->parent) && (dev->parent->ops.unbind)) if ((dev->parent) && (dev->parent->ops.unbind))
...@@ -952,7 +941,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) ...@@ -952,7 +941,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT); acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT);
return_VALUE(0); return 0;
} }
static int static int
...@@ -962,15 +951,14 @@ acpi_add_single_object(struct acpi_device **child, ...@@ -962,15 +951,14 @@ acpi_add_single_object(struct acpi_device **child,
int result = 0; int result = 0;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_add_single_object");
if (!child) if (!child)
return_VALUE(-EINVAL); return -EINVAL;
device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL); device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL);
if (!device) { if (!device) {
printk(KERN_ERR PREFIX "Memory allocation error\n"); printk(KERN_ERR PREFIX "Memory allocation error\n");
return_VALUE(-ENOMEM); return -ENOMEM;
} }
memset(device, 0, sizeof(struct acpi_device)); memset(device, 0, sizeof(struct acpi_device));
...@@ -1095,7 +1083,7 @@ acpi_add_single_object(struct acpi_device **child, ...@@ -1095,7 +1083,7 @@ acpi_add_single_object(struct acpi_device **child,
kfree(device); kfree(device);
} }
return_VALUE(result); return result;
} }
static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
...@@ -1108,10 +1096,9 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) ...@@ -1108,10 +1096,9 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
acpi_object_type type = 0; acpi_object_type type = 0;
u32 level = 1; u32 level = 1;
ACPI_FUNCTION_TRACE("acpi_bus_scan");
if (!start) if (!start)
return_VALUE(-EINVAL); return -EINVAL;
parent = start; parent = start;
phandle = start->handle; phandle = start->handle;
...@@ -1208,7 +1195,7 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) ...@@ -1208,7 +1195,7 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
} }
} }
return_VALUE(0); return 0;
} }
int int
...@@ -1218,7 +1205,6 @@ acpi_bus_add(struct acpi_device **child, ...@@ -1218,7 +1205,6 @@ acpi_bus_add(struct acpi_device **child,
int result; int result;
struct acpi_bus_ops ops; struct acpi_bus_ops ops;
ACPI_FUNCTION_TRACE("acpi_bus_add");
result = acpi_add_single_object(child, parent, handle, type); result = acpi_add_single_object(child, parent, handle, type);
if (!result) { if (!result) {
...@@ -1226,7 +1212,7 @@ acpi_bus_add(struct acpi_device **child, ...@@ -1226,7 +1212,7 @@ acpi_bus_add(struct acpi_device **child,
ops.acpi_op_add = 1; ops.acpi_op_add = 1;
result = acpi_bus_scan(*child, &ops); result = acpi_bus_scan(*child, &ops);
} }
return_VALUE(result); return result;
} }
EXPORT_SYMBOL(acpi_bus_add); EXPORT_SYMBOL(acpi_bus_add);
...@@ -1236,10 +1222,9 @@ int acpi_bus_start(struct acpi_device *device) ...@@ -1236,10 +1222,9 @@ int acpi_bus_start(struct acpi_device *device)
int result; int result;
struct acpi_bus_ops ops; struct acpi_bus_ops ops;
ACPI_FUNCTION_TRACE("acpi_bus_start");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
result = acpi_start_single_object(device); result = acpi_start_single_object(device);
if (!result) { if (!result) {
...@@ -1247,7 +1232,7 @@ int acpi_bus_start(struct acpi_device *device) ...@@ -1247,7 +1232,7 @@ int acpi_bus_start(struct acpi_device *device)
ops.acpi_op_start = 1; ops.acpi_op_start = 1;
result = acpi_bus_scan(device, &ops); result = acpi_bus_scan(device, &ops);
} }
return_VALUE(result); return result;
} }
EXPORT_SYMBOL(acpi_bus_start); EXPORT_SYMBOL(acpi_bus_start);
...@@ -1313,10 +1298,9 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) ...@@ -1313,10 +1298,9 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
int result = 0; int result = 0;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed");
if (!root) if (!root)
return_VALUE(-ENODEV); return -ENODEV;
/* /*
* Enumerate all fixed-feature devices. * Enumerate all fixed-feature devices.
...@@ -1337,7 +1321,7 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) ...@@ -1337,7 +1321,7 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
result = acpi_start_single_object(device); result = acpi_start_single_object(device);
} }
return_VALUE(result); return result;
} }
...@@ -1439,10 +1423,9 @@ static int __init acpi_scan_init(void) ...@@ -1439,10 +1423,9 @@ static int __init acpi_scan_init(void)
int result; int result;
struct acpi_bus_ops ops; struct acpi_bus_ops ops;
ACPI_FUNCTION_TRACE("acpi_scan_init");
if (acpi_disabled) if (acpi_disabled)
return_VALUE(0); return 0;
kset_register(&acpi_namespace_kset); kset_register(&acpi_namespace_kset);
...@@ -1487,7 +1470,7 @@ static int __init acpi_scan_init(void) ...@@ -1487,7 +1470,7 @@ static int __init acpi_scan_init(void)
acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
Done: Done:
return_VALUE(result); return result;
} }
subsys_initcall(acpi_scan_init); subsys_initcall(acpi_scan_init);
...@@ -47,10 +47,9 @@ extern struct fadt_descriptor acpi_fadt; ...@@ -47,10 +47,9 @@ extern struct fadt_descriptor acpi_fadt;
static int acpi_system_read_info(struct seq_file *seq, void *offset) static int acpi_system_read_info(struct seq_file *seq, void *offset)
{ {
ACPI_FUNCTION_TRACE("acpi_system_read_info");
seq_printf(seq, "version: %x\n", ACPI_CA_VERSION); seq_printf(seq, "version: %x\n", ACPI_CA_VERSION);
return_VALUE(0); return 0;
} }
static int acpi_system_info_open_fs(struct inode *inode, struct file *file) static int acpi_system_info_open_fs(struct inode *inode, struct file *file)
...@@ -80,17 +79,16 @@ acpi_system_read_dsdt(struct file *file, ...@@ -80,17 +79,16 @@ acpi_system_read_dsdt(struct file *file,
struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL };
ssize_t res; ssize_t res;
ACPI_FUNCTION_TRACE("acpi_system_read_dsdt");
status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
res = simple_read_from_buffer(buffer, count, ppos, res = simple_read_from_buffer(buffer, count, ppos,
dsdt.pointer, dsdt.length); dsdt.pointer, dsdt.length);
acpi_os_free(dsdt.pointer); acpi_os_free(dsdt.pointer);
return_VALUE(res); return res;
} }
static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t, static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t,
...@@ -108,17 +106,16 @@ acpi_system_read_fadt(struct file *file, ...@@ -108,17 +106,16 @@ acpi_system_read_fadt(struct file *file,
struct acpi_buffer fadt = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer fadt = { ACPI_ALLOCATE_BUFFER, NULL };
ssize_t res; ssize_t res;
ACPI_FUNCTION_TRACE("acpi_system_read_fadt");
status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt); status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
res = simple_read_from_buffer(buffer, count, ppos, res = simple_read_from_buffer(buffer, count, ppos,
fadt.pointer, fadt.length); fadt.pointer, fadt.length);
acpi_os_free(fadt.pointer); acpi_os_free(fadt.pointer);
return_VALUE(res); return res;
} }
static int __init acpi_system_init(void) static int __init acpi_system_init(void)
...@@ -127,10 +124,9 @@ static int __init acpi_system_init(void) ...@@ -127,10 +124,9 @@ static int __init acpi_system_init(void)
int error = 0; int error = 0;
char *name; char *name;
ACPI_FUNCTION_TRACE("acpi_system_init");
if (acpi_disabled) if (acpi_disabled)
return_VALUE(0); return 0;
/* 'info' [R] */ /* 'info' [R] */
name = ACPI_SYSTEM_FILE_INFO; name = ACPI_SYSTEM_FILE_INFO;
...@@ -158,7 +154,7 @@ static int __init acpi_system_init(void) ...@@ -158,7 +154,7 @@ static int __init acpi_system_init(void)
goto Error; goto Error;
Done: Done:
return_VALUE(error); return error;
Error: Error:
remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir);
......
...@@ -222,51 +222,48 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz) ...@@ -222,51 +222,48 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_thermal_get_temperature");
if (!tz) if (!tz)
return_VALUE(-EINVAL); return -EINVAL;
tz->last_temperature = tz->temperature; tz->last_temperature = tz->temperature;
status = status =
acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature); acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n",
tz->temperature)); tz->temperature));
return_VALUE(0); return 0;
} }
static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_thermal_get_polling_frequency");
if (!tz) if (!tz)
return_VALUE(-EINVAL); return -EINVAL;
status = status =
acpi_evaluate_integer(tz->handle, "_TZP", NULL, acpi_evaluate_integer(tz->handle, "_TZP", NULL,
&tz->polling_frequency); &tz->polling_frequency);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n",
tz->polling_frequency)); tz->polling_frequency));
return_VALUE(0); return 0;
} }
static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds)
{ {
ACPI_FUNCTION_TRACE("acpi_thermal_set_polling");
if (!tz) if (!tz)
return_VALUE(-EINVAL); return -EINVAL;
tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */ tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */
...@@ -274,7 +271,7 @@ static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) ...@@ -274,7 +271,7 @@ static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds)
"Polling frequency set to %lu seconds\n", "Polling frequency set to %lu seconds\n",
tz->polling_frequency)); tz->polling_frequency));
return_VALUE(0); return 0;
} }
static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
...@@ -284,29 +281,28 @@ static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) ...@@ -284,29 +281,28 @@ static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
struct acpi_object_list arg_list = { 1, &arg0 }; struct acpi_object_list arg_list = { 1, &arg0 };
acpi_handle handle = NULL; acpi_handle handle = NULL;
ACPI_FUNCTION_TRACE("acpi_thermal_set_cooling_mode");
if (!tz) if (!tz)
return_VALUE(-EINVAL); return -EINVAL;
status = acpi_get_handle(tz->handle, "_SCP", &handle); status = acpi_get_handle(tz->handle, "_SCP", &handle);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n"));
return_VALUE(-ENODEV); return -ENODEV;
} }
arg0.integer.value = mode; arg0.integer.value = mode;
status = acpi_evaluate_object(handle, NULL, &arg_list, NULL); status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
tz->cooling_mode = mode; tz->cooling_mode = mode;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n",
mode ? "passive" : "active")); mode ? "passive" : "active"));
return_VALUE(0); return 0;
} }
static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
...@@ -314,10 +310,9 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) ...@@ -314,10 +310,9 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
acpi_status status = AE_OK; acpi_status status = AE_OK;
int i = 0; int i = 0;
ACPI_FUNCTION_TRACE("acpi_thermal_get_trip_points");
if (!tz) if (!tz)
return_VALUE(-EINVAL); return -EINVAL;
/* Critical Shutdown (required) */ /* Critical Shutdown (required) */
...@@ -326,7 +321,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) ...@@ -326,7 +321,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
tz->trips.critical.flags.valid = 0; tz->trips.critical.flags.valid = 0;
ACPI_EXCEPTION((AE_INFO, status, "No critical threshold")); ACPI_EXCEPTION((AE_INFO, status, "No critical threshold"));
return_VALUE(-ENODEV); return -ENODEV;
} else { } else {
tz->trips.critical.flags.valid = 1; tz->trips.critical.flags.valid = 1;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
...@@ -417,24 +412,23 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) ...@@ -417,24 +412,23 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
"Invalid active threshold [%d]", i)); "Invalid active threshold [%d]", i));
} }
return_VALUE(0); return 0;
} }
static int acpi_thermal_get_devices(struct acpi_thermal *tz) static int acpi_thermal_get_devices(struct acpi_thermal *tz)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_thermal_get_devices");
if (!tz) if (!tz)
return_VALUE(-EINVAL); return -EINVAL;
status = status =
acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
return_VALUE(0); return 0;
} }
static int acpi_thermal_call_usermode(char *path) static int acpi_thermal_call_usermode(char *path)
...@@ -442,10 +436,9 @@ static int acpi_thermal_call_usermode(char *path) ...@@ -442,10 +436,9 @@ static int acpi_thermal_call_usermode(char *path)
char *argv[2] = { NULL, NULL }; char *argv[2] = { NULL, NULL };
char *envp[3] = { NULL, NULL, NULL }; char *envp[3] = { NULL, NULL, NULL };
ACPI_FUNCTION_TRACE("acpi_thermal_call_usermode");
if (!path) if (!path)
return_VALUE(-EINVAL); return -EINVAL;
argv[0] = path; argv[0] = path;
...@@ -455,7 +448,7 @@ static int acpi_thermal_call_usermode(char *path) ...@@ -455,7 +448,7 @@ static int acpi_thermal_call_usermode(char *path)
call_usermodehelper(argv[0], argv, envp, 0); call_usermodehelper(argv[0], argv, envp, 0);
return_VALUE(0); return 0;
} }
static int acpi_thermal_critical(struct acpi_thermal *tz) static int acpi_thermal_critical(struct acpi_thermal *tz)
...@@ -463,10 +456,9 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) ...@@ -463,10 +456,9 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
int result = 0; int result = 0;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_thermal_critical");
if (!tz || !tz->trips.critical.flags.valid) if (!tz || !tz->trips.critical.flags.valid)
return_VALUE(-EINVAL); return -EINVAL;
if (tz->temperature >= tz->trips.critical.temperature) { if (tz->temperature >= tz->trips.critical.temperature) {
printk(KERN_WARNING PREFIX "Critical trip point\n"); printk(KERN_WARNING PREFIX "Critical trip point\n");
...@@ -476,7 +468,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) ...@@ -476,7 +468,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
result = acpi_bus_get_device(tz->handle, &device); result = acpi_bus_get_device(tz->handle, &device);
if (result) if (result)
return_VALUE(result); return result;
printk(KERN_EMERG printk(KERN_EMERG
"Critical temperature reached (%ld C), shutting down.\n", "Critical temperature reached (%ld C), shutting down.\n",
...@@ -486,7 +478,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) ...@@ -486,7 +478,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF);
return_VALUE(0); return 0;
} }
static int acpi_thermal_hot(struct acpi_thermal *tz) static int acpi_thermal_hot(struct acpi_thermal *tz)
...@@ -494,10 +486,9 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) ...@@ -494,10 +486,9 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
int result = 0; int result = 0;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_thermal_hot");
if (!tz || !tz->trips.hot.flags.valid) if (!tz || !tz->trips.hot.flags.valid)
return_VALUE(-EINVAL); return -EINVAL;
if (tz->temperature >= tz->trips.hot.temperature) { if (tz->temperature >= tz->trips.hot.temperature) {
printk(KERN_WARNING PREFIX "Hot trip point\n"); printk(KERN_WARNING PREFIX "Hot trip point\n");
...@@ -507,14 +498,14 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) ...@@ -507,14 +498,14 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
result = acpi_bus_get_device(tz->handle, &device); result = acpi_bus_get_device(tz->handle, &device);
if (result) if (result)
return_VALUE(result); return result;
acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT,
tz->trips.hot.flags.enabled); tz->trips.hot.flags.enabled);
/* TBD: Call user-mode "sleep(S4)" function */ /* TBD: Call user-mode "sleep(S4)" function */
return_VALUE(0); return 0;
} }
static void acpi_thermal_passive(struct acpi_thermal *tz) static void acpi_thermal_passive(struct acpi_thermal *tz)
...@@ -524,7 +515,6 @@ static void acpi_thermal_passive(struct acpi_thermal *tz) ...@@ -524,7 +515,6 @@ static void acpi_thermal_passive(struct acpi_thermal *tz)
int trend = 0; int trend = 0;
int i = 0; int i = 0;
ACPI_FUNCTION_TRACE("acpi_thermal_passive");
if (!tz || !tz->trips.passive.flags.valid) if (!tz || !tz->trips.passive.flags.valid)
return; return;
...@@ -613,7 +603,6 @@ static void acpi_thermal_active(struct acpi_thermal *tz) ...@@ -613,7 +603,6 @@ static void acpi_thermal_active(struct acpi_thermal *tz)
int j = 0; int j = 0;
unsigned long maxtemp = 0; unsigned long maxtemp = 0;
ACPI_FUNCTION_TRACE("acpi_thermal_active");
if (!tz) if (!tz)
return; return;
...@@ -695,18 +684,17 @@ static void acpi_thermal_check(void *data) ...@@ -695,18 +684,17 @@ static void acpi_thermal_check(void *data)
int i = 0; int i = 0;
struct acpi_thermal_state state; struct acpi_thermal_state state;
ACPI_FUNCTION_TRACE("acpi_thermal_check");
if (!tz) { if (!tz) {
printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
return_VOID; return;
} }
state = tz->state; state = tz->state;
result = acpi_thermal_get_temperature(tz); result = acpi_thermal_get_temperature(tz);
if (result) if (result)
return_VOID; return;
memset(&tz->state, 0, sizeof(tz->state)); memset(&tz->state, 0, sizeof(tz->state));
...@@ -795,7 +783,7 @@ static void acpi_thermal_check(void *data) ...@@ -795,7 +783,7 @@ static void acpi_thermal_check(void *data)
} }
} }
return_VOID; return;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -808,7 +796,6 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) ...@@ -808,7 +796,6 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
ACPI_FUNCTION_TRACE("acpi_thermal_state_seq_show");
if (!tz) if (!tz)
goto end; goto end;
...@@ -831,7 +818,7 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) ...@@ -831,7 +818,7 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
} }
end: end:
return_VALUE(0); return 0;
} }
static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file) static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file)
...@@ -844,7 +831,6 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) ...@@ -844,7 +831,6 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset)
int result = 0; int result = 0;
struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
ACPI_FUNCTION_TRACE("acpi_thermal_temp_seq_show");
if (!tz) if (!tz)
goto end; goto end;
...@@ -857,7 +843,7 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) ...@@ -857,7 +843,7 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset)
KELVIN_TO_CELSIUS(tz->temperature)); KELVIN_TO_CELSIUS(tz->temperature));
end: end:
return_VALUE(0); return 0;
} }
static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file)
...@@ -871,7 +857,6 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) ...@@ -871,7 +857,6 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
int i = 0; int i = 0;
int j = 0; int j = 0;
ACPI_FUNCTION_TRACE("acpi_thermal_trip_seq_show");
if (!tz) if (!tz)
goto end; goto end;
...@@ -911,7 +896,7 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) ...@@ -911,7 +896,7 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
} }
end: end:
return_VALUE(0); return 0;
} }
static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file)
...@@ -932,18 +917,17 @@ acpi_thermal_write_trip_points(struct file *file, ...@@ -932,18 +917,17 @@ acpi_thermal_write_trip_points(struct file *file,
int *active; int *active;
int i = 0; int i = 0;
ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points");
limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL);
if (!limit_string) if (!limit_string)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN);
active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL);
if (!active) { if (!active) {
kfree(limit_string); kfree(limit_string);
return_VALUE(-ENOMEM); return -ENOMEM;
} }
if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) {
...@@ -980,14 +964,13 @@ acpi_thermal_write_trip_points(struct file *file, ...@@ -980,14 +964,13 @@ acpi_thermal_write_trip_points(struct file *file,
end: end:
kfree(active); kfree(active);
kfree(limit_string); kfree(limit_string);
return_VALUE(count); return count;
} }
static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
ACPI_FUNCTION_TRACE("acpi_thermal_cooling_seq_show");
if (!tz) if (!tz)
goto end; goto end;
...@@ -1003,7 +986,7 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) ...@@ -1003,7 +986,7 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
tz->cooling_mode ? "passive" : "active"); tz->cooling_mode ? "passive" : "active");
end: end:
return_VALUE(0); return 0;
} }
static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file) static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file)
...@@ -1022,16 +1005,15 @@ acpi_thermal_write_cooling_mode(struct file *file, ...@@ -1022,16 +1005,15 @@ acpi_thermal_write_cooling_mode(struct file *file,
int result = 0; int result = 0;
char mode_string[12] = { '\0' }; char mode_string[12] = { '\0' };
ACPI_FUNCTION_TRACE("acpi_thermal_write_cooling_mode");
if (!tz || (count > sizeof(mode_string) - 1)) if (!tz || (count > sizeof(mode_string) - 1))
return_VALUE(-EINVAL); return -EINVAL;
if (!tz->flags.cooling_mode) if (!tz->flags.cooling_mode)
return_VALUE(-ENODEV); return -ENODEV;
if (copy_from_user(mode_string, buffer, count)) if (copy_from_user(mode_string, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
mode_string[count] = '\0'; mode_string[count] = '\0';
...@@ -1039,18 +1021,17 @@ acpi_thermal_write_cooling_mode(struct file *file, ...@@ -1039,18 +1021,17 @@ acpi_thermal_write_cooling_mode(struct file *file,
simple_strtoul(mode_string, NULL, simple_strtoul(mode_string, NULL,
0)); 0));
if (result) if (result)
return_VALUE(result); return result;
acpi_thermal_check(tz); acpi_thermal_check(tz);
return_VALUE(count); return count;
} }
static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
ACPI_FUNCTION_TRACE("acpi_thermal_polling_seq_show");
if (!tz) if (!tz)
goto end; goto end;
...@@ -1064,7 +1045,7 @@ static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) ...@@ -1064,7 +1045,7 @@ static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset)
(tz->polling_frequency / 10)); (tz->polling_frequency / 10));
end: end:
return_VALUE(0); return 0;
} }
static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file)
...@@ -1084,13 +1065,12 @@ acpi_thermal_write_polling(struct file *file, ...@@ -1084,13 +1065,12 @@ acpi_thermal_write_polling(struct file *file,
char polling_string[12] = { '\0' }; char polling_string[12] = { '\0' };
int seconds = 0; int seconds = 0;
ACPI_FUNCTION_TRACE("acpi_thermal_write_polling");
if (!tz || (count > sizeof(polling_string) - 1)) if (!tz || (count > sizeof(polling_string) - 1))
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(polling_string, buffer, count)) if (copy_from_user(polling_string, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
polling_string[count] = '\0'; polling_string[count] = '\0';
...@@ -1098,24 +1078,23 @@ acpi_thermal_write_polling(struct file *file, ...@@ -1098,24 +1078,23 @@ acpi_thermal_write_polling(struct file *file,
result = acpi_thermal_set_polling(tz, seconds); result = acpi_thermal_set_polling(tz, seconds);
if (result) if (result)
return_VALUE(result); return result;
acpi_thermal_check(tz); acpi_thermal_check(tz);
return_VALUE(count); return count;
} }
static int acpi_thermal_add_fs(struct acpi_device *device) static int acpi_thermal_add_fs(struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_thermal_add_fs");
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_thermal_dir); acpi_thermal_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
} }
...@@ -1123,7 +1102,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) ...@@ -1123,7 +1102,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, entry = create_proc_entry(ACPI_THERMAL_FILE_STATE,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_thermal_state_fops; entry->proc_fops = &acpi_thermal_state_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -1134,7 +1113,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) ...@@ -1134,7 +1113,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_thermal_temp_fops; entry->proc_fops = &acpi_thermal_temp_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -1146,7 +1125,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) ...@@ -1146,7 +1125,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_thermal_trip_fops; entry->proc_fops = &acpi_thermal_trip_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -1158,7 +1137,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) ...@@ -1158,7 +1137,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_thermal_cooling_fops; entry->proc_fops = &acpi_thermal_cooling_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -1170,19 +1149,18 @@ static int acpi_thermal_add_fs(struct acpi_device *device) ...@@ -1170,19 +1149,18 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_thermal_polling_fops; entry->proc_fops = &acpi_thermal_polling_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VALUE(0); return 0;
} }
static int acpi_thermal_remove_fs(struct acpi_device *device) static int acpi_thermal_remove_fs(struct acpi_device *device)
{ {
ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs");
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ,
...@@ -1199,7 +1177,7 @@ static int acpi_thermal_remove_fs(struct acpi_device *device) ...@@ -1199,7 +1177,7 @@ static int acpi_thermal_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -1211,13 +1189,12 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) ...@@ -1211,13 +1189,12 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
struct acpi_thermal *tz = (struct acpi_thermal *)data; struct acpi_thermal *tz = (struct acpi_thermal *)data;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_thermal_notify");
if (!tz) if (!tz)
return_VOID; return;
if (acpi_bus_get_device(tz->handle, &device)) if (acpi_bus_get_device(tz->handle, &device))
return_VOID; return;
switch (event) { switch (event) {
case ACPI_THERMAL_NOTIFY_TEMPERATURE: case ACPI_THERMAL_NOTIFY_TEMPERATURE:
...@@ -1239,27 +1216,26 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) ...@@ -1239,27 +1216,26 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
break; break;
} }
return_VOID; return;
} }
static int acpi_thermal_get_info(struct acpi_thermal *tz) static int acpi_thermal_get_info(struct acpi_thermal *tz)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_thermal_get_info");
if (!tz) if (!tz)
return_VALUE(-EINVAL); return -EINVAL;
/* Get temperature [_TMP] (required) */ /* Get temperature [_TMP] (required) */
result = acpi_thermal_get_temperature(tz); result = acpi_thermal_get_temperature(tz);
if (result) if (result)
return_VALUE(result); return result;
/* Get trip points [_CRT, _PSV, etc.] (required) */ /* Get trip points [_CRT, _PSV, etc.] (required) */
result = acpi_thermal_get_trip_points(tz); result = acpi_thermal_get_trip_points(tz);
if (result) if (result)
return_VALUE(result); return result;
/* Set the cooling mode [_SCP] to active cooling (default) */ /* Set the cooling mode [_SCP] to active cooling (default) */
result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
...@@ -1299,7 +1275,7 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz) ...@@ -1299,7 +1275,7 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
if (!result) if (!result)
tz->flags.devices = 1; tz->flags.devices = 1;
return_VALUE(0); return 0;
} }
static int acpi_thermal_add(struct acpi_device *device) static int acpi_thermal_add(struct acpi_device *device)
...@@ -1308,14 +1284,13 @@ static int acpi_thermal_add(struct acpi_device *device) ...@@ -1308,14 +1284,13 @@ static int acpi_thermal_add(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_thermal *tz = NULL; struct acpi_thermal *tz = NULL;
ACPI_FUNCTION_TRACE("acpi_thermal_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL); tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL);
if (!tz) if (!tz)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(tz, 0, sizeof(struct acpi_thermal)); memset(tz, 0, sizeof(struct acpi_thermal));
tz->handle = device->handle; tz->handle = device->handle;
...@@ -1354,7 +1329,7 @@ static int acpi_thermal_add(struct acpi_device *device) ...@@ -1354,7 +1329,7 @@ static int acpi_thermal_add(struct acpi_device *device)
kfree(tz); kfree(tz);
} }
return_VALUE(result); return result;
} }
static int acpi_thermal_remove(struct acpi_device *device, int type) static int acpi_thermal_remove(struct acpi_device *device, int type)
...@@ -1362,10 +1337,9 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) ...@@ -1362,10 +1337,9 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_thermal *tz = NULL; struct acpi_thermal *tz = NULL;
ACPI_FUNCTION_TRACE("acpi_thermal_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
tz = (struct acpi_thermal *)acpi_driver_data(device); tz = (struct acpi_thermal *)acpi_driver_data(device);
...@@ -1396,7 +1370,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) ...@@ -1396,7 +1370,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
acpi_thermal_remove_fs(device); acpi_thermal_remove_fs(device);
kfree(tz); kfree(tz);
return_VALUE(0); return 0;
} }
static int acpi_thermal_resume(struct acpi_device *device, int state) static int acpi_thermal_resume(struct acpi_device *device, int state)
...@@ -1404,7 +1378,7 @@ static int acpi_thermal_resume(struct acpi_device *device, int state) ...@@ -1404,7 +1378,7 @@ static int acpi_thermal_resume(struct acpi_device *device, int state)
struct acpi_thermal *tz = NULL; struct acpi_thermal *tz = NULL;
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
tz = (struct acpi_thermal *)acpi_driver_data(device); tz = (struct acpi_thermal *)acpi_driver_data(device);
...@@ -1417,31 +1391,29 @@ static int __init acpi_thermal_init(void) ...@@ -1417,31 +1391,29 @@ static int __init acpi_thermal_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_thermal_init");
acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
if (!acpi_thermal_dir) if (!acpi_thermal_dir)
return_VALUE(-ENODEV); return -ENODEV;
acpi_thermal_dir->owner = THIS_MODULE; acpi_thermal_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_thermal_driver); result = acpi_bus_register_driver(&acpi_thermal_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
static void __exit acpi_thermal_exit(void) static void __exit acpi_thermal_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_thermal_exit");
acpi_bus_unregister_driver(&acpi_thermal_driver); acpi_bus_unregister_driver(&acpi_thermal_driver);
remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
return_VOID; return;
} }
module_init(acpi_thermal_init); module_init(acpi_thermal_init);
......
...@@ -58,22 +58,21 @@ acpi_extract_package(union acpi_object *package, ...@@ -58,22 +58,21 @@ acpi_extract_package(union acpi_object *package,
u8 *head = NULL; u8 *head = NULL;
u8 *tail = NULL; u8 *tail = NULL;
ACPI_FUNCTION_TRACE("acpi_extract_package");
if (!package || (package->type != ACPI_TYPE_PACKAGE) if (!package || (package->type != ACPI_TYPE_PACKAGE)
|| (package->package.count < 1)) { || (package->package.count < 1)) {
printk(KERN_WARNING PREFIX "Invalid package argument\n"); printk(KERN_WARNING PREFIX "Invalid package argument\n");
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
} }
if (!format || !format->pointer || (format->length < 1)) { if (!format || !format->pointer || (format->length < 1)) {
printk(KERN_WARNING PREFIX "Invalid format argument\n"); printk(KERN_WARNING PREFIX "Invalid format argument\n");
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
} }
if (!buffer) { if (!buffer) {
printk(KERN_WARNING PREFIX "Invalid buffer argument\n"); printk(KERN_WARNING PREFIX "Invalid buffer argument\n");
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
} }
format_count = (format->length / sizeof(char)) - 1; format_count = (format->length / sizeof(char)) - 1;
...@@ -81,7 +80,7 @@ acpi_extract_package(union acpi_object *package, ...@@ -81,7 +80,7 @@ acpi_extract_package(union acpi_object *package,
printk(KERN_WARNING PREFIX "Format specifies more objects [%d]" printk(KERN_WARNING PREFIX "Format specifies more objects [%d]"
" than exist in package [%d].\n", " than exist in package [%d].\n",
format_count, package->package.count); format_count, package->package.count);
return_ACPI_STATUS(AE_BAD_DATA); return AE_BAD_DATA;
} }
format_string = (char *)format->pointer; format_string = (char *)format->pointer;
...@@ -94,7 +93,7 @@ acpi_extract_package(union acpi_object *package, ...@@ -94,7 +93,7 @@ acpi_extract_package(union acpi_object *package,
union acpi_object *element = &(package->package.elements[i]); union acpi_object *element = &(package->package.elements[i]);
if (!element) { if (!element) {
return_ACPI_STATUS(AE_BAD_DATA); return AE_BAD_DATA;
} }
switch (element->type) { switch (element->type) {
...@@ -116,7 +115,7 @@ acpi_extract_package(union acpi_object *package, ...@@ -116,7 +115,7 @@ acpi_extract_package(union acpi_object *package,
" [%d]: got number, expecing" " [%d]: got number, expecing"
" [%c]\n", " [%c]\n",
i, format_string[i]); i, format_string[i]);
return_ACPI_STATUS(AE_BAD_DATA); return AE_BAD_DATA;
break; break;
} }
break; break;
...@@ -142,7 +141,7 @@ acpi_extract_package(union acpi_object *package, ...@@ -142,7 +141,7 @@ acpi_extract_package(union acpi_object *package,
" [%d] got string/buffer," " [%d] got string/buffer,"
" expecing [%c]\n", " expecing [%c]\n",
i, format_string[i]); i, format_string[i]);
return_ACPI_STATUS(AE_BAD_DATA); return AE_BAD_DATA;
break; break;
} }
break; break;
...@@ -153,7 +152,7 @@ acpi_extract_package(union acpi_object *package, ...@@ -153,7 +152,7 @@ acpi_extract_package(union acpi_object *package,
"Found unsupported element at index=%d\n", "Found unsupported element at index=%d\n",
i)); i));
/* TBD: handle nested packages... */ /* TBD: handle nested packages... */
return_ACPI_STATUS(AE_SUPPORT); return AE_SUPPORT;
break; break;
} }
} }
...@@ -163,9 +162,9 @@ acpi_extract_package(union acpi_object *package, ...@@ -163,9 +162,9 @@ acpi_extract_package(union acpi_object *package,
*/ */
if (buffer->length < size_required) { if (buffer->length < size_required) {
buffer->length = size_required; buffer->length = size_required;
return_ACPI_STATUS(AE_BUFFER_OVERFLOW); return AE_BUFFER_OVERFLOW;
} else if (buffer->length != size_required || !buffer->pointer) { } else if (buffer->length != size_required || !buffer->pointer) {
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
} }
head = buffer->pointer; head = buffer->pointer;
...@@ -180,7 +179,7 @@ acpi_extract_package(union acpi_object *package, ...@@ -180,7 +179,7 @@ acpi_extract_package(union acpi_object *package,
union acpi_object *element = &(package->package.elements[i]); union acpi_object *element = &(package->package.elements[i]);
if (!element) { if (!element) {
return_ACPI_STATUS(AE_BAD_DATA); return AE_BAD_DATA;
} }
switch (element->type) { switch (element->type) {
...@@ -245,7 +244,7 @@ acpi_extract_package(union acpi_object *package, ...@@ -245,7 +244,7 @@ acpi_extract_package(union acpi_object *package,
} }
} }
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
EXPORT_SYMBOL(acpi_extract_package); EXPORT_SYMBOL(acpi_extract_package);
...@@ -259,14 +258,13 @@ acpi_evaluate_integer(acpi_handle handle, ...@@ -259,14 +258,13 @@ acpi_evaluate_integer(acpi_handle handle,
union acpi_object *element; union acpi_object *element;
struct acpi_buffer buffer = { 0, NULL }; struct acpi_buffer buffer = { 0, NULL };
ACPI_FUNCTION_TRACE("acpi_evaluate_integer");
if (!data) if (!data)
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
element = kmalloc(sizeof(union acpi_object), GFP_KERNEL); element = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
if (!element) if (!element)
return_ACPI_STATUS(AE_NO_MEMORY); return AE_NO_MEMORY;
memset(element, 0, sizeof(union acpi_object)); memset(element, 0, sizeof(union acpi_object));
buffer.length = sizeof(union acpi_object); buffer.length = sizeof(union acpi_object);
...@@ -275,13 +273,13 @@ acpi_evaluate_integer(acpi_handle handle, ...@@ -275,13 +273,13 @@ acpi_evaluate_integer(acpi_handle handle,
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_util_eval_error(handle, pathname, status); acpi_util_eval_error(handle, pathname, status);
kfree(element); kfree(element);
return_ACPI_STATUS(status); return status;
} }
if (element->type != ACPI_TYPE_INTEGER) { if (element->type != ACPI_TYPE_INTEGER) {
acpi_util_eval_error(handle, pathname, AE_BAD_DATA); acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
kfree(element); kfree(element);
return_ACPI_STATUS(AE_BAD_DATA); return AE_BAD_DATA;
} }
*data = element->integer.value; *data = element->integer.value;
...@@ -289,7 +287,7 @@ acpi_evaluate_integer(acpi_handle handle, ...@@ -289,7 +287,7 @@ acpi_evaluate_integer(acpi_handle handle,
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%lu]\n", *data)); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%lu]\n", *data));
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
EXPORT_SYMBOL(acpi_evaluate_integer); EXPORT_SYMBOL(acpi_evaluate_integer);
...@@ -304,15 +302,14 @@ acpi_evaluate_string(acpi_handle handle, ...@@ -304,15 +302,14 @@ acpi_evaluate_string(acpi_handle handle,
acpi_object *element = NULL; acpi_object *element = NULL;
acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
ACPI_FUNCTION_TRACE("acpi_evaluate_string");
if (!data) if (!data)
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
status = acpi_evaluate_object(handle, pathname, arguments, &buffer); status = acpi_evaluate_object(handle, pathname, arguments, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_util_eval_error(handle, pathname, status); acpi_util_eval_error(handle, pathname, status);
return_ACPI_STATUS(status); return status;
} }
element = (acpi_object *) buffer.pointer; element = (acpi_object *) buffer.pointer;
...@@ -321,13 +318,13 @@ acpi_evaluate_string(acpi_handle handle, ...@@ -321,13 +318,13 @@ acpi_evaluate_string(acpi_handle handle,
|| (element->type != ACPI_TYPE_BUFFER) || (element->type != ACPI_TYPE_BUFFER)
|| !element->string.length) { || !element->string.length) {
acpi_util_eval_error(handle, pathname, AE_BAD_DATA); acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
return_ACPI_STATUS(AE_BAD_DATA); return AE_BAD_DATA;
} }
*data = kmalloc(element->string.length + 1, GFP_KERNEL); *data = kmalloc(element->string.length + 1, GFP_KERNEL);
if (!data) { if (!data) {
printk(KERN_ERR PREFIX "Memory allocation\n"); printk(KERN_ERR PREFIX "Memory allocation\n");
return_VALUE(-ENOMEM); return -ENOMEM;
} }
memset(*data, 0, element->string.length + 1); memset(*data, 0, element->string.length + 1);
...@@ -337,7 +334,7 @@ acpi_evaluate_string(acpi_handle handle, ...@@ -337,7 +334,7 @@ acpi_evaluate_string(acpi_handle handle,
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
#endif #endif
...@@ -353,10 +350,9 @@ acpi_evaluate_reference(acpi_handle handle, ...@@ -353,10 +350,9 @@ acpi_evaluate_reference(acpi_handle handle,
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
u32 i = 0; u32 i = 0;
ACPI_FUNCTION_TRACE("acpi_evaluate_reference");
if (!list) { if (!list) {
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
} }
/* Evaluate object. */ /* Evaluate object. */
...@@ -390,7 +386,7 @@ acpi_evaluate_reference(acpi_handle handle, ...@@ -390,7 +386,7 @@ acpi_evaluate_reference(acpi_handle handle,
} }
if (package->package.count > ACPI_MAX_HANDLES) { if (package->package.count > ACPI_MAX_HANDLES) {
return_ACPI_STATUS(AE_NO_MEMORY); return AE_NO_MEMORY;
} }
list->count = package->package.count; list->count = package->package.count;
...@@ -424,7 +420,7 @@ acpi_evaluate_reference(acpi_handle handle, ...@@ -424,7 +420,7 @@ acpi_evaluate_reference(acpi_handle handle,
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_ACPI_STATUS(status); return status;
} }
EXPORT_SYMBOL(acpi_evaluate_reference); EXPORT_SYMBOL(acpi_evaluate_reference);
...@@ -272,10 +272,9 @@ static int ...@@ -272,10 +272,9 @@ static int
acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
{ {
int status; int status;
ACPI_FUNCTION_TRACE("acpi_video_device_query");
status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state); status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state);
return_VALUE(status); return status;
} }
static int static int
...@@ -284,11 +283,10 @@ acpi_video_device_get_state(struct acpi_video_device *device, ...@@ -284,11 +283,10 @@ acpi_video_device_get_state(struct acpi_video_device *device,
{ {
int status; int status;
ACPI_FUNCTION_TRACE("acpi_video_device_get_state");
status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state); status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state);
return_VALUE(status); return status;
} }
static int static int
...@@ -299,12 +297,11 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state) ...@@ -299,12 +297,11 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state)
struct acpi_object_list args = { 1, &arg0 }; struct acpi_object_list args = { 1, &arg0 };
unsigned long ret; unsigned long ret;
ACPI_FUNCTION_TRACE("acpi_video_device_set_state");
arg0.integer.value = state; arg0.integer.value = state;
status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret); status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret);
return_VALUE(status); return status;
} }
static int static int
...@@ -315,13 +312,12 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, ...@@ -315,13 +312,12 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj; union acpi_object *obj;
ACPI_FUNCTION_TRACE("acpi_video_device_lcd_query_levels");
*levels = NULL; *levels = NULL;
status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer); status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer);
if (!ACPI_SUCCESS(status)) if (!ACPI_SUCCESS(status))
return_VALUE(status); return status;
obj = (union acpi_object *)buffer.pointer; obj = (union acpi_object *)buffer.pointer;
if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
printk(KERN_ERR PREFIX "Invalid _BCL data\n"); printk(KERN_ERR PREFIX "Invalid _BCL data\n");
...@@ -331,12 +327,12 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, ...@@ -331,12 +327,12 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
*levels = obj; *levels = obj;
return_VALUE(0); return 0;
err: err:
kfree(buffer.pointer); kfree(buffer.pointer);
return_VALUE(status); return status;
} }
static int static int
...@@ -346,13 +342,12 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) ...@@ -346,13 +342,12 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
union acpi_object arg0 = { ACPI_TYPE_INTEGER }; union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list args = { 1, &arg0 }; struct acpi_object_list args = { 1, &arg0 };
ACPI_FUNCTION_TRACE("acpi_video_device_lcd_set_level");
arg0.integer.value = level; arg0.integer.value = level;
status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL); status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL);
printk(KERN_DEBUG "set_level status: %x\n", status); printk(KERN_DEBUG "set_level status: %x\n", status);
return_VALUE(status); return status;
} }
static int static int
...@@ -360,11 +355,10 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, ...@@ -360,11 +355,10 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
unsigned long *level) unsigned long *level)
{ {
int status; int status;
ACPI_FUNCTION_TRACE("acpi_video_device_lcd_get_level_current");
status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level);
return_VALUE(status); return status;
} }
static int static int
...@@ -377,22 +371,21 @@ acpi_video_device_EDID(struct acpi_video_device *device, ...@@ -377,22 +371,21 @@ acpi_video_device_EDID(struct acpi_video_device *device,
union acpi_object arg0 = { ACPI_TYPE_INTEGER }; union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list args = { 1, &arg0 }; struct acpi_object_list args = { 1, &arg0 };
ACPI_FUNCTION_TRACE("acpi_video_device_get_EDID");
*edid = NULL; *edid = NULL;
if (!device) if (!device)
return_VALUE(-ENODEV); return -ENODEV;
if (length == 128) if (length == 128)
arg0.integer.value = 1; arg0.integer.value = 1;
else if (length == 256) else if (length == 256)
arg0.integer.value = 2; arg0.integer.value = 2;
else else
return_VALUE(-EINVAL); return -EINVAL;
status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer); status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return -ENODEV;
obj = (union acpi_object *)buffer.pointer; obj = (union acpi_object *)buffer.pointer;
...@@ -404,7 +397,7 @@ acpi_video_device_EDID(struct acpi_video_device *device, ...@@ -404,7 +397,7 @@ acpi_video_device_EDID(struct acpi_video_device *device,
kfree(obj); kfree(obj);
} }
return_VALUE(status); return status;
} }
/* bus */ /* bus */
...@@ -417,7 +410,6 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) ...@@ -417,7 +410,6 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
union acpi_object arg0 = { ACPI_TYPE_INTEGER }; union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list args = { 1, &arg0 }; struct acpi_object_list args = { 1, &arg0 };
ACPI_FUNCTION_TRACE("acpi_video_bus_set_POST");
arg0.integer.value = option; arg0.integer.value = option;
...@@ -425,7 +417,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) ...@@ -425,7 +417,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
if (ACPI_SUCCESS(status)) if (ACPI_SUCCESS(status))
status = tmp ? (-EINVAL) : (AE_OK); status = tmp ? (-EINVAL) : (AE_OK);
return_VALUE(status); return status;
} }
static int static int
...@@ -433,11 +425,10 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id) ...@@ -433,11 +425,10 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
{ {
int status; int status;
ACPI_FUNCTION_TRACE("acpi_video_bus_get_POST");
status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id); status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id);
return_VALUE(status); return status;
} }
static int static int
...@@ -445,12 +436,11 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video, ...@@ -445,12 +436,11 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video,
unsigned long *options) unsigned long *options)
{ {
int status; int status;
ACPI_FUNCTION_TRACE("acpi_video_bus_POST_options");
status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options);
*options &= 3; *options &= 3;
return_VALUE(status); return status;
} }
/* /*
...@@ -481,7 +471,6 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) ...@@ -481,7 +471,6 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
union acpi_object arg0 = { ACPI_TYPE_INTEGER }; union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list args = { 1, &arg0 }; struct acpi_object_list args = { 1, &arg0 };
ACPI_FUNCTION_TRACE("acpi_video_bus_DOS");
if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) { if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) {
status = -1; status = -1;
...@@ -492,7 +481,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) ...@@ -492,7 +481,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
acpi_evaluate_object(video->handle, "_DOS", &args, NULL); acpi_evaluate_object(video->handle, "_DOS", &args, NULL);
Failed: Failed:
return_VALUE(status); return status;
} }
/* /*
...@@ -514,7 +503,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) ...@@ -514,7 +503,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
union acpi_object *obj = NULL; union acpi_object *obj = NULL;
struct acpi_video_device_brightness *br = NULL; struct acpi_video_device_brightness *br = NULL;
ACPI_FUNCTION_TRACE("acpi_video_device_find_cap");
memset(&device->cap, 0, 4); memset(&device->cap, 0, 4);
...@@ -582,7 +570,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) ...@@ -582,7 +570,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
kfree(obj); kfree(obj);
return_VOID; return;
} }
/* /*
...@@ -629,10 +617,9 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) ...@@ -629,10 +617,9 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
{ {
acpi_status status = -ENOENT; acpi_status status = -ENOENT;
ACPI_FUNCTION_TRACE("acpi_video_bus_check");
if (!video) if (!video)
return_VALUE(-EINVAL); return -EINVAL;
/* Since there is no HID, CID and so on for VGA driver, we have /* Since there is no HID, CID and so on for VGA driver, we have
* to check well known required nodes. * to check well known required nodes.
...@@ -656,7 +643,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) ...@@ -656,7 +643,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
status = 0; status = 0;
} }
return_VALUE(status); return status;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -672,7 +659,6 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset) ...@@ -672,7 +659,6 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)
struct acpi_video_device *dev = struct acpi_video_device *dev =
(struct acpi_video_device *)seq->private; (struct acpi_video_device *)seq->private;
ACPI_FUNCTION_TRACE("acpi_video_device_info_seq_show");
if (!dev) if (!dev)
goto end; goto end;
...@@ -691,7 +677,7 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset) ...@@ -691,7 +677,7 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)
seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no"); seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no");
end: end:
return_VALUE(0); return 0;
} }
static int static int
...@@ -708,7 +694,6 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) ...@@ -708,7 +694,6 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
(struct acpi_video_device *)seq->private; (struct acpi_video_device *)seq->private;
unsigned long state; unsigned long state;
ACPI_FUNCTION_TRACE("acpi_video_device_state_seq_show");
if (!dev) if (!dev)
goto end; goto end;
...@@ -728,7 +713,7 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) ...@@ -728,7 +713,7 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
seq_printf(seq, "<not supported>\n"); seq_printf(seq, "<not supported>\n");
end: end:
return_VALUE(0); return 0;
} }
static int static int
...@@ -749,13 +734,12 @@ acpi_video_device_write_state(struct file *file, ...@@ -749,13 +734,12 @@ acpi_video_device_write_state(struct file *file,
char str[12] = { 0 }; char str[12] = { 0 };
u32 state = 0; u32 state = 0;
ACPI_FUNCTION_TRACE("acpi_video_device_write_state");
if (!dev || count + 1 > sizeof str) if (!dev || count + 1 > sizeof str)
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(str, buffer, count)) if (copy_from_user(str, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
str[count] = 0; str[count] = 0;
state = simple_strtoul(str, NULL, 0); state = simple_strtoul(str, NULL, 0);
...@@ -764,9 +748,9 @@ acpi_video_device_write_state(struct file *file, ...@@ -764,9 +748,9 @@ acpi_video_device_write_state(struct file *file,
status = acpi_video_device_set_state(dev, state); status = acpi_video_device_set_state(dev, state);
if (status) if (status)
return_VALUE(-EFAULT); return -EFAULT;
return_VALUE(count); return count;
} }
static int static int
...@@ -776,11 +760,10 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset) ...@@ -776,11 +760,10 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
(struct acpi_video_device *)seq->private; (struct acpi_video_device *)seq->private;
int i; int i;
ACPI_FUNCTION_TRACE("acpi_video_device_brightness_seq_show");
if (!dev || !dev->brightness) { if (!dev || !dev->brightness) {
seq_printf(seq, "<not supported>\n"); seq_printf(seq, "<not supported>\n");
return_VALUE(0); return 0;
} }
seq_printf(seq, "levels: "); seq_printf(seq, "levels: ");
...@@ -788,7 +771,7 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset) ...@@ -788,7 +771,7 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
seq_printf(seq, " %d", dev->brightness->levels[i]); seq_printf(seq, " %d", dev->brightness->levels[i]);
seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr);
return_VALUE(0); return 0;
} }
static int static int
...@@ -809,19 +792,18 @@ acpi_video_device_write_brightness(struct file *file, ...@@ -809,19 +792,18 @@ acpi_video_device_write_brightness(struct file *file,
unsigned int level = 0; unsigned int level = 0;
int i; int i;
ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness");
if (!dev || !dev->brightness || count + 1 > sizeof str) if (!dev || !dev->brightness || count + 1 > sizeof str)
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(str, buffer, count)) if (copy_from_user(str, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
str[count] = 0; str[count] = 0;
level = simple_strtoul(str, NULL, 0); level = simple_strtoul(str, NULL, 0);
if (level > 100) if (level > 100)
return_VALUE(-EFAULT); return -EFAULT;
/* validate though the list of available levels */ /* validate though the list of available levels */
for (i = 0; i < dev->brightness->count; i++) for (i = 0; i < dev->brightness->count; i++)
...@@ -832,7 +814,7 @@ acpi_video_device_write_brightness(struct file *file, ...@@ -832,7 +814,7 @@ acpi_video_device_write_brightness(struct file *file,
break; break;
} }
return_VALUE(count); return count;
} }
static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
...@@ -843,7 +825,6 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) ...@@ -843,7 +825,6 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
int i; int i;
union acpi_object *edid = NULL; union acpi_object *edid = NULL;
ACPI_FUNCTION_TRACE("acpi_video_device_EDID_seq_show");
if (!dev) if (!dev)
goto out; goto out;
...@@ -868,7 +849,7 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) ...@@ -868,7 +849,7 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
else else
kfree(edid); kfree(edid);
return_VALUE(0); return 0;
} }
static int static int
...@@ -883,27 +864,26 @@ static int acpi_video_device_add_fs(struct acpi_device *device) ...@@ -883,27 +864,26 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
struct acpi_video_device *vid_dev; struct acpi_video_device *vid_dev;
ACPI_FUNCTION_TRACE("acpi_video_device_add_fs");
if (!device) if (!device)
return_VALUE(-ENODEV); return -ENODEV;
vid_dev = (struct acpi_video_device *)acpi_driver_data(device); vid_dev = (struct acpi_video_device *)acpi_driver_data(device);
if (!vid_dev) if (!vid_dev)
return_VALUE(-ENODEV); return -ENODEV;
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
vid_dev->video->dir); vid_dev->video->dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
} }
/* 'info' [R] */ /* 'info' [R] */
entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_video_device_info_fops; entry->proc_fops = &acpi_video_device_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -915,7 +895,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) ...@@ -915,7 +895,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
acpi_video_device_state_fops.write = acpi_video_device_write_state; acpi_video_device_state_fops.write = acpi_video_device_write_state;
entry->proc_fops = &acpi_video_device_state_fops; entry->proc_fops = &acpi_video_device_state_fops;
...@@ -928,7 +908,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) ...@@ -928,7 +908,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness;
entry->proc_fops = &acpi_video_device_brightness_fops; entry->proc_fops = &acpi_video_device_brightness_fops;
...@@ -939,24 +919,23 @@ static int acpi_video_device_add_fs(struct acpi_device *device) ...@@ -939,24 +919,23 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
/* 'EDID' [R] */ /* 'EDID' [R] */
entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_video_device_EDID_fops; entry->proc_fops = &acpi_video_device_EDID_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VALUE(0); return 0;
} }
static int acpi_video_device_remove_fs(struct acpi_device *device) static int acpi_video_device_remove_fs(struct acpi_device *device)
{ {
struct acpi_video_device *vid_dev; struct acpi_video_device *vid_dev;
ACPI_FUNCTION_TRACE("acpi_video_device_remove_fs");
vid_dev = (struct acpi_video_device *)acpi_driver_data(device); vid_dev = (struct acpi_video_device *)acpi_driver_data(device);
if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) if (!vid_dev || !vid_dev->video || !vid_dev->video->dir)
return_VALUE(-ENODEV); return -ENODEV;
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry("info", acpi_device_dir(device)); remove_proc_entry("info", acpi_device_dir(device));
...@@ -967,7 +946,7 @@ static int acpi_video_device_remove_fs(struct acpi_device *device) ...@@ -967,7 +946,7 @@ static int acpi_video_device_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* video bus */ /* video bus */
...@@ -975,7 +954,6 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset) ...@@ -975,7 +954,6 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
ACPI_FUNCTION_TRACE("acpi_video_bus_info_seq_show");
if (!video) if (!video)
goto end; goto end;
...@@ -988,7 +966,7 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset) ...@@ -988,7 +966,7 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset)
video->flags.post ? "yes" : "no"); video->flags.post ? "yes" : "no");
end: end:
return_VALUE(0); return 0;
} }
static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file) static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file)
...@@ -1001,7 +979,6 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) ...@@ -1001,7 +979,6 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
ACPI_FUNCTION_TRACE("acpi_video_bus_ROM_seq_show");
if (!video) if (!video)
goto end; goto end;
...@@ -1010,7 +987,7 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) ...@@ -1010,7 +987,7 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
seq_printf(seq, "<TODO>\n"); seq_printf(seq, "<TODO>\n");
end: end:
return_VALUE(0); return 0;
} }
static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file)
...@@ -1024,7 +1001,6 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) ...@@ -1024,7 +1001,6 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
unsigned long options; unsigned long options;
int status; int status;
ACPI_FUNCTION_TRACE("acpi_video_bus_POST_info_seq_show");
if (!video) if (!video)
goto end; goto end;
...@@ -1047,7 +1023,7 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) ...@@ -1047,7 +1023,7 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
} else } else
seq_printf(seq, "<not supported>\n"); seq_printf(seq, "<not supported>\n");
end: end:
return_VALUE(0); return 0;
} }
static int static int
...@@ -1063,7 +1039,6 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) ...@@ -1063,7 +1039,6 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
int status; int status;
unsigned long id; unsigned long id;
ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show");
if (!video) if (!video)
goto end; goto end;
...@@ -1076,18 +1051,17 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) ...@@ -1076,18 +1051,17 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]);
end: end:
return_VALUE(0); return 0;
} }
static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset) static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
ACPI_FUNCTION_TRACE("acpi_video_bus_DOS_seq_show");
seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting); seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting);
return_VALUE(0); return 0;
} }
static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file) static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file)
...@@ -1112,22 +1086,21 @@ acpi_video_bus_write_POST(struct file *file, ...@@ -1112,22 +1086,21 @@ acpi_video_bus_write_POST(struct file *file,
char str[12] = { 0 }; char str[12] = { 0 };
unsigned long opt, options; unsigned long opt, options;
ACPI_FUNCTION_TRACE("acpi_video_bus_write_POST");
if (!video || count + 1 > sizeof str) if (!video || count + 1 > sizeof str)
return_VALUE(-EINVAL); return -EINVAL;
status = acpi_video_bus_POST_options(video, &options); status = acpi_video_bus_POST_options(video, &options);
if (!ACPI_SUCCESS(status)) if (!ACPI_SUCCESS(status))
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(str, buffer, count)) if (copy_from_user(str, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
str[count] = 0; str[count] = 0;
opt = strtoul(str, NULL, 0); opt = strtoul(str, NULL, 0);
if (opt > 3) if (opt > 3)
return_VALUE(-EFAULT); return -EFAULT;
/* just in case an OEM 'forget' the motherboard... */ /* just in case an OEM 'forget' the motherboard... */
options |= 1; options |= 1;
...@@ -1135,11 +1108,11 @@ acpi_video_bus_write_POST(struct file *file, ...@@ -1135,11 +1108,11 @@ acpi_video_bus_write_POST(struct file *file,
if (options & (1ul << opt)) { if (options & (1ul << opt)) {
status = acpi_video_bus_set_POST(video, opt); status = acpi_video_bus_set_POST(video, opt);
if (!ACPI_SUCCESS(status)) if (!ACPI_SUCCESS(status))
return_VALUE(-EFAULT); return -EFAULT;
} }
return_VALUE(count); return count;
} }
static ssize_t static ssize_t
...@@ -1153,25 +1126,24 @@ acpi_video_bus_write_DOS(struct file *file, ...@@ -1153,25 +1126,24 @@ acpi_video_bus_write_DOS(struct file *file,
char str[12] = { 0 }; char str[12] = { 0 };
unsigned long opt; unsigned long opt;
ACPI_FUNCTION_TRACE("acpi_video_bus_write_DOS");
if (!video || count + 1 > sizeof str) if (!video || count + 1 > sizeof str)
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(str, buffer, count)) if (copy_from_user(str, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
str[count] = 0; str[count] = 0;
opt = strtoul(str, NULL, 0); opt = strtoul(str, NULL, 0);
if (opt > 7) if (opt > 7)
return_VALUE(-EFAULT); return -EFAULT;
status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2); status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2);
if (!ACPI_SUCCESS(status)) if (!ACPI_SUCCESS(status))
return_VALUE(-EFAULT); return -EFAULT;
return_VALUE(count); return count;
} }
static int acpi_video_bus_add_fs(struct acpi_device *device) static int acpi_video_bus_add_fs(struct acpi_device *device)
...@@ -1179,7 +1151,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) ...@@ -1179,7 +1151,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
struct acpi_video_bus *video; struct acpi_video_bus *video;
ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs");
video = (struct acpi_video_bus *)acpi_driver_data(device); video = (struct acpi_video_bus *)acpi_driver_data(device);
...@@ -1187,7 +1158,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) ...@@ -1187,7 +1158,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_video_dir); acpi_video_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
video->dir = acpi_device_dir(device); video->dir = acpi_device_dir(device);
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
} }
...@@ -1195,7 +1166,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) ...@@ -1195,7 +1166,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
/* 'info' [R] */ /* 'info' [R] */
entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_video_bus_info_fops; entry->proc_fops = &acpi_video_bus_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -1205,7 +1176,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) ...@@ -1205,7 +1176,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
/* 'ROM' [R] */ /* 'ROM' [R] */
entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_video_bus_ROM_fops; entry->proc_fops = &acpi_video_bus_ROM_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -1216,7 +1187,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) ...@@ -1216,7 +1187,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
entry = entry =
create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
entry->proc_fops = &acpi_video_bus_POST_info_fops; entry->proc_fops = &acpi_video_bus_POST_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -1228,7 +1199,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) ...@@ -1228,7 +1199,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST;
entry->proc_fops = &acpi_video_bus_POST_fops; entry->proc_fops = &acpi_video_bus_POST_fops;
...@@ -1241,7 +1212,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) ...@@ -1241,7 +1212,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
else { else {
acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS;
entry->proc_fops = &acpi_video_bus_DOS_fops; entry->proc_fops = &acpi_video_bus_DOS_fops;
...@@ -1249,14 +1220,13 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) ...@@ -1249,14 +1220,13 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VALUE(0); return 0;
} }
static int acpi_video_bus_remove_fs(struct acpi_device *device) static int acpi_video_bus_remove_fs(struct acpi_device *device)
{ {
struct acpi_video_bus *video; struct acpi_video_bus *video;
ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs");
video = (struct acpi_video_bus *)acpi_driver_data(device); video = (struct acpi_video_bus *)acpi_driver_data(device);
...@@ -1270,7 +1240,7 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) ...@@ -1270,7 +1240,7 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -1287,10 +1257,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device, ...@@ -1287,10 +1257,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
int status; int status;
struct acpi_video_device *data; struct acpi_video_device *data;
ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device");
if (!device || !video) if (!device || !video)
return_VALUE(-EINVAL); return -EINVAL;
status = status =
acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
...@@ -1298,7 +1267,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, ...@@ -1298,7 +1267,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL); data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
if (!data) if (!data)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(data, 0, sizeof(struct acpi_video_device)); memset(data, 0, sizeof(struct acpi_video_device));
...@@ -1349,10 +1318,10 @@ acpi_video_bus_get_one_device(struct acpi_device *device, ...@@ -1349,10 +1318,10 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
acpi_video_device_add_fs(device); acpi_video_device_add_fs(device);
return_VALUE(0); return 0;
} }
return_VALUE(-ENOENT); return -ENOENT;
} }
/* /*
...@@ -1395,7 +1364,6 @@ acpi_video_device_bind(struct acpi_video_bus *video, ...@@ -1395,7 +1364,6 @@ acpi_video_device_bind(struct acpi_video_bus *video,
struct acpi_video_device *device) struct acpi_video_device *device)
{ {
int i; int i;
ACPI_FUNCTION_TRACE("acpi_video_device_bind");
#define IDS_VAL(i) video->attached_array[i].value.int_val #define IDS_VAL(i) video->attached_array[i].value.int_val
#define IDS_BIND(i) video->attached_array[i].bind_info #define IDS_BIND(i) video->attached_array[i].bind_info
...@@ -1432,12 +1400,11 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) ...@@ -1432,12 +1400,11 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
union acpi_object *dod = NULL; union acpi_object *dod = NULL;
union acpi_object *obj; union acpi_object *obj;
ACPI_FUNCTION_TRACE("acpi_video_device_enumerate");
status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer); status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer);
if (!ACPI_SUCCESS(status)) { if (!ACPI_SUCCESS(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD"));
return_VALUE(status); return status;
} }
dod = (union acpi_object *)buffer.pointer; dod = (union acpi_object *)buffer.pointer;
...@@ -1484,7 +1451,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) ...@@ -1484,7 +1451,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
video->attached_count = count; video->attached_count = count;
out: out:
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_VALUE(status); return status;
} }
/* /*
...@@ -1509,7 +1476,6 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event) ...@@ -1509,7 +1476,6 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
unsigned long state; unsigned long state;
int status = 0; int status = 0;
ACPI_FUNCTION_TRACE("acpi_video_switch_output");
list_for_each_safe(node, next, &video->video_device_list) { list_for_each_safe(node, next, &video->video_device_list) {
dev = container_of(node, struct acpi_video_device, entry); dev = container_of(node, struct acpi_video_device, entry);
...@@ -1540,7 +1506,7 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event) ...@@ -1540,7 +1506,7 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
break; break;
} }
return_VALUE(status); return status;
} }
static int static int
...@@ -1567,7 +1533,6 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, ...@@ -1567,7 +1533,6 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
int status = 0; int status = 0;
struct list_head *node, *next; struct list_head *node, *next;
ACPI_FUNCTION_TRACE("acpi_video_get_devices");
acpi_video_device_enumerate(video); acpi_video_device_enumerate(video);
...@@ -1585,7 +1550,7 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, ...@@ -1585,7 +1550,7 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
} }
} }
return_VALUE(status); return status;
} }
static int acpi_video_bus_put_one_device(struct acpi_video_device *device) static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
...@@ -1593,10 +1558,9 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) ...@@ -1593,10 +1558,9 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
acpi_status status; acpi_status status;
struct acpi_video_bus *video; struct acpi_video_bus *video;
ACPI_FUNCTION_TRACE("acpi_video_bus_put_one_device");
if (!device || !device->video) if (!device || !device->video)
return_VALUE(-ENOENT); return -ENOENT;
video = device->video; video = device->video;
...@@ -1609,7 +1573,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) ...@@ -1609,7 +1573,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
acpi_video_device_notify); acpi_video_device_notify);
return_VALUE(0); return 0;
} }
static int acpi_video_bus_put_devices(struct acpi_video_bus *video) static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
...@@ -1617,7 +1581,6 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) ...@@ -1617,7 +1581,6 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
int status; int status;
struct list_head *node, *next; struct list_head *node, *next;
ACPI_FUNCTION_TRACE("acpi_video_bus_put_devices");
list_for_each_safe(node, next, &video->video_device_list) { list_for_each_safe(node, next, &video->video_device_list) {
struct acpi_video_device *data = struct acpi_video_device *data =
...@@ -1636,7 +1599,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) ...@@ -1636,7 +1599,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
kfree(data); kfree(data);
} }
return_VALUE(0); return 0;
} }
/* acpi_video interface */ /* acpi_video interface */
...@@ -1656,14 +1619,13 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) ...@@ -1656,14 +1619,13 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
struct acpi_video_bus *video = (struct acpi_video_bus *)data; struct acpi_video_bus *video = (struct acpi_video_bus *)data;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_video_bus_notify");
printk("video bus notify\n"); printk("video bus notify\n");
if (!video) if (!video)
return_VOID; return;
if (acpi_bus_get_device(handle, &device)) if (acpi_bus_get_device(handle, &device))
return_VOID; return;
switch (event) { switch (event) {
case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur,
...@@ -1692,7 +1654,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) ...@@ -1692,7 +1654,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
break; break;
} }
return_VOID; return;
} }
static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
...@@ -1701,14 +1663,13 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) ...@@ -1701,14 +1663,13 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
(struct acpi_video_device *)data; (struct acpi_video_device *)data;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_video_device_notify");
printk("video device notify\n"); printk("video device notify\n");
if (!video_device) if (!video_device)
return_VOID; return;
if (acpi_bus_get_device(handle, &device)) if (acpi_bus_get_device(handle, &device))
return_VOID; return;
switch (event) { switch (event) {
case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */
...@@ -1728,7 +1689,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) ...@@ -1728,7 +1689,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
"Unsupported event [0x%x]\n", event)); "Unsupported event [0x%x]\n", event));
break; break;
} }
return_VOID; return;
} }
static int acpi_video_bus_add(struct acpi_device *device) static int acpi_video_bus_add(struct acpi_device *device)
...@@ -1737,14 +1698,13 @@ static int acpi_video_bus_add(struct acpi_device *device) ...@@ -1737,14 +1698,13 @@ static int acpi_video_bus_add(struct acpi_device *device)
acpi_status status = 0; acpi_status status = 0;
struct acpi_video_bus *video = NULL; struct acpi_video_bus *video = NULL;
ACPI_FUNCTION_TRACE("acpi_video_bus_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
video = kmalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); video = kmalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
if (!video) if (!video)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(video, 0, sizeof(struct acpi_video_bus)); memset(video, 0, sizeof(struct acpi_video_bus));
video->handle = device->handle; video->handle = device->handle;
...@@ -1791,7 +1751,7 @@ static int acpi_video_bus_add(struct acpi_device *device) ...@@ -1791,7 +1751,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
if (result) if (result)
kfree(video); kfree(video);
return_VALUE(result); return result;
} }
static int acpi_video_bus_remove(struct acpi_device *device, int type) static int acpi_video_bus_remove(struct acpi_device *device, int type)
...@@ -1799,10 +1759,9 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) ...@@ -1799,10 +1759,9 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
acpi_status status = 0; acpi_status status = 0;
struct acpi_video_bus *video = NULL; struct acpi_video_bus *video = NULL;
ACPI_FUNCTION_TRACE("acpi_video_bus_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
video = (struct acpi_video_bus *)acpi_driver_data(device); video = (struct acpi_video_bus *)acpi_driver_data(device);
...@@ -1818,7 +1777,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) ...@@ -1818,7 +1777,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
kfree(video->attached_array); kfree(video->attached_array);
kfree(video); kfree(video);
return_VALUE(0); return 0;
} }
static int static int
...@@ -1828,10 +1787,9 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver) ...@@ -1828,10 +1787,9 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
acpi_handle h_dummy2; acpi_handle h_dummy2;
acpi_handle h_dummy3; acpi_handle h_dummy3;
ACPI_FUNCTION_TRACE("acpi_video_bus_match");
if (!device || !driver) if (!device || !driver)
return_VALUE(-EINVAL); return -EINVAL;
/* Since there is no HID, CID for ACPI Video drivers, we have /* Since there is no HID, CID for ACPI Video drivers, we have
* to check well known required nodes for each feature we support. * to check well known required nodes for each feature we support.
...@@ -1840,26 +1798,25 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver) ...@@ -1840,26 +1798,25 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
/* Does this device able to support video switching ? */ /* Does this device able to support video switching ? */
if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) && if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) &&
ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2)))
return_VALUE(0); return 0;
/* Does this device able to retrieve a video ROM ? */ /* Does this device able to retrieve a video ROM ? */
if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1))) if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1)))
return_VALUE(0); return 0;
/* Does this device able to configure which video head to be POSTed ? */ /* Does this device able to configure which video head to be POSTed ? */
if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) && if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) &&
ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) && ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) &&
ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3)))
return_VALUE(0); return 0;
return_VALUE(-ENODEV); return -ENODEV;
} }
static int __init acpi_video_init(void) static int __init acpi_video_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_video_init");
/* /*
acpi_dbg_level = 0xFFFFFFFF; acpi_dbg_level = 0xFFFFFFFF;
...@@ -1868,27 +1825,26 @@ static int __init acpi_video_init(void) ...@@ -1868,27 +1825,26 @@ static int __init acpi_video_init(void)
acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
if (!acpi_video_dir) if (!acpi_video_dir)
return_VALUE(-ENODEV); return -ENODEV;
acpi_video_dir->owner = THIS_MODULE; acpi_video_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_video_bus); result = acpi_bus_register_driver(&acpi_video_bus);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
static void __exit acpi_video_exit(void) static void __exit acpi_video_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_video_exit");
acpi_bus_unregister_driver(&acpi_video_bus); acpi_bus_unregister_driver(&acpi_video_bus);
remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
return_VOID; return;
} }
module_init(acpi_video_init); module_init(acpi_video_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment