From 46f18e3a28295a9e11a6ffa4478241c19bc93735 Mon Sep 17 00:00:00 2001 From: Venkatesh Pallipadi Date: Mon, 26 Jun 2006 00:34:43 -0400 Subject: ACPI: HW P-state coordination support Treat HW coordination as independent CPUs. This enables per-cpu monintoring of P-states http://bugzilla.kernel.org/show_bug.cgi?id=5737 Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 5fd6532..cf0ddc9 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c @@ -418,8 +418,14 @@ acpi_cpufreq_cpu_init ( goto err_free; perf = data->acpi_data; - policy->cpus = perf->shared_cpu_map; policy->shared_type = perf->shared_type; + /* + * Will let policy->cpus know about dependency only when software + * coordination is required. + */ + if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || + policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) + policy->cpus = perf->shared_cpu_map; if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c index f7e4356..8d76550 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c @@ -399,8 +399,14 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) dprintk(PFX "obtaining ACPI data failed\n"); return -EIO; } - policy->cpus = p->shared_cpu_map; policy->shared_type = p->shared_type; + /* + * Will let policy->cpus know about dependency only when software + * coordination is required. + */ + if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || + policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) + policy->cpus = p->shared_cpu_map; /* verify the acpi_data */ if (p->state_count <= 1) { diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 41aaaba..299fbbb 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -698,12 +698,12 @@ int acpi_processor_preregister_performance( /* Validate the Domain info */ count_target = pdomain->num_processors; count = 1; - if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL || - pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) { + if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL) pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; - } else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) { + else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) + pr->performance->shared_type = CPUFREQ_SHARED_TYPE_HW; + else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ANY; - } for_each_possible_cpu(j) { if (i == j) diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 466fbe9..35e1376 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -100,8 +100,10 @@ struct cpufreq_policy { #define CPUFREQ_INCOMPATIBLE (1) #define CPUFREQ_NOTIFY (2) -#define CPUFREQ_SHARED_TYPE_ALL (0) /* All dependent CPUs should set freq */ -#define CPUFREQ_SHARED_TYPE_ANY (1) /* Freq can be set from any dependent CPU */ +#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ +#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ +#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */ +#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ /******************** cpufreq transition notifiers *******************/ -- cgit v0.10.2 From a6fc67202e0224e6c9d1d285cc0b444bce887ed5 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Mon, 26 Jun 2006 23:58:43 -0400 Subject: ACPI: Enable ACPI error messages w/o CONFIG_ACPI_DEBUG Signed-off-by: Thomas Renninger Signed-off-by: Len Brown diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 7839b83..95223d8 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c @@ -91,8 +91,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error reading AC Adapter state\n")); + ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state")); ac->state = ACPI_AC_STATUS_UNKNOWN; return_VALUE(-ENODEV); } @@ -159,9 +158,7 @@ static int acpi_ac_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_AC_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_AC_FILE_STATE)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_ac_fops; entry->data = acpi_driver_data(device); @@ -249,8 +246,6 @@ static int acpi_ac_add(struct acpi_device *device) ACPI_DEVICE_NOTIFY, acpi_ac_notify, ac); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -282,9 +277,6 @@ static int acpi_ac_remove(struct acpi_device *device, int type) status = acpi_remove_notify_handler(ac->handle, ACPI_DEVICE_NOTIFY, acpi_ac_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); acpi_ac_remove_fs(device); diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index e0a95ba..e49d327 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -125,15 +125,14 @@ acpi_memory_get_device(acpi_handle handle, status = acpi_get_parent(handle, &phandle); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n")); + ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent")); return_VALUE(-EINVAL); } /* Get the parent device */ status = acpi_bus_get_device(phandle, &pdevice); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_bus_get_device\n")); + ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device")); return_VALUE(-EINVAL); } @@ -143,7 +142,7 @@ acpi_memory_get_device(acpi_handle handle, */ status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n")); + ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus")); return_VALUE(-EINVAL); } @@ -188,8 +187,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) /* Get the range from the _CRS */ result = acpi_memory_get_device_resources(mem_device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "\nget_device_resources failed\n")); + ACPI_ERROR((AE_INFO, "get_device_resources failed")); mem_device->state = MEMORY_INVALID_STATE; return result; } @@ -200,7 +198,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) */ result = add_memory(mem_device->start_addr, mem_device->length); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); + ACPI_ERROR((AE_INFO, "add_memory failed")); mem_device->state = MEMORY_INVALID_STATE; return result; } @@ -226,7 +224,7 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) "_EJ0", &arg_list, NULL); /* Return on _EJ0 failure */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n")); + ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed")); return_VALUE(-ENODEV); } @@ -256,16 +254,12 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) * Note: Assume that this function returns zero on success */ result = remove_memory(start, len); - if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Hot-Remove failed.\n")); + if (result) return_VALUE(result); - } /* Power-off and eject the device */ result = acpi_memory_powerdown_device(mem_device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device Power Down failed.\n")); /* Set the status of the device to invalid */ mem_device->state = MEMORY_INVALID_STATE; return result; @@ -292,15 +286,14 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "\nReceived DEVICE CHECK notification for device\n")); if (acpi_memory_get_device(handle, &mem_device)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in finding driver data\n")); + ACPI_ERROR((AE_INFO, "Cannot find driver data")); return_VOID; } if (!acpi_memory_check_device(mem_device)) { if (acpi_memory_enable_device(mem_device)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_memory_enable_device\n")); + ACPI_ERROR((AE_INFO, + "Cannot enable memory device")); } break; case ACPI_NOTIFY_EJECT_REQUEST: @@ -308,14 +301,12 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) "\nReceived EJECT REQUEST notification for device\n")); if (acpi_bus_get_device(handle, &device)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device doesn't exist\n")); + ACPI_ERROR((AE_INFO, "Device doesn't exist")); break; } mem_device = acpi_driver_data(device); if (!mem_device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver Data is NULL\n")); + ACPI_ERROR((AE_INFO, "Driver Data is NULL")); break; } @@ -326,8 +317,8 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) * with generic sysfs driver */ if (acpi_memory_disable_device(mem_device)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_memory_disable_device\n")); + ACPI_ERROR((AE_INFO, + "Disable memory device\n")); /* * TBD: Invoke acpi_bus_remove to cleanup data structures */ @@ -405,7 +396,7 @@ static acpi_status is_memory_device(acpi_handle handle) status = acpi_get_object_info(handle, &buffer); if (ACPI_FAILURE(status)) - return_ACPI_STATUS(AE_ERROR); + return_ACPI_STATUS(status); info = buffer.pointer; if (!(info->valid & ACPI_VALID_HID)) { @@ -431,18 +422,15 @@ acpi_memory_register_notify_handler(acpi_handle handle, ACPI_FUNCTION_TRACE("acpi_memory_register_notify_handler"); status = is_memory_device(handle); - if (ACPI_FAILURE(status)) + if (ACPI_FAILURE(status)){ + ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); return_ACPI_STATUS(AE_OK); /* continue */ + } status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify, NULL); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); - return_ACPI_STATUS(AE_OK); /* continue */ - } - - return_ACPI_STATUS(status); + /* continue */ + return_ACPI_STATUS(AE_OK); } static acpi_status @@ -454,19 +442,16 @@ acpi_memory_deregister_notify_handler(acpi_handle handle, ACPI_FUNCTION_TRACE("acpi_memory_deregister_notify_handler"); status = is_memory_device(handle); - if (ACPI_FAILURE(status)) + if (ACPI_FAILURE(status)){ + ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); return_ACPI_STATUS(AE_OK); /* continue */ + } status = acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - return_ACPI_STATUS(AE_OK); /* continue */ - } - return_ACPI_STATUS(status); + return_ACPI_STATUS(AE_OK); /* continue */ } static int __init acpi_memory_device_init(void) @@ -487,7 +472,7 @@ static int __init acpi_memory_device_init(void) NULL, NULL); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); + ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); acpi_bus_unregister_driver(&acpi_memory_device_driver); return_VALUE(-ENODEV); } @@ -511,7 +496,7 @@ static void __exit acpi_memory_device_exit(void) NULL, NULL); if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); + ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); acpi_bus_unregister_driver(&acpi_memory_device_driver); diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 702e857..3b92c94 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -141,7 +141,7 @@ acpi_battery_get_info(struct acpi_battery *battery, status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BIF\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); return_VALUE(-ENODEV); } @@ -151,7 +151,7 @@ acpi_battery_get_info(struct acpi_battery *battery, status = acpi_extract_package(package, &format, &data); if (status != AE_BUFFER_OVERFLOW) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BIF\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BIF")); result = -ENODEV; goto end; } @@ -165,7 +165,7 @@ acpi_battery_get_info(struct acpi_battery *battery, status = acpi_extract_package(package, &format, &data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BIF\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BIF")); kfree(data.pointer); result = -ENODEV; goto end; @@ -202,7 +202,7 @@ acpi_battery_get_status(struct acpi_battery *battery, status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BST\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); return_VALUE(-ENODEV); } @@ -212,7 +212,7 @@ acpi_battery_get_status(struct acpi_battery *battery, status = acpi_extract_package(package, &format, &data); if (status != AE_BUFFER_OVERFLOW) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BST")); result = -ENODEV; goto end; } @@ -226,7 +226,7 @@ acpi_battery_get_status(struct acpi_battery *battery, status = acpi_extract_package(package, &format, &data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BST")); kfree(data.pointer); result = -ENODEV; goto end; @@ -458,8 +458,6 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) if ((bst->state & 0x01) && (bst->state & 0x02)) { seq_printf(seq, "charging state: charging/discharging\n"); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Battery Charging and Discharging?\n")); } else if (bst->state & 0x01) seq_printf(seq, "charging state: discharging\n"); else if (bst->state & 0x02) @@ -609,9 +607,7 @@ static int acpi_battery_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_INFO)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_battery_info_ops; entry->data = acpi_driver_data(device); @@ -622,9 +618,7 @@ static int acpi_battery_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_STATUS)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_battery_state_ops; entry->data = acpi_driver_data(device); @@ -636,9 +630,7 @@ static int acpi_battery_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_ALARM)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_battery_alarm_ops; entry->data = acpi_driver_data(device); @@ -732,8 +724,6 @@ static int acpi_battery_add(struct acpi_device *device) ACPI_DEVICE_NOTIFY, acpi_battery_notify, battery); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -766,9 +756,6 @@ static int acpi_battery_remove(struct acpi_device *device, int type) status = acpi_remove_notify_handler(battery->handle, ACPI_DEVICE_NOTIFY, acpi_battery_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); acpi_battery_remove_fs(device); diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index dd3983c..917bf23 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -69,8 +69,7 @@ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device) status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device); if (ACPI_FAILURE(status) || !*device) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n", - handle)); + ACPI_EXCEPTION((AE_INFO, status, "No context for object [%p]", handle)); return_VALUE(-ENODEV); } @@ -197,8 +196,7 @@ int acpi_bus_set_power(acpi_handle handle, int state) /* Make sure this is a valid target state */ if (!device->flags.power_manageable) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Device is not power manageable\n")); + ACPI_INFO((AE_INFO, "Device is not power manageable")); return_VALUE(-ENODEV); } /* @@ -215,13 +213,13 @@ int acpi_bus_set_power(acpi_handle handle, int state) } } if (!device->power.states[state].flags.valid) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", - state)); + ACPI_WARNING((AE_INFO, "Device does not support D%d", state)); return_VALUE(-ENODEV); } if (device->parent && (state < device->parent->power.state)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Cannot set device to a higher-powered state than parent\n")); + ACPI_WARNING((AE_INFO, + "Cannot set device to a higher-powered" + " state than parent")); return_VALUE(-ENODEV); } @@ -264,9 +262,9 @@ int acpi_bus_set_power(acpi_handle handle, int state) end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Error transitioning device [%s] to D%d\n", - device->pnp.bus_id, state)); + ACPI_WARNING((AE_INFO, + "Transitioning device [%s] to D%d", + device->pnp.bus_id, state)); else ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n", @@ -581,7 +579,7 @@ static int __init acpi_bus_init_irq(void) status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PIC\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC")); return_VALUE(-ENODEV); } diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 4b6d9f0..a8717da 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -207,9 +207,7 @@ static int acpi_button_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BUTTON_FILE_INFO)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_button_info_fops; entry->data = acpi_driver_data(device); @@ -221,9 +219,7 @@ static int acpi_button_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BUTTON_FILE_INFO)); + return -ENODEV; else { entry->proc_fops = &acpi_button_state_fops; entry->data = acpi_driver_data(device); @@ -349,8 +345,8 @@ static int acpi_button_add(struct acpi_device *device) sprintf(acpi_device_class(device), "%s/%s", ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n", - acpi_device_hid(device))); + ACPI_ERROR((AE_INFO, "Unsupported hid [%s]", + acpi_device_hid(device))); result = -ENODEV; goto end; } @@ -381,8 +377,6 @@ static int acpi_button_add(struct acpi_device *device) } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -440,10 +434,6 @@ static int acpi_button_remove(struct acpi_device *device, int type) break; } - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - acpi_button_remove_fs(device); kfree(button); diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index b69a8ca..53625fc 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -94,7 +94,7 @@ static int acpi_container_add(struct acpi_device *device) ACPI_FUNCTION_TRACE("acpi_container_add"); if (!device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "device is NULL\n")); + ACPI_ERROR((AE_INFO, "device is NULL")); return_VALUE(-EINVAL); } diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index 263322b..ec7bcee 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c @@ -216,12 +216,9 @@ static int __init acpi_debug_init(void) return_VALUE(error); Error: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", name)); - remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir); - error = -EFAULT; + error = -ENODEV; goto Done; } diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 18b3ea9..94cc8ab 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -279,7 +279,7 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) atomic_set(&ec->intr.leaving_burst, 0); return_VALUE(0); end: - printk(KERN_WARNING PREFIX "Error in acpi_ec_wait\n"); + ACPI_EXCEPTION ((AE_INFO, status, "EC wait, burst mode"); return_VALUE(-1); } @@ -300,7 +300,7 @@ int acpi_ec_leave_burst_mode(union acpi_ec *ec) atomic_set(&ec->intr.leaving_burst, 1); return_VALUE(0); end: - printk(KERN_WARNING PREFIX "leave burst_mode:error\n"); + ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode"); return_VALUE(-1); } #endif /* ACPI_FUTURE_USAGE */ @@ -963,9 +963,7 @@ static int acpi_ec_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to create '%s' fs entry\n", - ACPI_EC_FILE_INFO)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_ec_info_ops; entry->data = acpi_driver_data(device); @@ -1038,8 +1036,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error obtaining GPE bit assignment\n")); + ACPI_EXCEPTION((AE_INFO, status, "Obtaining GPE bit")); result = -ENODEV; goto end; } @@ -1110,8 +1107,7 @@ static int acpi_ec_intr_add(struct acpi_device *device) acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error obtaining GPE bit assignment\n")); + ACPI_ERROR((AE_INFO, "Obtaining GPE bit assignment")); result = -ENODEV; goto end; } @@ -1205,8 +1201,7 @@ static int acpi_ec_start(struct acpi_device *device) acpi_ec_io_ports, ec); if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error getting I/O port addresses")); + ACPI_ERROR((AE_INFO, "Error getting I/O port addresses")); return_VALUE(-ENODEV); } diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index 2dbb1b0..dab09d3 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c @@ -122,10 +122,7 @@ static int __init acpi_event_init(void) if (entry) entry->proc_fops = &acpi_system_event_ops; else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", - "event")); - error = -EFAULT; + error = -ENODEV; } return_VALUE(error); } diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 1cd2578..c1d4705 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -153,9 +153,7 @@ static int acpi_fan_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_FAN_FILE_STATE)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_fan_state_ops; entry->data = acpi_driver_data(device); @@ -205,8 +203,7 @@ static int acpi_fan_add(struct acpi_device *device) result = acpi_bus_get_power(fan->handle, &state); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error reading power state\n")); + ACPI_ERROR((AE_INFO, "Reading power state")); goto end; } diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index c25b2b9..37dcb1f 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c @@ -356,9 +356,6 @@ static int create_polling_proc(union acpi_hotkey *device) proc = create_proc_entry(proc_name, mode, hotkey_proc_dir); if (!proc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - device->poll_hotkey.poll_method)); return_VALUE(-ENODEV); } else { proc->proc_fops = &hotkey_polling_fops; @@ -771,7 +768,7 @@ static ssize_t hotkey_write_config(struct file *file, if (copy_from_user(config_record, buffer, count)) { kfree(config_record); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n")); + ACPI_ERROR((AE_INFO, "Invalid data")); return_VALUE(-EINVAL); } config_record[count] = 0; @@ -792,8 +789,7 @@ static ssize_t hotkey_write_config(struct file *file, kfree(bus_method); kfree(action_handle); kfree(method); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid data format ret=%d\n", ret)); + ACPI_ERROR((AE_INFO, "Invalid data format ret=%d", ret)); return_VALUE(-EINVAL); } @@ -806,7 +802,7 @@ static ssize_t hotkey_write_config(struct file *file, tmp = get_hotkey_by_event(&global_hotkey_list, internal_event_num); if (!tmp) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key")); + ACPI_ERROR((AE_INFO, "Invalid key")); else memcpy(key, tmp, sizeof(union acpi_hotkey)); goto cont_cmd; @@ -828,7 +824,7 @@ static ssize_t hotkey_write_config(struct file *file, else free_poll_hotkey_buffer(key); kfree(key); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n")); + ACPI_ERROR((AE_INFO, "Invalid hotkey")); return_VALUE(-EINVAL); } @@ -862,7 +858,7 @@ static ssize_t hotkey_write_config(struct file *file, else free_poll_hotkey_buffer(key); kfree(key); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "invalid key\n")); + ACPI_ERROR((AE_INFO, "invalid key")); return_VALUE(-EINVAL); } @@ -907,7 +903,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, val->integer.value = out_obj.integer.value; val->type = out_obj.type; } else - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "null val pointer")); + ACPI_ERROR((AE_INFO, "null val pointer")); return_VALUE((status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER)); } @@ -954,14 +950,14 @@ static ssize_t hotkey_execute_aml_method(struct file *file, if (copy_from_user(arg, buffer, count)) { kfree(arg); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 2")); + ACPI_ERROR((AE_INFO, "Invalid argument 2")); return_VALUE(-EINVAL); } if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) { kfree(arg); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3")); + ACPI_ERROR((AE_INFO, "Invalid argument 3")); return_VALUE(-EINVAL); } kfree(arg); @@ -987,7 +983,7 @@ static ssize_t hotkey_execute_aml_method(struct file *file, } } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Not supported")); + ACPI_WARNING((AE_INFO, "Not supported")); return_VALUE(-EINVAL); } return_VALUE(count); @@ -1013,9 +1009,6 @@ static int __init hotkey_init(void) hotkey_proc_dir = proc_mkdir(HOTKEY_PROC, acpi_root_dir); if (!hotkey_proc_dir) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_PROC)); return (-ENODEV); } hotkey_proc_dir->owner = THIS_MODULE; @@ -1023,9 +1016,6 @@ static int __init hotkey_init(void) hotkey_config = create_proc_entry(HOTKEY_EV_CONFIG, mode, hotkey_proc_dir); if (!hotkey_config) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_EV_CONFIG)); goto do_fail1; } else { hotkey_config->proc_fops = &hotkey_config_fops; @@ -1038,10 +1028,6 @@ static int __init hotkey_init(void) hotkey_poll_config = create_proc_entry(HOTKEY_PL_CONFIG, mode, hotkey_proc_dir); if (!hotkey_poll_config) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_EV_CONFIG)); - goto do_fail2; } else { hotkey_poll_config->proc_fops = &hotkey_poll_config_fops; @@ -1053,9 +1039,6 @@ static int __init hotkey_init(void) hotkey_action = create_proc_entry(HOTKEY_ACTION, mode, hotkey_proc_dir); if (!hotkey_action) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_ACTION)); goto do_fail3; } else { hotkey_action->proc_fops = &hotkey_action_fops; @@ -1066,9 +1049,6 @@ static int __init hotkey_init(void) hotkey_info = create_proc_entry(HOTKEY_INFO, mode, hotkey_proc_dir); if (!hotkey_info) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_INFO)); goto do_fail4; } else { hotkey_info->proc_fops = &hotkey_info_fops; diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 1bb558a..740a3c4 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -137,6 +137,7 @@ void acpi_os_vprintf(const char *fmt, va_list args) #endif } + extern int acpi_in_resume; void *acpi_os_allocate(acpi_size size) { @@ -590,7 +591,7 @@ static void acpi_os_execute_deferred(void *context) dpc = (struct acpi_os_dpc *)context; if (!dpc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); + ACPI_ERROR((AE_INFO, "Invalid (NULL) context")); return_VOID; } @@ -839,13 +840,13 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Failed to acquire semaphore[%p|%d|%d], %s\n", + ACPI_EXCEPTION((AE_INFO, status, + "Failed to acquire semaphore[%p|%d|%d], %s", handle, units, timeout, acpi_format_exception(status))); } else { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, - "Acquired semaphore[%p|%d|%d]\n", handle, + "Acquired semaphore[%p|%d|%d]", handle, units, timeout)); } diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 2a718df..6d3e818e 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c @@ -75,17 +75,17 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI Bus context for device %s\n", - acpi_device_bid(device))); + ACPI_ERROR((AE_INFO, + "Invalid ACPI Bus context for device %s", + acpi_device_bid(device))); return_ACPI_STATUS(AE_NOT_EXIST); } status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data); if (ACPI_FAILURE(status) || !data) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI-PCI context for device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Invalid ACPI-PCI context for device %s", + acpi_device_bid(device))); return_ACPI_STATUS(status); } @@ -151,9 +151,9 @@ int acpi_pci_bind(struct acpi_device *device) status = acpi_get_data(device->parent->handle, acpi_pci_data_handler, (void **)&pdata); if (ACPI_FAILURE(status) || !pdata || !pdata->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI-PCI context for parent device %s\n", - acpi_device_bid(device->parent))); + ACPI_EXCEPTION((AE_INFO, status, + "Invalid ACPI-PCI context for parent device %s", + acpi_device_bid(device->parent))); result = -ENODEV; goto end; } @@ -206,10 +206,10 @@ int acpi_pci_bind(struct acpi_device *device) goto end; } if (!data->dev->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n", - data->id.segment, data->id.bus, - data->id.device, data->id.function)); + ACPI_ERROR((AE_INFO, + "Device %02x:%02x:%02x.%02x has invalid 'bus' field", + data->id.segment, data->id.bus, + data->id.device, data->id.function)); result = -ENODEV; goto end; } @@ -237,9 +237,9 @@ int acpi_pci_bind(struct acpi_device *device) */ status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to attach ACPI-PCI context to device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to attach ACPI-PCI context to device %s", + acpi_device_bid(device))); result = -ENODEV; goto end; } @@ -301,18 +301,18 @@ int acpi_pci_unbind(struct acpi_device *device) acpi_get_data(device->handle, acpi_pci_data_handler, (void **)&data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to get data from device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to get data from device %s", + acpi_device_bid(device))); result = -ENODEV; goto end; } status = acpi_detach_data(device->handle, acpi_pci_data_handler); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to detach data from device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to detach data from device %s", + acpi_device_bid(device))); result = -ENODEV; goto end; } @@ -369,9 +369,9 @@ acpi_pci_bind_root(struct acpi_device *device, status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to attach ACPI-PCI context to device %s\n", - pathname)); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to attach ACPI-PCI context to device %s", + pathname)); result = -ENODEV; goto end; } diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 65aee79..4cabc51 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -197,8 +197,8 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) kfree(pathname); status = acpi_get_irq_routing_table(handle, &buffer); if (status != AE_BUFFER_OVERFLOW) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", + acpi_format_exception(status))); return_VALUE(-ENODEV); } @@ -211,8 +211,8 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) status = acpi_get_irq_routing_table(handle, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", + acpi_format_exception(status))); kfree(buffer.pointer); return_VALUE(-ENODEV); } @@ -269,8 +269,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, entry->link.index, triggering, polarity, link); if (irq < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid IRQ link routing entry\n")); + ACPI_WARNING((AE_INFO, + "Invalid IRQ link routing entry")); return_VALUE(-1); } } else { @@ -379,9 +379,8 @@ acpi_pci_irq_derive(struct pci_dev *dev, } if (irq < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to derive IRQ for device %s\n", - pci_name(dev))); + ACPI_WARNING((AE_INFO, "Unable to derive IRQ for device %s", + pci_name(dev))); return_VALUE(-1); } @@ -421,8 +420,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) pin--; if (!dev->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid (NULL) 'bus' field\n")); + ACPI_ERROR((AE_INFO, "Invalid (NULL) 'bus' field")); return_VALUE(-ENODEV); } diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 228bdb6..415b262 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -116,17 +116,15 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) { struct acpi_resource_irq *p = &resource->data.irq; if (!p || !p->interrupt_count) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank IRQ resource\n")); + ACPI_WARNING((AE_INFO, "Blank IRQ resource")); return_ACPI_STATUS(AE_OK); } for (i = 0; (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid IRQ %d\n", - p->interrupts[i])); + ACPI_WARNING((AE_INFO, "Invalid IRQ %d", + p->interrupts[i])); continue; } link->irq.possible[i] = p->interrupts[i]; @@ -142,17 +140,16 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) struct acpi_resource_extended_irq *p = &resource->data.extended_irq; if (!p || !p->interrupt_count) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank EXT IRQ resource\n")); + ACPI_WARNING((AE_INFO, + "Blank EXT IRQ resource")); return_ACPI_STATUS(AE_OK); } for (i = 0; (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid IRQ %d\n", - p->interrupts[i])); + ACPI_WARNING((AE_INFO, "Invalid IRQ %d", + p->interrupts[i])); continue; } link->irq.possible[i] = p->interrupts[i]; @@ -164,8 +161,7 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) break; } default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Resource is not an IRQ entry\n")); + ACPI_ERROR((AE_INFO, "Resource is not an IRQ entry\n")); return_ACPI_STATUS(AE_OK); } @@ -184,7 +180,7 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link) status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, acpi_pci_link_check_possible, link); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRS\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS")); return_VALUE(-ENODEV); } @@ -227,8 +223,8 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) * extended IRQ descriptors must * return at least 1 IRQ */ - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank EXT IRQ resource\n")); + ACPI_WARNING((AE_INFO, + "Blank EXT IRQ resource")); return_ACPI_STATUS(AE_OK); } *irq = p->interrupts[0]; @@ -236,7 +232,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) } break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource %d isn't an IRQ\n", resource->type)); + ACPI_ERROR((AE_INFO, "Resource %d isn't an IRQ", resource->type)); case ACPI_RESOURCE_TYPE_END_TAG: return_ACPI_STATUS(AE_OK); } @@ -268,8 +264,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) /* Query _STA, set link->device->status */ result = acpi_bus_get_status(link->device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to read status\n")); + ACPI_ERROR((AE_INFO, "Unable to read status")); goto end; } @@ -286,13 +281,13 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) status = acpi_walk_resources(link->handle, METHOD_NAME__CRS, acpi_pci_link_check_current, &irq); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _CRS\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS")); result = -ENODEV; goto end; } if (acpi_strict && !irq) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_CRS returned 0\n")); + ACPI_ERROR((AE_INFO, "_CRS returned 0")); result = -ENODEV; } @@ -362,7 +357,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) /* ignore resource_source, it's optional */ break; default: - printk("ACPI BUG: resource_type %d\n", link->irq.resource_type); + ACPI_ERROR((AE_INFO, "Invalid Resource_type %d\n", link->irq.resource_type)); result = -EINVAL; goto end; @@ -374,7 +369,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) /* check for total failure */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SRS\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SRS")); result = -ENODEV; goto end; } @@ -382,14 +377,14 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) /* Query _STA, set device->status */ result = acpi_bus_get_status(link->device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to read status\n")); + ACPI_ERROR((AE_INFO, "Unable to read status")); goto end; } if (!link->device->status.enabled) { - printk(KERN_WARNING PREFIX - "%s [%s] disabled and referenced, BIOS bug.\n", - acpi_device_name(link->device), - acpi_device_bid(link->device)); + ACPI_WARNING((AE_INFO, + "%s [%s] disabled and referenced, BIOS bug", + acpi_device_name(link->device), + acpi_device_bid(link->device))); } /* Query _CRS, set link->irq.active */ @@ -407,10 +402,10 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) * policy: when _CRS doesn't return what we just _SRS * assume _SRS worked and override _CRS value. */ - printk(KERN_WARNING PREFIX - "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", - acpi_device_name(link->device), - acpi_device_bid(link->device), link->irq.active, irq); + ACPI_WARNING((AE_INFO, + "%s [%s] BIOS reported IRQ %d, using IRQ %d", + acpi_device_name(link->device), + acpi_device_bid(link->device), link->irq.active, irq)); link->irq.active = irq; } @@ -501,8 +496,7 @@ int __init acpi_irq_penalty_init(void) link = list_entry(node, struct acpi_pci_link, node); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid link context\n")); + ACPI_ERROR((AE_INFO, "Invalid link context")); continue; } @@ -561,8 +555,8 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) */ if (i == link->irq.possible_count) { if (acpi_strict) - printk(KERN_WARNING PREFIX "_CRS %d not found" - " in _PRS\n", link->irq.active); + ACPI_WARNING((AE_INFO, "_CRS %d not found" + " in _PRS", link->irq.active)); link->irq.active = 0; } @@ -589,11 +583,10 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) /* Attempt to enable the link device at this IRQ. */ if (acpi_pci_link_set(link, irq)) { - printk(PREFIX - "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n" - "Try pci=noacpi or acpi=off\n", - acpi_device_name(link->device), - acpi_device_bid(link->device)); + ACPI_ERROR((AE_INFO, "Unable to set IRQ for %s [%s]. " + "Try pci=noacpi or acpi=off", + acpi_device_name(link->device), + acpi_device_bid(link->device))); return_VALUE(-ENODEV); } else { acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; @@ -626,19 +619,19 @@ acpi_pci_link_allocate_irq(acpi_handle handle, result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); + ACPI_ERROR((AE_INFO, "Invalid link device")); return_VALUE(-1); } link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); + ACPI_ERROR((AE_INFO, "Invalid link context")); return_VALUE(-1); } /* TBD: Support multiple index (IRQ) entries per Link Device */ if (index) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid index %d\n", index)); + ACPI_ERROR((AE_INFO, "Invalid index %d", index)); return_VALUE(-1); } @@ -650,7 +643,7 @@ acpi_pci_link_allocate_irq(acpi_handle handle, if (!link->irq.active) { mutex_unlock(&acpi_link_lock); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); + ACPI_ERROR((AE_INFO, "Link active IRQ is 0!")); return_VALUE(-1); } link->refcnt++; @@ -682,20 +675,20 @@ int acpi_pci_link_free_irq(acpi_handle handle) result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); + ACPI_ERROR((AE_INFO, "Invalid link device")); return_VALUE(-1); } link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); + ACPI_ERROR((AE_INFO, "Invalid link context")); return_VALUE(-1); } mutex_lock(&acpi_link_lock); if (!link->irq.initialized) { mutex_unlock(&acpi_link_lock); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); + ACPI_ERROR((AE_INFO, "Link isn't initialized")); return_VALUE(-1); } #ifdef FUTURE_USE @@ -820,8 +813,7 @@ static int irqrouter_resume(struct sys_device *dev) list_for_each(node, &acpi_link.entries) { link = list_entry(node, struct acpi_pci_link, node); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid link context\n")); + ACPI_ERROR((AE_INFO, "Invalid link context")); continue; } acpi_pci_link_resume(link); diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 4c313ea..0f661dd 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -198,7 +198,7 @@ static int acpi_pci_root_add(struct acpi_device *device) root->id.segment = 0; break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SEG\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SEG")); result = -ENODEV; goto end; } @@ -219,7 +219,7 @@ static int acpi_pci_root_add(struct acpi_device *device) root->id.bus = 0; break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BBN\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BBN")); result = -ENODEV; goto end; } @@ -231,8 +231,9 @@ static int acpi_pci_root_add(struct acpi_device *device) int bus = 0; acpi_status status; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Wrong _BBN value, please reboot and using option 'pci=noacpi'\n")); + ACPI_ERROR((AE_INFO, + "Wrong _BBN value, reboot" + " and use option 'pci=noacpi'")); status = try_get_root_bridge_busnr(root->handle, &bus); if (ACPI_FAILURE(status)) @@ -273,9 +274,9 @@ static int acpi_pci_root_add(struct acpi_device *device) */ root->bus = pci_acpi_scan_root(device, root->id.segment, root->id.bus); if (!root->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Bus %04x:%02x not present in PCI namespace\n", - root->id.segment, root->id.bus)); + ACPI_ERROR((AE_INFO, + "Bus %04x:%02x not present in PCI namespace", + root->id.segment, root->id.bus)); result = -ENODEV; goto end; } diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 62a5595..5712803 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -105,8 +105,7 @@ acpi_power_get_context(acpi_handle handle, result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context [%p]\n", - handle)); + ACPI_WARNING((AE_INFO, "Getting context [%p]", handle)); return_VALUE(result); } @@ -292,8 +291,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) for (i = 0; i < dev->wakeup.resources.count; i++) { ret = acpi_power_on(dev->wakeup.resources.handles[i]); if (ret) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error transition power state\n")); + ACPI_ERROR((AE_INFO, "Transition power state")); dev->wakeup.flags.valid = 0; return_VALUE(-1); } @@ -302,7 +300,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) /* Execute PSW */ status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluate _PSW\n")); + ACPI_ERROR((AE_INFO, "Evaluate _PSW")); dev->wakeup.flags.valid = 0; ret = -1; } @@ -332,7 +330,7 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) /* Execute PSW */ status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluate _PSW\n")); + ACPI_ERROR((AE_INFO, "Evaluate _PSW")); dev->wakeup.flags.valid = 0; return_VALUE(-1); } @@ -341,8 +339,7 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) for (i = 0; i < dev->wakeup.resources.count; i++) { ret = acpi_power_off_device(dev->wakeup.resources.handles[i]); if (ret) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error transition power state\n")); + ACPI_ERROR((AE_INFO, "Transition power state")); dev->wakeup.flags.valid = 0; return_VALUE(-1); } @@ -444,9 +441,8 @@ int acpi_power_transition(struct acpi_device *device, int state) device->power.state = state; end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Error transitioning device [%s] to D%d\n", - device->pnp.bus_id, state)); + ACPI_WARNING((AE_INFO, "Transitioning device [%s] to D%d", + device->pnp.bus_id, state)); return_VALUE(result); } @@ -516,9 +512,7 @@ static int acpi_power_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_POWER_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_POWER_FILE_STATUS)); + return_VALUE(-EIO); else { entry->proc_fops = &acpi_power_fops; entry->data = acpi_driver_data(device); diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index decaebb..2bbdf8a 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -328,9 +328,7 @@ static int acpi_processor_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_INFO)); + return_VALUE(-EIO); else { entry->proc_fops = &acpi_processor_info_fops; entry->data = acpi_driver_data(device); @@ -342,9 +340,7 @@ static int acpi_processor_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_THROTTLING)); + return_VALUE(-EIO); else { entry->proc_fops = &acpi_processor_throttling_fops; entry->data = acpi_driver_data(device); @@ -356,9 +352,7 @@ static int acpi_processor_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_LIMIT)); + return_VALUE( -EIO); else { entry->proc_fops = &acpi_processor_limit_fops; entry->data = acpi_driver_data(device); @@ -459,8 +453,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) */ status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error evaluating processor object\n")); + ACPI_ERROR((AE_INFO, "Evaluating processor object")); return_VALUE(-ENODEV); } @@ -490,9 +483,9 @@ static int acpi_processor_get_info(struct acpi_processor *pr) if (cpu_index == -1) { if (ACPI_FAILURE (acpi_processor_hotadd_init(pr->handle, &pr->id))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error getting cpuindex for acpiid 0x%x\n", - pr->acpi_id)); + ACPI_ERROR((AE_INFO, + "Getting cpuindex for acpiid 0x%x", + pr->acpi_id)); return_VALUE(-ENODEV); } } @@ -503,8 +496,8 @@ static int acpi_processor_get_info(struct acpi_processor *pr) if (!object.processor.pblk_address) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n")); else if (object.processor.pblk_length != 6) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid PBLK length [%d]\n", - object.processor.pblk_length)); + ACPI_ERROR((AE_INFO, "Invalid PBLK length [%d]", + object.processor.pblk_length)); else { pr->throttling.address = object.processor.pblk_address; pr->throttling.duty_offset = acpi_fadt.duty_offset; @@ -572,10 +565,6 @@ static int acpi_processor_start(struct acpi_device *device) status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, acpi_processor_notify, pr); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing device notify handler\n")); - } /* _PDC call should be done before doing anything else (if reqd.). */ arch_acpi_processor_init_pdc(pr); @@ -675,10 +664,6 @@ static int acpi_processor_remove(struct acpi_device *device, int type) status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, acpi_processor_notify); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - } acpi_processor_remove_fs(device); @@ -705,8 +690,7 @@ static int is_processor_present(acpi_handle handle) status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Processor Device is not present\n")); + ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); return_VALUE(0); } return_VALUE(1); @@ -767,15 +751,14 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) if (acpi_bus_get_device(handle, &device)) { result = acpi_processor_device_add(handle, &device); if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to add the device\n")); + ACPI_ERROR((AE_INFO, + "Unable to add the device")); break; } pr = acpi_driver_data(device); if (!pr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver data is NULL\n")); + ACPI_ERROR((AE_INFO, "Driver data is NULL")); break; } @@ -788,9 +771,8 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { kobject_uevent(&device->kobj, KOBJ_ONLINE); } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device [%s] failed to start\n", - acpi_device_bid(device))); + ACPI_ERROR((AE_INFO, "Device [%s] failed to start", + acpi_device_bid(device))); } break; case ACPI_NOTIFY_EJECT_REQUEST: @@ -798,14 +780,14 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) "received ACPI_NOTIFY_EJECT_REQUEST\n")); if (acpi_bus_get_device(handle, &device)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device don't exist, dropping EJECT\n")); + ACPI_ERROR((AE_INFO, + "Device don't exist, dropping EJECT")); break; } pr = acpi_driver_data(device); if (!pr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver data is NULL, dropping EJECT\n")); + ACPI_ERROR((AE_INFO, + "Driver data is NULL, dropping EJECT")); return_VOID; } diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 8a74bf3..52ada53 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -674,8 +674,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) /* There must be at least 2 elements */ if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "not enough elements in _CST\n")); + ACPI_ERROR((AE_INFO, "not enough elements in _CST")); status = -EFAULT; goto end; } @@ -684,8 +683,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) /* Validate number of power states. */ if (count < 1 || count != cst->package.count - 1) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "count given by _CST is not valid\n")); + ACPI_ERROR((AE_INFO, "count given by _CST is not valid")); status = -EFAULT; goto end; } @@ -1112,8 +1110,8 @@ int acpi_processor_power_init(struct acpi_processor *pr, status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Notifying BIOS of _CST ability failed\n")); + ACPI_EXCEPTION((AE_INFO, status, + "Notifying BIOS of _CST ability failed")); } } @@ -1142,9 +1140,7 @@ int acpi_processor_power_init(struct acpi_processor *pr, entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_POWER)); + return -EIO; else { entry->proc_fops = &acpi_processor_power_fops; entry->data = acpi_driver_data(device); diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 41aaaba..a79b6ef 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -123,7 +123,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) acpi_processor_ppc_status |= PPC_IN_USE; if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PPC\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC")); return_VALUE(-ENODEV); } @@ -172,14 +172,14 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PCT\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PCT")); return_VALUE(-ENODEV); } pct = (union acpi_object *)buffer.pointer; if (!pct || (pct->type != ACPI_TYPE_PACKAGE) || (pct->package.count != 2)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PCT data\n")); + ACPI_ERROR((AE_INFO, "Invalid _PCT data")); result = -EFAULT; goto end; } @@ -193,8 +193,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) if ((obj.type != ACPI_TYPE_BUFFER) || (obj.buffer.length < sizeof(struct acpi_pct_register)) || (obj.buffer.pointer == NULL)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PCT data (control_register)\n")); + ACPI_ERROR((AE_INFO, "Invalid _PCT data (control_register)")); result = -EFAULT; goto end; } @@ -210,8 +209,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) if ((obj.type != ACPI_TYPE_BUFFER) || (obj.buffer.length < sizeof(struct acpi_pct_register)) || (obj.buffer.pointer == NULL)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PCT data (status_register)\n")); + ACPI_ERROR((AE_INFO, "Invalid _PCT data (status_register)")); result = -EFAULT; goto end; } @@ -239,13 +237,13 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PSS\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PSS")); return_VALUE(-ENODEV); } pss = (union acpi_object *)buffer.pointer; if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); + ACPI_ERROR((AE_INFO, "Invalid _PSS data")); result = -EFAULT; goto end; } @@ -274,8 +272,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) status = acpi_extract_package(&(pss->package.elements[i]), &format, &state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PSS data\n")); + ACPI_EXCEPTION((AE_INFO, status, "Invalid _PSS data")); result = -EFAULT; kfree(pr->performance->states); goto end; @@ -291,8 +288,8 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) (u32) px->control, (u32) px->status)); if (!px->core_frequency) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PSS data: freq is zero\n")); + ACPI_ERROR((AE_INFO, + "Invalid _PSS data: freq is zero")); result = -EFAULT; kfree(pr->performance->states); goto end; @@ -387,10 +384,10 @@ int acpi_processor_notify_smm(struct module *calling_module) status = acpi_os_write_port(acpi_fadt.smi_cmd, (u32) acpi_fadt.pstate_cnt, 8); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Failed to write pstate_cnt [0x%x] to " - "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, - acpi_fadt.smi_cmd)); + ACPI_EXCEPTION((AE_INFO, status, + "Failed to write pstate_cnt [0x%x] to " + "smi_cmd [0x%x]", acpi_fadt.pstate_cnt, + acpi_fadt.smi_cmd)); module_put(calling_module); return_VALUE(status); } @@ -514,11 +511,7 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr) entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); - if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_PERFORMANCE)); - else { + if (entry){ acpi_processor_perf_fops.write = acpi_processor_write_performance; entry->proc_fops = &acpi_processor_perf_fops; entry->data = acpi_driver_data(device); diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index f99ad05..c2095ab 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -82,7 +82,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to set limit\n")); + ACPI_ERROR((AE_INFO, "Unable to set limit")); return_VALUE(result); } @@ -289,8 +289,7 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) result = acpi_processor_apply_limit(pr); if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to set thermal limit\n")); + ACPI_ERROR((AE_INFO, "Unable to set thermal limit")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n", pr->limit.thermal.px, pr->limit.thermal.tx)); @@ -362,25 +361,23 @@ static ssize_t acpi_processor_write_limit(struct file * file, ACPI_FUNCTION_TRACE("acpi_processor_write_limit"); if (!pr || (count > sizeof(limit_string) - 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); return_VALUE(-EINVAL); } if (copy_from_user(limit_string, buffer, count)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); return_VALUE(-EFAULT); } limit_string[count] = '\0'; if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); + ACPI_ERROR((AE_INFO, "Invalid data format")); return_VALUE(-EINVAL); } if (pr->flags.throttling) { if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid tx\n")); + ACPI_ERROR((AE_INFO, "Invalid tx")); return_VALUE(-EINVAL); } pr->limit.user.tx = tx; diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index b966549..97856ad 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c @@ -196,7 +196,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) } /* TBD: Support duty_cycle values that span bit 4. */ else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "duty_cycle spans bit 4\n")); + ACPI_WARNING((AE_INFO, "duty_cycle spans bit 4")); return_VALUE(0); } diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index f8316a0..964ee5c 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -311,15 +311,14 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) /* _PRW */ status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRW\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW")); goto end; } package = (union acpi_object *)buffer.pointer; status = acpi_bus_extract_wakeup_device_power_package(device, package); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error extracting _PRW package\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _PRW package")); goto end; } @@ -970,7 +969,7 @@ acpi_add_single_object(struct acpi_device **child, device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL); if (!device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Memory allocation error\n")); + ACPI_ERROR((AE_INFO, "Memory allocation error")); return_VALUE(-ENOMEM); } memset(device, 0, sizeof(struct acpi_device)); diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index a934ac4..56a746b 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c @@ -161,9 +161,6 @@ static int __init acpi_system_init(void) return_VALUE(error); Error: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", name)); - remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_INFO, acpi_root_dir); diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index e7fe3a1..44fffe1 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -325,7 +325,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) &tz->trips.critical.temperature); if (ACPI_FAILURE(status)) { tz->trips.critical.flags.valid = 0; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No critical threshold\n")); + ACPI_EXCEPTION((AE_INFO, status, "No critical threshold")); return_VALUE(-ENODEV); } else { tz->trips.critical.flags.valid = 1; @@ -384,8 +384,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) tz->trips.passive.flags.valid = 0; if (!tz->trips.passive.flags.valid) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid passive threshold\n")); + ACPI_WARNING((AE_INFO, "Invalid passive threshold")); else ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found passive threshold [%lu]\n", @@ -414,9 +413,8 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) "Found active threshold [%d]:[%lu]\n", i, tz->trips.active[i].temperature)); } else - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid active threshold [%d]\n", - i)); + ACPI_EXCEPTION((AE_INFO, status, + "Invalid active threshold [%d]", i)); } return_VALUE(0); @@ -471,7 +469,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) return_VALUE(-EINVAL); if (tz->temperature >= tz->trips.critical.temperature) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Critical trip point\n")); + ACPI_WARNING((AE_INFO, "Critical trip point")); tz->trips.critical.flags.enabled = 1; } else if (tz->trips.critical.flags.enabled) tz->trips.critical.flags.enabled = 0; @@ -502,7 +500,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) return_VALUE(-EINVAL); if (tz->temperature >= tz->trips.hot.temperature) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Hot trip point\n")); + ACPI_WARNING((AE_INFO, "Hot trip point")); tz->trips.hot.flags.enabled = 1; } else if (tz->trips.hot.flags.enabled) tz->trips.hot.flags.enabled = 0; @@ -642,10 +640,10 @@ static void acpi_thermal_active(struct acpi_thermal *tz) handles[j], ACPI_STATE_D0); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to turn cooling device [%p] 'on'\n", - active->devices. - handles[j])); + ACPI_WARNING((AE_INFO, + "Unable to turn cooling device [%p] 'on'", + active->devices. + handles[j])); continue; } active->flags.enabled = 1; @@ -667,9 +665,9 @@ static void acpi_thermal_active(struct acpi_thermal *tz) result = acpi_bus_set_power(active->devices.handles[j], ACPI_STATE_D3); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to turn cooling device [%p] 'off'\n", - active->devices.handles[j])); + ACPI_WARNING((AE_INFO, + "Unable to turn cooling device [%p] 'off'", + active->devices.handles[j])); continue; } active->flags.enabled = 0; @@ -700,7 +698,7 @@ static void acpi_thermal_check(void *data) ACPI_FUNCTION_TRACE("acpi_thermal_check"); if (!tz) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); + ACPI_ERROR((AE_INFO, "Invalid (NULL) context")); return_VOID; } @@ -949,13 +947,11 @@ acpi_thermal_write_trip_points(struct file *file, } if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); count = -EINVAL; goto end; } if (copy_from_user(limit_string, buffer, count)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); count = -EFAULT; goto end; } @@ -968,7 +964,6 @@ acpi_thermal_write_trip_points(struct file *file, &active[5], &active[6], &active[7], &active[8], &active[9]); if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); count = -EINVAL; goto end; } @@ -1128,9 +1123,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_STATE)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_thermal_state_fops; entry->data = acpi_driver_data(device); @@ -1141,9 +1134,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_TEMPERATURE)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_thermal_temp_fops; entry->data = acpi_driver_data(device); @@ -1155,9 +1146,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_TRIP_POINTS)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_thermal_trip_fops; entry->data = acpi_driver_data(device); @@ -1169,9 +1158,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_COOLING_MODE)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_thermal_cooling_fops; entry->data = acpi_driver_data(device); @@ -1183,9 +1170,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_POLLING_FREQ)); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_thermal_polling_fops; entry->data = acpi_driver_data(device); @@ -1355,8 +1340,6 @@ static int acpi_thermal_add(struct acpi_device *device) ACPI_DEVICE_NOTIFY, acpi_thermal_notify, tz); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -1398,9 +1381,6 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) status = acpi_remove_notify_handler(tz->handle, ACPI_DEVICE_NOTIFY, acpi_thermal_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); /* Terminate policy */ if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) { diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 6b51685..ce093d4 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -62,26 +62,25 @@ acpi_extract_package(union acpi_object *package, if (!package || (package->type != ACPI_TYPE_PACKAGE) || (package->package.count < 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid 'package' argument\n")); + ACPI_WARNING((AE_INFO, "Invalid package argument")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!format || !format->pointer || (format->length < 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'format' argument\n")); + ACPI_WARNING((AE_INFO, "Invalid format argument")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!buffer) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'buffer' argument\n")); + ACPI_WARNING((AE_INFO, "Invalid buffer argument")); return_ACPI_STATUS(AE_BAD_PARAMETER); } format_count = (format->length / sizeof(char)) - 1; if (format_count > package->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Format specifies more objects [%d] than exist in package [%d].", - format_count, package->package.count)); + ACPI_WARNING((AE_INFO, "Format specifies more objects [%d]" + " than exist in package [%d].", + format_count, package->package.count)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -113,9 +112,10 @@ acpi_extract_package(union acpi_object *package, tail_offset += sizeof(char *); break; default: - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid package element [%d]: got number, expecing [%c].\n", - i, format_string[i])); + ACPI_WARNING((AE_INFO, "Invalid package element" + " [%d]: got number, expecing" + " [%c]", + i, format_string[i])); return_ACPI_STATUS(AE_BAD_DATA); break; } @@ -138,9 +138,10 @@ acpi_extract_package(union acpi_object *package, tail_offset += sizeof(u8 *); break; default: - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid package element [%d] got string/buffer, expecing [%c].\n", - i, format_string[i])); + ACPI_WARNING((AE_INFO, "Invalid package element" + " [%d] got string/buffer," + " expecing [%c]", + i, format_string[i])); return_ACPI_STATUS(AE_BAD_DATA); break; } @@ -325,7 +326,7 @@ acpi_evaluate_string(acpi_handle handle, *data = kmalloc(element->string.length + 1, GFP_KERNEL); if (!data) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Memory allocation error\n")); + ACPI_ERROR((AE_INFO, "Memory allocation")); return_VALUE(-ENOMEM); } memset(*data, 0, element->string.length + 1); @@ -367,25 +368,22 @@ acpi_evaluate_reference(acpi_handle handle, package = (union acpi_object *)buffer.pointer; if ((buffer.length == 0) || !package) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No return object (len %X ptr %p)\n", - (unsigned)buffer.length, package)); + ACPI_ERROR((AE_INFO, "No return object (len %X ptr %p)", + (unsigned)buffer.length, package)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->type != ACPI_TYPE_PACKAGE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Expecting a [Package], found type %X\n", - package->type)); + ACPI_ERROR((AE_INFO, "Expecting a [Package], found type %X", + package->type)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (!package->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "[Package] has zero elements (%p)\n", - package)); + ACPI_ERROR((AE_INFO, "[Package] has zero elements (%p)", + package)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; @@ -404,9 +402,9 @@ acpi_evaluate_reference(acpi_handle handle, if (element->type != ACPI_TYPE_ANY) { status = AE_BAD_DATA; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Expecting a [Reference] package element, found type %X\n", - element->type)); + ACPI_ERROR((AE_INFO, + "Expecting a [Reference] package element, found type %X", + element->type)); acpi_util_eval_error(handle, pathname, status); break; } diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index e7e9a693..7854a4a 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -324,7 +324,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, return_VALUE(status); obj = (union acpi_object *)buffer.pointer; if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); + ACPI_ERROR((AE_INFO, "Invalid _BCL data")); status = -EFAULT; goto err; } @@ -399,7 +399,7 @@ acpi_video_device_EDID(struct acpi_video_device *device, if (obj && obj->type == ACPI_TYPE_BUFFER) *edid = obj; else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DDC data\n")); + ACPI_ERROR((AE_INFO, "Invalid _DDC data")); status = -EFAULT; kfree(obj); } @@ -560,8 +560,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) o = (union acpi_object *)&obj->package. elements[i]; if (o->type != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid data\n")); + ACPI_ERROR((AE_INFO, "Invalid data")); continue; } br->levels[count] = (u32) o->integer.value; @@ -904,8 +903,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) /* 'info' [R] */ entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'info' fs entry\n")); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_video_device_info_fops; entry->data = acpi_driver_data(device); @@ -917,8 +915,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'state' fs entry\n")); + return_VALUE(-ENODEV); else { acpi_video_device_state_fops.write = acpi_video_device_write_state; entry->proc_fops = &acpi_video_device_state_fops; @@ -931,8 +928,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'brightness' fs entry\n")); + return_VALUE(-ENODEV); else { acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; entry->proc_fops = &acpi_video_device_brightness_fops; @@ -943,8 +939,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) /* 'EDID' [R] */ entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'brightness' fs entry\n")); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_video_device_EDID_fops; entry->data = acpi_driver_data(device); @@ -1200,8 +1195,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) /* 'info' [R] */ entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'info' fs entry\n")); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_video_bus_info_fops; entry->data = acpi_driver_data(device); @@ -1211,8 +1205,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) /* 'ROM' [R] */ entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'ROM' fs entry\n")); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_video_bus_ROM_fops; entry->data = acpi_driver_data(device); @@ -1223,8 +1216,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) entry = create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'POST_info' fs entry\n")); + return_VALUE(-ENODEV); else { entry->proc_fops = &acpi_video_bus_POST_info_fops; entry->data = acpi_driver_data(device); @@ -1236,8 +1228,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'POST' fs entry\n")); + return_VALUE(-ENODEV); else { acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; entry->proc_fops = &acpi_video_bus_POST_fops; @@ -1250,8 +1241,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'DOS' fs entry\n")); + return_VALUE(-ENODEV); else { acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; entry->proc_fops = &acpi_video_bus_DOS_fops; @@ -1446,13 +1436,13 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer); if (!ACPI_SUCCESS(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _DOD\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD")); return_VALUE(status); } dod = (union acpi_object *)buffer.pointer; if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n")); + ACPI_EXCEPTION((AE_INFO, status, "Invalid _DOD data")); status = -EFAULT; goto out; } @@ -1476,8 +1466,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) obj = (union acpi_object *)&dod->package.elements[i]; if (obj->type != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _DOD data\n")); + ACPI_ERROR((AE_INFO, "Invalid _DOD data")); active_device_list[i].value.int_val = ACPI_VIDEO_HEAD_INVALID; } @@ -1591,8 +1580,7 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, status = acpi_video_bus_get_one_device(dev, video); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Cant attach device\n")); + ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); continue; } @@ -1620,9 +1608,6 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) status = acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, acpi_video_device_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); return_VALUE(0); } @@ -1826,9 +1811,6 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) status = acpi_remove_notify_handler(video->handle, ACPI_DEVICE_NOTIFY, acpi_video_bus_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); acpi_video_bus_put_devices(video); acpi_video_bus_remove_fs(device); -- cgit v0.10.2 From be63c925a123b492fc05063c98ca7e9f7453a58a Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Fri, 2 Jun 2006 15:58:00 -0400 Subject: ACPI: Export symbols for ACPI_ERROR/EXCEPTION/WARNING macros Signed-off-by: Thomas Renninger Signed-off-by: Len Brown diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 5c75d35..58daa37 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -41,6 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include + #include #include @@ -948,6 +950,7 @@ acpi_ut_error(char *module_name, u32 line_number, char *format, ...) acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } +EXPORT_SYMBOL(acpi_ut_error); void ACPI_INTERNAL_VAR_XFACE acpi_ut_exception(char *module_name, @@ -962,6 +965,7 @@ acpi_ut_exception(char *module_name, acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } +EXPORT_SYMBOL(acpi_ut_exception); void ACPI_INTERNAL_VAR_XFACE acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) @@ -974,7 +978,7 @@ acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } - +EXPORT_SYMBOL(acpi_ut_warning); void ACPI_INTERNAL_VAR_XFACE acpi_ut_info(char *module_name, u32 line_number, char *format, ...) { -- cgit v0.10.2 From 9e7e2c047503db5a094ab30c7b4b8a5a0a324915 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Thu, 27 Apr 2006 05:25:00 -0400 Subject: ACPI: acpi_os_wait_semaphore(): silence complaint The ASL Acquire operator (17.5.1 in ACPI 3.0 spec) is allowed to time out and return True without acquiring the semaphore. There's no indication in the spec that this is an actual error, so this message should be debug-only, as the message for successful acquisition is. This used to be an ACPI_DEBUG_PRINT, but it was mis-classified as ACPI_DB_ERROR rather than ACPI_DB_MUTEX, so it got swept up in Thomas' recent patch to enable ACPI error messages even without CONFIG_ACPI_DEBUG. Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 740a3c4..2d90b8d 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -840,7 +840,7 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) } if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Failed to acquire semaphore[%p|%d|%d], %s", handle, units, timeout, acpi_format_exception(status))); -- cgit v0.10.2 From 64dedfb8fdbbc4fabb8c131e4b597cd4bc7f3881 Mon Sep 17 00:00:00 2001 From: Jae-hyeon Park Date: Mon, 26 Jun 2006 22:34:03 -0400 Subject: ACPI: Device [kobj-name] is not power manageable print kobj name in this message. lenb changed to use printk. Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 917bf23..f4a36d3 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -196,7 +196,8 @@ int acpi_bus_set_power(acpi_handle handle, int state) /* Make sure this is a valid target state */ if (!device->flags.power_manageable) { - ACPI_INFO((AE_INFO, "Device is not power manageable")); + printk(KERN_DEBUG "Device `[%s]is not power manageable", + device->kobj.name); return_VALUE(-ENODEV); } /* -- cgit v0.10.2 From cece92969762b8ed7930d4e23008b76b06411dee Mon Sep 17 00:00:00 2001 From: Len Brown Date: Mon, 26 Jun 2006 23:04:31 -0400 Subject: ACPI: un-export ACPI_WARNING() -- use printk(KERN_WARNING...) Signed-off-by: Len Brown diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index f4a36d3..6c62862 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -214,13 +214,13 @@ int acpi_bus_set_power(acpi_handle handle, int state) } } if (!device->power.states[state].flags.valid) { - ACPI_WARNING((AE_INFO, "Device does not support D%d", state)); + printk(KERN_WARNING PREFIX "Device does not support D%d\n", state); return_VALUE(-ENODEV); } if (device->parent && (state < device->parent->power.state)) { - ACPI_WARNING((AE_INFO, + printk(KERN_WARNING PREFIX "Cannot set device to a higher-powered" - " state than parent")); + " state than parent\n"); return_VALUE(-ENODEV); } @@ -263,9 +263,9 @@ int acpi_bus_set_power(acpi_handle handle, int state) end: if (result) - ACPI_WARNING((AE_INFO, - "Transitioning device [%s] to D%d", - device->pnp.bus_id, state)); + printk(KERN_WARNING PREFIX + "Transitioning device [%s] to D%d\n", + device->pnp.bus_id, state); else ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n", diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index 37dcb1f..f5da971 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c @@ -983,7 +983,7 @@ static ssize_t hotkey_execute_aml_method(struct file *file, } } else { - ACPI_WARNING((AE_INFO, "Not supported")); + printk(KERN_WARNING "Not supported\n"); return_VALUE(-EINVAL); } return_VALUE(count); diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 4cabc51..9010653 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -269,8 +269,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, entry->link.index, triggering, polarity, link); if (irq < 0) { - ACPI_WARNING((AE_INFO, - "Invalid IRQ link routing entry")); + printk(KERN_WARNING PREFIX + "Invalid IRQ link routing entry\n"); return_VALUE(-1); } } else { @@ -379,8 +379,8 @@ acpi_pci_irq_derive(struct pci_dev *dev, } if (irq < 0) { - ACPI_WARNING((AE_INFO, "Unable to derive IRQ for device %s", - pci_name(dev))); + printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n", + pci_name(dev)); return_VALUE(-1); } diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 415b262..6d903bf 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -116,15 +116,15 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) { struct acpi_resource_irq *p = &resource->data.irq; if (!p || !p->interrupt_count) { - ACPI_WARNING((AE_INFO, "Blank IRQ resource")); + printk(KERN_WARNING PREFIX "Blank IRQ resource\n"); return_ACPI_STATUS(AE_OK); } for (i = 0; (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { - ACPI_WARNING((AE_INFO, "Invalid IRQ %d", - p->interrupts[i])); + printk(KERN_WARNING PREFIX "Invalid IRQ %d\n", + p->interrupts[i]); continue; } link->irq.possible[i] = p->interrupts[i]; @@ -140,16 +140,16 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) struct acpi_resource_extended_irq *p = &resource->data.extended_irq; if (!p || !p->interrupt_count) { - ACPI_WARNING((AE_INFO, - "Blank EXT IRQ resource")); + printk(KERN_WARNING PREFIX + "Blank EXT IRQ resource\n"); return_ACPI_STATUS(AE_OK); } for (i = 0; (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { - ACPI_WARNING((AE_INFO, "Invalid IRQ %d", - p->interrupts[i])); + printk(KERN_WARNING PREFIX "Invalid IRQ %d\n", + p->interrupts[i]); continue; } link->irq.possible[i] = p->interrupts[i]; @@ -223,8 +223,8 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) * extended IRQ descriptors must * return at least 1 IRQ */ - ACPI_WARNING((AE_INFO, - "Blank EXT IRQ resource")); + printk(KERN_WARNING PREFIX + "Blank EXT IRQ resource\n"); return_ACPI_STATUS(AE_OK); } *irq = p->interrupts[0]; @@ -381,10 +381,10 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) goto end; } if (!link->device->status.enabled) { - ACPI_WARNING((AE_INFO, - "%s [%s] disabled and referenced, BIOS bug", + printk(KERN_WARNING PREFIX + "%s [%s] disabled and referenced, BIOS bug\n", acpi_device_name(link->device), - acpi_device_bid(link->device))); + acpi_device_bid(link->device)); } /* Query _CRS, set link->irq.active */ @@ -402,10 +402,10 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) * policy: when _CRS doesn't return what we just _SRS * assume _SRS worked and override _CRS value. */ - ACPI_WARNING((AE_INFO, - "%s [%s] BIOS reported IRQ %d, using IRQ %d", + printk(KERN_WARNING PREFIX + "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", acpi_device_name(link->device), - acpi_device_bid(link->device), link->irq.active, irq)); + acpi_device_bid(link->device), link->irq.active, irq); link->irq.active = irq; } @@ -555,8 +555,8 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) */ if (i == link->irq.possible_count) { if (acpi_strict) - ACPI_WARNING((AE_INFO, "_CRS %d not found" - " in _PRS", link->irq.active)); + printk(KERN_WARNING PREFIX "_CRS %d not found" + " in _PRS\n", link->irq.active); link->irq.active = 0; } diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 5712803..43688c8 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -105,7 +105,7 @@ acpi_power_get_context(acpi_handle handle, result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_WARNING((AE_INFO, "Getting context [%p]", handle)); + printk(KERN_WARNING PREFIX "Getting context [%p]\n", handle); return_VALUE(result); } @@ -441,8 +441,8 @@ int acpi_power_transition(struct acpi_device *device, int state) device->power.state = state; end: if (result) - ACPI_WARNING((AE_INFO, "Transitioning device [%s] to D%d", - device->pnp.bus_id, state)); + printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", + device->pnp.bus_id, state); return_VALUE(result); } diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 97856ad..2de40bd 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c @@ -196,7 +196,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) } /* TBD: Support duty_cycle values that span bit 4. */ else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { - ACPI_WARNING((AE_INFO, "duty_cycle spans bit 4")); + printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); return_VALUE(0); } diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 44fffe1..6e9157a 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -384,7 +384,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) tz->trips.passive.flags.valid = 0; if (!tz->trips.passive.flags.valid) - ACPI_WARNING((AE_INFO, "Invalid passive threshold")); + printk(KERN_WARNING PREFIX "Invalid passive threshold\n"); else ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found passive threshold [%lu]\n", @@ -469,7 +469,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) return_VALUE(-EINVAL); if (tz->temperature >= tz->trips.critical.temperature) { - ACPI_WARNING((AE_INFO, "Critical trip point")); + printk(KERN_WARNING PREFIX "Critical trip point\n"); tz->trips.critical.flags.enabled = 1; } else if (tz->trips.critical.flags.enabled) tz->trips.critical.flags.enabled = 0; @@ -500,7 +500,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) return_VALUE(-EINVAL); if (tz->temperature >= tz->trips.hot.temperature) { - ACPI_WARNING((AE_INFO, "Hot trip point")); + printk(KERN_WARNING PREFIX "Hot trip point\n"); tz->trips.hot.flags.enabled = 1; } else if (tz->trips.hot.flags.enabled) tz->trips.hot.flags.enabled = 0; @@ -640,10 +640,10 @@ static void acpi_thermal_active(struct acpi_thermal *tz) handles[j], ACPI_STATE_D0); if (result) { - ACPI_WARNING((AE_INFO, - "Unable to turn cooling device [%p] 'on'", + printk(KERN_WARNING PREFIX + "Unable to turn cooling device [%p] 'on'\n", active->devices. - handles[j])); + handles[j]); continue; } active->flags.enabled = 1; @@ -665,9 +665,9 @@ static void acpi_thermal_active(struct acpi_thermal *tz) result = acpi_bus_set_power(active->devices.handles[j], ACPI_STATE_D3); if (result) { - ACPI_WARNING((AE_INFO, - "Unable to turn cooling device [%p] 'off'", - active->devices.handles[j])); + printk(KERN_WARNING PREFIX + "Unable to turn cooling device [%p] 'off'\n", + active->devices.handles[j]); continue; } active->flags.enabled = 0; diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 58daa37..dcb4975 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -978,7 +978,7 @@ acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } -EXPORT_SYMBOL(acpi_ut_warning); + void ACPI_INTERNAL_VAR_XFACE acpi_ut_info(char *module_name, u32 line_number, char *format, ...) { diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index ce093d4..040ff47 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -62,25 +62,25 @@ acpi_extract_package(union acpi_object *package, if (!package || (package->type != ACPI_TYPE_PACKAGE) || (package->package.count < 1)) { - ACPI_WARNING((AE_INFO, "Invalid package argument")); + printk(KERN_WARNING PREFIX "Invalid package argument\n"); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!format || !format->pointer || (format->length < 1)) { - ACPI_WARNING((AE_INFO, "Invalid format argument")); + printk(KERN_WARNING PREFIX "Invalid format argument\n"); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!buffer) { - ACPI_WARNING((AE_INFO, "Invalid buffer argument")); + printk(KERN_WARNING PREFIX "Invalid buffer argument\n"); return_ACPI_STATUS(AE_BAD_PARAMETER); } format_count = (format->length / sizeof(char)) - 1; if (format_count > package->package.count) { - ACPI_WARNING((AE_INFO, "Format specifies more objects [%d]" - " than exist in package [%d].", - format_count, package->package.count)); + printk(KERN_WARNING PREFIX "Format specifies more objects [%d]" + " than exist in package [%d].\n", + format_count, package->package.count); return_ACPI_STATUS(AE_BAD_DATA); } @@ -112,10 +112,10 @@ acpi_extract_package(union acpi_object *package, tail_offset += sizeof(char *); break; default: - ACPI_WARNING((AE_INFO, "Invalid package element" + printk(KERN_WARNING PREFIX "Invalid package element" " [%d]: got number, expecing" - " [%c]", - i, format_string[i])); + " [%c]\n", + i, format_string[i]); return_ACPI_STATUS(AE_BAD_DATA); break; } @@ -138,10 +138,10 @@ acpi_extract_package(union acpi_object *package, tail_offset += sizeof(u8 *); break; default: - ACPI_WARNING((AE_INFO, "Invalid package element" + printk(KERN_WARNING PREFIX "Invalid package element" " [%d] got string/buffer," - " expecing [%c]", - i, format_string[i])); + " expecing [%c]\n", + i, format_string[i]); return_ACPI_STATUS(AE_BAD_DATA); break; } -- cgit v0.10.2 From 6468463abd7051fcc29f3ee7c931f9bbbb26f5a4 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Mon, 26 Jun 2006 23:41:38 -0400 Subject: ACPI: un-export ACPI_ERROR() -- use printk(KERN_ERR...) Signed-off-by: Len Brown diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index e49d327..c7c8d53 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -187,7 +187,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) /* Get the range from the _CRS */ result = acpi_memory_get_device_resources(mem_device); if (result) { - ACPI_ERROR((AE_INFO, "get_device_resources failed")); + printk(KERN_ERR PREFIX "get_device_resources failed\n"); mem_device->state = MEMORY_INVALID_STATE; return result; } @@ -198,7 +198,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) */ result = add_memory(mem_device->start_addr, mem_device->length); if (result) { - ACPI_ERROR((AE_INFO, "add_memory failed")); + printk(KERN_ERR PREFIX "add_memory failed\n"); mem_device->state = MEMORY_INVALID_STATE; return result; } @@ -286,14 +286,14 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "\nReceived DEVICE CHECK notification for device\n")); if (acpi_memory_get_device(handle, &mem_device)) { - ACPI_ERROR((AE_INFO, "Cannot find driver data")); + printk(KERN_ERR PREFIX "Cannot find driver data\n"); return_VOID; } if (!acpi_memory_check_device(mem_device)) { if (acpi_memory_enable_device(mem_device)) - ACPI_ERROR((AE_INFO, - "Cannot enable memory device")); + printk(KERN_ERR PREFIX + "Cannot enable memory device\n"); } break; case ACPI_NOTIFY_EJECT_REQUEST: @@ -301,12 +301,12 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) "\nReceived EJECT REQUEST notification for device\n")); if (acpi_bus_get_device(handle, &device)) { - ACPI_ERROR((AE_INFO, "Device doesn't exist")); + printk(KERN_ERR PREFIX "Device doesn't exist\n"); break; } mem_device = acpi_driver_data(device); if (!mem_device) { - ACPI_ERROR((AE_INFO, "Driver Data is NULL")); + printk(KERN_ERR PREFIX "Driver Data is NULL\n"); break; } @@ -317,8 +317,8 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) * with generic sysfs driver */ if (acpi_memory_disable_device(mem_device)) - ACPI_ERROR((AE_INFO, - "Disable memory device\n")); + printk(KERN_ERR PREFIX + "Disable memory device\n"); /* * TBD: Invoke acpi_bus_remove to cleanup data structures */ diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index a8717da..63db284 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -345,8 +345,8 @@ static int acpi_button_add(struct acpi_device *device) sprintf(acpi_device_class(device), "%s/%s", ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); } else { - ACPI_ERROR((AE_INFO, "Unsupported hid [%s]", - acpi_device_hid(device))); + printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", + acpi_device_hid(device)); result = -ENODEV; goto end; } diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 53625fc..e2fcef4 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -94,7 +94,7 @@ static int acpi_container_add(struct acpi_device *device) ACPI_FUNCTION_TRACE("acpi_container_add"); if (!device) { - ACPI_ERROR((AE_INFO, "device is NULL")); + printk(KERN_ERR PREFIX "device is NULL\n"); return_VALUE(-EINVAL); } diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 94cc8ab..0bba878 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1107,7 +1107,7 @@ static int acpi_ec_intr_add(struct acpi_device *device) acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); if (ACPI_FAILURE(status)) { - ACPI_ERROR((AE_INFO, "Obtaining GPE bit assignment")); + printk(KERN_ERR PREFIX "Obtaining GPE bit assignment\n"); result = -ENODEV; goto end; } @@ -1201,7 +1201,7 @@ static int acpi_ec_start(struct acpi_device *device) acpi_ec_io_ports, ec); if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) { - ACPI_ERROR((AE_INFO, "Error getting I/O port addresses")); + printk(KERN_ERR PREFIX "Error getting I/O port addresses\n"); return_VALUE(-ENODEV); } diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index c1d4705..65bdcde 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -203,7 +203,7 @@ static int acpi_fan_add(struct acpi_device *device) result = acpi_bus_get_power(fan->handle, &state); if (result) { - ACPI_ERROR((AE_INFO, "Reading power state")); + printk(KERN_ERR PREFIX "Reading power state\n"); goto end; } diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index f5da971..393dbbc 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c @@ -768,7 +768,7 @@ static ssize_t hotkey_write_config(struct file *file, if (copy_from_user(config_record, buffer, count)) { kfree(config_record); - ACPI_ERROR((AE_INFO, "Invalid data")); + printk(KERN_ERR PREFIX "Invalid data\n"); return_VALUE(-EINVAL); } config_record[count] = 0; @@ -789,7 +789,7 @@ static ssize_t hotkey_write_config(struct file *file, kfree(bus_method); kfree(action_handle); kfree(method); - ACPI_ERROR((AE_INFO, "Invalid data format ret=%d", ret)); + printk(KERN_ERR PREFIX "Invalid data format ret=%d\n", ret); return_VALUE(-EINVAL); } @@ -802,7 +802,7 @@ static ssize_t hotkey_write_config(struct file *file, tmp = get_hotkey_by_event(&global_hotkey_list, internal_event_num); if (!tmp) - ACPI_ERROR((AE_INFO, "Invalid key")); + printk(KERN_ERR PREFIX "Invalid key\n"); else memcpy(key, tmp, sizeof(union acpi_hotkey)); goto cont_cmd; @@ -824,7 +824,7 @@ static ssize_t hotkey_write_config(struct file *file, else free_poll_hotkey_buffer(key); kfree(key); - ACPI_ERROR((AE_INFO, "Invalid hotkey")); + printk(KERN_ERR PREFIX "Invalid hotkey\n"); return_VALUE(-EINVAL); } @@ -858,7 +858,7 @@ static ssize_t hotkey_write_config(struct file *file, else free_poll_hotkey_buffer(key); kfree(key); - ACPI_ERROR((AE_INFO, "invalid key")); + printk(KERN_ERR PREFIX "invalid key\n"); return_VALUE(-EINVAL); } @@ -903,7 +903,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, val->integer.value = out_obj.integer.value; val->type = out_obj.type; } else - ACPI_ERROR((AE_INFO, "null val pointer")); + printk(KERN_ERR PREFIX "null val pointer\n"); return_VALUE((status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER)); } @@ -950,14 +950,14 @@ static ssize_t hotkey_execute_aml_method(struct file *file, if (copy_from_user(arg, buffer, count)) { kfree(arg); - ACPI_ERROR((AE_INFO, "Invalid argument 2")); + printk(KERN_ERR PREFIX "Invalid argument 2\n"); return_VALUE(-EINVAL); } if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) { kfree(arg); - ACPI_ERROR((AE_INFO, "Invalid argument 3")); + printk(KERN_ERR PREFIX "Invalid argument 3\n"); return_VALUE(-EINVAL); } kfree(arg); diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 2d90b8d..7d4cc12 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -591,7 +591,7 @@ static void acpi_os_execute_deferred(void *context) dpc = (struct acpi_os_dpc *)context; if (!dpc) { - ACPI_ERROR((AE_INFO, "Invalid (NULL) context")); + printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); return_VOID; } diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 6d3e818e..3e7d019 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c @@ -75,9 +75,9 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_ERROR((AE_INFO, - "Invalid ACPI Bus context for device %s", - acpi_device_bid(device))); + printk(KERN_ERR PREFIX + "Invalid ACPI Bus context for device %s\n", + acpi_device_bid(device)); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -206,10 +206,10 @@ int acpi_pci_bind(struct acpi_device *device) goto end; } if (!data->dev->bus) { - ACPI_ERROR((AE_INFO, - "Device %02x:%02x:%02x.%02x has invalid 'bus' field", + printk(KERN_ERR PREFIX + "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n", data->id.segment, data->id.bus, - data->id.device, data->id.function)); + data->id.device, data->id.function); result = -ENODEV; goto end; } diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 9010653..f24a6100 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -420,7 +420,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) pin--; if (!dev->bus) { - ACPI_ERROR((AE_INFO, "Invalid (NULL) 'bus' field")); + printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n"); return_VALUE(-ENODEV); } diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 6d903bf..d7aa9c1 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -161,7 +161,7 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) break; } default: - ACPI_ERROR((AE_INFO, "Resource is not an IRQ entry\n")); + printk(KERN_ERR PREFIX "Resource is not an IRQ entry\n"); return_ACPI_STATUS(AE_OK); } @@ -232,7 +232,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) } break; default: - ACPI_ERROR((AE_INFO, "Resource %d isn't an IRQ", resource->type)); + printk(KERN_ERR PREFIX "Resource %d isn't an IRQ\n", resource->type); case ACPI_RESOURCE_TYPE_END_TAG: return_ACPI_STATUS(AE_OK); } @@ -264,7 +264,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) /* Query _STA, set link->device->status */ result = acpi_bus_get_status(link->device); if (result) { - ACPI_ERROR((AE_INFO, "Unable to read status")); + printk(KERN_ERR PREFIX "Unable to read status\n"); goto end; } @@ -287,7 +287,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) } if (acpi_strict && !irq) { - ACPI_ERROR((AE_INFO, "_CRS returned 0")); + printk(KERN_ERR PREFIX "_CRS returned 0\n"); result = -ENODEV; } @@ -357,7 +357,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) /* ignore resource_source, it's optional */ break; default: - ACPI_ERROR((AE_INFO, "Invalid Resource_type %d\n", link->irq.resource_type)); + printk(KERN_ERR PREFIX "Invalid Resource_type %d\n", link->irq.resource_type); result = -EINVAL; goto end; @@ -377,7 +377,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) /* Query _STA, set device->status */ result = acpi_bus_get_status(link->device); if (result) { - ACPI_ERROR((AE_INFO, "Unable to read status")); + printk(KERN_ERR PREFIX "Unable to read status\n"); goto end; } if (!link->device->status.enabled) { @@ -496,7 +496,7 @@ int __init acpi_irq_penalty_init(void) link = list_entry(node, struct acpi_pci_link, node); if (!link) { - ACPI_ERROR((AE_INFO, "Invalid link context")); + printk(KERN_ERR PREFIX "Invalid link context\n"); continue; } @@ -583,10 +583,10 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) /* Attempt to enable the link device at this IRQ. */ if (acpi_pci_link_set(link, irq)) { - ACPI_ERROR((AE_INFO, "Unable to set IRQ for %s [%s]. " - "Try pci=noacpi or acpi=off", + printk(KERN_ERR PREFIX "Unable to set IRQ for %s [%s]. " + "Try pci=noacpi or acpi=off\n", acpi_device_name(link->device), - acpi_device_bid(link->device))); + acpi_device_bid(link->device)); return_VALUE(-ENODEV); } else { acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; @@ -619,19 +619,19 @@ acpi_pci_link_allocate_irq(acpi_handle handle, result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_ERROR((AE_INFO, "Invalid link device")); + printk(KERN_ERR PREFIX "Invalid link device\n"); return_VALUE(-1); } link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { - ACPI_ERROR((AE_INFO, "Invalid link context")); + printk(KERN_ERR PREFIX "Invalid link context\n"); return_VALUE(-1); } /* TBD: Support multiple index (IRQ) entries per Link Device */ if (index) { - ACPI_ERROR((AE_INFO, "Invalid index %d", index)); + printk(KERN_ERR PREFIX "Invalid index %d\n", index); return_VALUE(-1); } @@ -643,7 +643,7 @@ acpi_pci_link_allocate_irq(acpi_handle handle, if (!link->irq.active) { mutex_unlock(&acpi_link_lock); - ACPI_ERROR((AE_INFO, "Link active IRQ is 0!")); + printk(KERN_ERR PREFIX "Link active IRQ is 0!\n"); return_VALUE(-1); } link->refcnt++; @@ -675,20 +675,20 @@ int acpi_pci_link_free_irq(acpi_handle handle) result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_ERROR((AE_INFO, "Invalid link device")); + printk(KERN_ERR PREFIX "Invalid link device\n"); return_VALUE(-1); } link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { - ACPI_ERROR((AE_INFO, "Invalid link context")); + printk(KERN_ERR PREFIX "Invalid link context\n"); return_VALUE(-1); } mutex_lock(&acpi_link_lock); if (!link->irq.initialized) { mutex_unlock(&acpi_link_lock); - ACPI_ERROR((AE_INFO, "Link isn't initialized")); + printk(KERN_ERR PREFIX "Link isn't initialized\n"); return_VALUE(-1); } #ifdef FUTURE_USE @@ -813,7 +813,7 @@ static int irqrouter_resume(struct sys_device *dev) list_for_each(node, &acpi_link.entries) { link = list_entry(node, struct acpi_pci_link, node); if (!link) { - ACPI_ERROR((AE_INFO, "Invalid link context")); + printk(KERN_ERR PREFIX "Invalid link context\n"); continue; } acpi_pci_link_resume(link); diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 0f661dd..1930397 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -231,9 +231,9 @@ static int acpi_pci_root_add(struct acpi_device *device) int bus = 0; acpi_status status; - ACPI_ERROR((AE_INFO, + printk(KERN_ERR PREFIX "Wrong _BBN value, reboot" - " and use option 'pci=noacpi'")); + " and use option 'pci=noacpi'\n"); status = try_get_root_bridge_busnr(root->handle, &bus); if (ACPI_FAILURE(status)) @@ -274,9 +274,9 @@ static int acpi_pci_root_add(struct acpi_device *device) */ root->bus = pci_acpi_scan_root(device, root->id.segment, root->id.bus); if (!root->bus) { - ACPI_ERROR((AE_INFO, - "Bus %04x:%02x not present in PCI namespace", - root->id.segment, root->id.bus)); + printk(KERN_ERR PREFIX + "Bus %04x:%02x not present in PCI namespace\n", + root->id.segment, root->id.bus); result = -ENODEV; goto end; } diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 43688c8..efc4bb7 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -291,7 +291,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) for (i = 0; i < dev->wakeup.resources.count; i++) { ret = acpi_power_on(dev->wakeup.resources.handles[i]); if (ret) { - ACPI_ERROR((AE_INFO, "Transition power state")); + printk(KERN_ERR PREFIX "Transition power state\n"); dev->wakeup.flags.valid = 0; return_VALUE(-1); } @@ -300,7 +300,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) /* Execute PSW */ status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_ERROR((AE_INFO, "Evaluate _PSW")); + printk(KERN_ERR PREFIX "Evaluate _PSW\n"); dev->wakeup.flags.valid = 0; ret = -1; } @@ -330,7 +330,7 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) /* Execute PSW */ status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_ERROR((AE_INFO, "Evaluate _PSW")); + printk(KERN_ERR PREFIX "Evaluate _PSW\n"); dev->wakeup.flags.valid = 0; return_VALUE(-1); } @@ -339,7 +339,7 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) for (i = 0; i < dev->wakeup.resources.count; i++) { ret = acpi_power_off_device(dev->wakeup.resources.handles[i]); if (ret) { - ACPI_ERROR((AE_INFO, "Transition power state")); + printk(KERN_ERR PREFIX "Transition power state\n"); dev->wakeup.flags.valid = 0; return_VALUE(-1); } diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 2bbdf8a..80bbf18 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -453,7 +453,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) */ status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_ERROR((AE_INFO, "Evaluating processor object")); + printk(KERN_ERR PREFIX "Evaluating processor object\n"); return_VALUE(-ENODEV); } @@ -483,9 +483,9 @@ static int acpi_processor_get_info(struct acpi_processor *pr) if (cpu_index == -1) { if (ACPI_FAILURE (acpi_processor_hotadd_init(pr->handle, &pr->id))) { - ACPI_ERROR((AE_INFO, - "Getting cpuindex for acpiid 0x%x", - pr->acpi_id)); + printk(KERN_ERR PREFIX + "Getting cpuindex for acpiid 0x%x\n", + pr->acpi_id); return_VALUE(-ENODEV); } } @@ -496,8 +496,8 @@ static int acpi_processor_get_info(struct acpi_processor *pr) if (!object.processor.pblk_address) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n")); else if (object.processor.pblk_length != 6) - ACPI_ERROR((AE_INFO, "Invalid PBLK length [%d]", - object.processor.pblk_length)); + printk(KERN_ERR PREFIX "Invalid PBLK length [%d]\n", + object.processor.pblk_length); else { pr->throttling.address = object.processor.pblk_address; pr->throttling.duty_offset = acpi_fadt.duty_offset; @@ -751,14 +751,14 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) if (acpi_bus_get_device(handle, &device)) { result = acpi_processor_device_add(handle, &device); if (result) - ACPI_ERROR((AE_INFO, - "Unable to add the device")); + printk(KERN_ERR PREFIX + "Unable to add the device\n"); break; } pr = acpi_driver_data(device); if (!pr) { - ACPI_ERROR((AE_INFO, "Driver data is NULL")); + printk(KERN_ERR PREFIX "Driver data is NULL\n"); break; } @@ -771,8 +771,8 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { kobject_uevent(&device->kobj, KOBJ_ONLINE); } else { - ACPI_ERROR((AE_INFO, "Device [%s] failed to start", - acpi_device_bid(device))); + printk(KERN_ERR PREFIX "Device [%s] failed to start\n", + acpi_device_bid(device)); } break; case ACPI_NOTIFY_EJECT_REQUEST: @@ -780,14 +780,14 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) "received ACPI_NOTIFY_EJECT_REQUEST\n")); if (acpi_bus_get_device(handle, &device)) { - ACPI_ERROR((AE_INFO, - "Device don't exist, dropping EJECT")); + printk(KERN_ERR PREFIX + "Device don't exist, dropping EJECT\n"); break; } pr = acpi_driver_data(device); if (!pr) { - ACPI_ERROR((AE_INFO, - "Driver data is NULL, dropping EJECT")); + printk(KERN_ERR PREFIX + "Driver data is NULL, dropping EJECT\n"); return_VOID; } diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 52ada53..786851d 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -674,7 +674,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) /* There must be at least 2 elements */ if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) { - ACPI_ERROR((AE_INFO, "not enough elements in _CST")); + printk(KERN_ERR PREFIX "not enough elements in _CST\n"); status = -EFAULT; goto end; } @@ -683,7 +683,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) /* Validate number of power states. */ if (count < 1 || count != cst->package.count - 1) { - ACPI_ERROR((AE_INFO, "count given by _CST is not valid")); + printk(KERN_ERR PREFIX "count given by _CST is not valid\n"); status = -EFAULT; goto end; } diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index a79b6ef..8bd7500 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -179,7 +179,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) pct = (union acpi_object *)buffer.pointer; if (!pct || (pct->type != ACPI_TYPE_PACKAGE) || (pct->package.count != 2)) { - ACPI_ERROR((AE_INFO, "Invalid _PCT data")); + printk(KERN_ERR PREFIX "Invalid _PCT data\n"); result = -EFAULT; goto end; } @@ -193,7 +193,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) if ((obj.type != ACPI_TYPE_BUFFER) || (obj.buffer.length < sizeof(struct acpi_pct_register)) || (obj.buffer.pointer == NULL)) { - ACPI_ERROR((AE_INFO, "Invalid _PCT data (control_register)")); + printk(KERN_ERR PREFIX "Invalid _PCT data (control_register)\n"); result = -EFAULT; goto end; } @@ -209,7 +209,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) if ((obj.type != ACPI_TYPE_BUFFER) || (obj.buffer.length < sizeof(struct acpi_pct_register)) || (obj.buffer.pointer == NULL)) { - ACPI_ERROR((AE_INFO, "Invalid _PCT data (status_register)")); + printk(KERN_ERR PREFIX "Invalid _PCT data (status_register)\n"); result = -EFAULT; goto end; } @@ -243,7 +243,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) pss = (union acpi_object *)buffer.pointer; if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) { - ACPI_ERROR((AE_INFO, "Invalid _PSS data")); + printk(KERN_ERR PREFIX "Invalid _PSS data\n"); result = -EFAULT; goto end; } @@ -288,8 +288,8 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) (u32) px->control, (u32) px->status)); if (!px->core_frequency) { - ACPI_ERROR((AE_INFO, - "Invalid _PSS data: freq is zero")); + printk(KERN_ERR PREFIX + "Invalid _PSS data: freq is zero\n"); result = -EFAULT; kfree(pr->performance->states); goto end; diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index c2095ab..0f86d02 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -82,7 +82,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) end: if (result) - ACPI_ERROR((AE_INFO, "Unable to set limit")); + printk(KERN_ERR PREFIX "Unable to set limit\n"); return_VALUE(result); } @@ -289,7 +289,7 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) result = acpi_processor_apply_limit(pr); if (result) - ACPI_ERROR((AE_INFO, "Unable to set thermal limit")); + printk(KERN_ERR PREFIX "Unable to set thermal limit\n"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n", pr->limit.thermal.px, pr->limit.thermal.tx)); @@ -371,13 +371,13 @@ static ssize_t acpi_processor_write_limit(struct file * file, limit_string[count] = '\0'; if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { - ACPI_ERROR((AE_INFO, "Invalid data format")); + printk(KERN_ERR PREFIX "Invalid data format\n"); return_VALUE(-EINVAL); } if (pr->flags.throttling) { if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { - ACPI_ERROR((AE_INFO, "Invalid tx")); + printk(KERN_ERR PREFIX "Invalid tx\n"); return_VALUE(-EINVAL); } pr->limit.user.tx = tx; diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 964ee5c..18c8e3e 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -969,7 +969,7 @@ acpi_add_single_object(struct acpi_device **child, device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL); if (!device) { - ACPI_ERROR((AE_INFO, "Memory allocation error")); + printk(KERN_ERR PREFIX "Memory allocation error\n"); return_VALUE(-ENOMEM); } memset(device, 0, sizeof(struct acpi_device)); diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 6e9157a..1b97549 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -698,7 +698,7 @@ static void acpi_thermal_check(void *data) ACPI_FUNCTION_TRACE("acpi_thermal_check"); if (!tz) { - ACPI_ERROR((AE_INFO, "Invalid (NULL) context")); + printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); return_VOID; } diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index dcb4975..3326831 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -950,7 +950,6 @@ acpi_ut_error(char *module_name, u32 line_number, char *format, ...) acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } -EXPORT_SYMBOL(acpi_ut_error); void ACPI_INTERNAL_VAR_XFACE acpi_ut_exception(char *module_name, diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 040ff47..a5da4ef 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -326,7 +326,7 @@ acpi_evaluate_string(acpi_handle handle, *data = kmalloc(element->string.length + 1, GFP_KERNEL); if (!data) { - ACPI_ERROR((AE_INFO, "Memory allocation")); + printk(KERN_ERR PREFIX "Memory allocation\n"); return_VALUE(-ENOMEM); } memset(*data, 0, element->string.length + 1); @@ -368,22 +368,22 @@ acpi_evaluate_reference(acpi_handle handle, package = (union acpi_object *)buffer.pointer; if ((buffer.length == 0) || !package) { - ACPI_ERROR((AE_INFO, "No return object (len %X ptr %p)", - (unsigned)buffer.length, package)); + printk(KERN_ERR PREFIX "No return object (len %X ptr %p)\n", + (unsigned)buffer.length, package); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->type != ACPI_TYPE_PACKAGE) { - ACPI_ERROR((AE_INFO, "Expecting a [Package], found type %X", - package->type)); + printk(KERN_ERR PREFIX "Expecting a [Package], found type %X\n", + package->type); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (!package->package.count) { - ACPI_ERROR((AE_INFO, "[Package] has zero elements (%p)", - package)); + printk(KERN_ERR PREFIX "[Package] has zero elements (%p)\n", + package); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; @@ -402,9 +402,9 @@ acpi_evaluate_reference(acpi_handle handle, if (element->type != ACPI_TYPE_ANY) { status = AE_BAD_DATA; - ACPI_ERROR((AE_INFO, - "Expecting a [Reference] package element, found type %X", - element->type)); + printk(KERN_ERR PREFIX + "Expecting a [Reference] package element, found type %X\n", + element->type); acpi_util_eval_error(handle, pathname, status); break; } diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 7854a4a..ca37da5 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -324,7 +324,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, return_VALUE(status); obj = (union acpi_object *)buffer.pointer; if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { - ACPI_ERROR((AE_INFO, "Invalid _BCL data")); + printk(KERN_ERR PREFIX "Invalid _BCL data\n"); status = -EFAULT; goto err; } @@ -399,7 +399,7 @@ acpi_video_device_EDID(struct acpi_video_device *device, if (obj && obj->type == ACPI_TYPE_BUFFER) *edid = obj; else { - ACPI_ERROR((AE_INFO, "Invalid _DDC data")); + printk(KERN_ERR PREFIX "Invalid _DDC data\n"); status = -EFAULT; kfree(obj); } @@ -560,7 +560,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) o = (union acpi_object *)&obj->package. elements[i]; if (o->type != ACPI_TYPE_INTEGER) { - ACPI_ERROR((AE_INFO, "Invalid data")); + printk(KERN_ERR PREFIX "Invalid data\n"); continue; } br->levels[count] = (u32) o->integer.value; @@ -1466,7 +1466,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) obj = (union acpi_object *)&dod->package.elements[i]; if (obj->type != ACPI_TYPE_INTEGER) { - ACPI_ERROR((AE_INFO, "Invalid _DOD data")); + printk(KERN_ERR PREFIX "Invalid _DOD data\n"); active_device_list[i].value.int_val = ACPI_VIDEO_HEAD_INVALID; } -- cgit v0.10.2 From d550d98d3317378d93a4869db204725d270ec812 Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Tue, 27 Jun 2006 00:41:40 -0400 Subject: ACPI: delete tracing macros from drivers/acpi/*.c Signed-off-by: Len Brown diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 95223d8..36ca365 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c @@ -84,19 +84,18 @@ static int acpi_ac_get_state(struct acpi_ac *ac) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_ac_get_state"); if (!ac) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state")); ac->state = ACPI_AC_STATUS_UNKNOWN; - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -109,14 +108,13 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset) { struct acpi_ac *ac = (struct acpi_ac *)seq->private; - ACPI_FUNCTION_TRACE("acpi_ac_seq_show"); if (!ac) - return_VALUE(0); + return 0; if (acpi_ac_get_state(ac)) { seq_puts(seq, "ERROR: Unable to read AC Adapter state\n"); - return_VALUE(0); + return 0; } seq_puts(seq, "state: "); @@ -132,7 +130,7 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset) break; } - return_VALUE(0); + return 0; } static int acpi_ac_open_fs(struct inode *inode, struct file *file) @@ -144,13 +142,12 @@ static int acpi_ac_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_ac_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_ac_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } @@ -158,19 +155,18 @@ static int acpi_ac_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_AC_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_ac_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_ac_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_ac_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device)); @@ -179,7 +175,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -191,13 +187,12 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) struct acpi_ac *ac = (struct acpi_ac *)data; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_ac_notify"); if (!ac) - return_VOID; + return; if (acpi_bus_get_device(ac->handle, &device)) - return_VOID; + return; switch (event) { case ACPI_AC_NOTIFY_STATUS: @@ -210,7 +205,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static int acpi_ac_add(struct acpi_device *device) @@ -219,14 +214,13 @@ static int acpi_ac_add(struct acpi_device *device) acpi_status status = AE_OK; struct acpi_ac *ac = NULL; - ACPI_FUNCTION_TRACE("acpi_ac_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL); if (!ac) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(ac, 0, sizeof(struct acpi_ac)); ac->handle = device->handle; @@ -260,7 +254,7 @@ static int acpi_ac_add(struct acpi_device *device) kfree(ac); } - return_VALUE(result); + return result; } static int acpi_ac_remove(struct acpi_device *device, int type) @@ -268,10 +262,9 @@ static int acpi_ac_remove(struct acpi_device *device, int type) acpi_status status = AE_OK; struct acpi_ac *ac = NULL; - ACPI_FUNCTION_TRACE("acpi_ac_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; ac = (struct acpi_ac *)acpi_driver_data(device); @@ -282,38 +275,36 @@ static int acpi_ac_remove(struct acpi_device *device, int type) kfree(ac); - return_VALUE(0); + return 0; } static int __init acpi_ac_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_ac_init"); acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); if (!acpi_ac_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_ac_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_ac_driver); if (result < 0) { remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static void __exit acpi_ac_exit(void) { - ACPI_FUNCTION_TRACE("acpi_ac_exit"); acpi_bus_unregister_driver(&acpi_ac_driver); remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_ac_init); diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index c7c8d53..b054695 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -85,12 +85,11 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) struct acpi_resource *resource = NULL; struct acpi_resource_address64 address64; - ACPI_FUNCTION_TRACE("acpi_memory_get_device_resources"); /* Get the range from the _CRS */ status = acpi_get_current_resources(mem_device->handle, &buffer); if (ACPI_FAILURE(status)) - return_VALUE(-EINVAL); + return -EINVAL; resource = (struct acpi_resource *)buffer.pointer; status = acpi_resource_to_address64(resource, &address64); @@ -106,7 +105,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) } acpi_os_free(buffer.pointer); - return_VALUE(0); + return 0; } static int @@ -118,7 +117,6 @@ acpi_memory_get_device(acpi_handle handle, struct acpi_device *device = NULL; struct acpi_device *pdevice = NULL; - ACPI_FUNCTION_TRACE("acpi_memory_get_device"); if (!acpi_bus_get_device(handle, &device) && device) goto end; @@ -126,14 +124,14 @@ acpi_memory_get_device(acpi_handle handle, status = acpi_get_parent(handle, &phandle); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent")); - return_VALUE(-EINVAL); + return -EINVAL; } /* Get the parent device */ status = acpi_bus_get_device(phandle, &pdevice); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device")); - return_VALUE(-EINVAL); + return -EINVAL; } /* @@ -143,29 +141,28 @@ acpi_memory_get_device(acpi_handle handle, status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus")); - return_VALUE(-EINVAL); + return -EINVAL; } end: *mem_device = acpi_driver_data(device); if (!(*mem_device)) { printk(KERN_ERR "\n driver data not found"); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static int acpi_memory_check_device(struct acpi_memory_device *mem_device) { unsigned long current_status; - ACPI_FUNCTION_TRACE("acpi_memory_check_device"); /* Get device present/absent information from the _STA */ if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA", NULL, ¤t_status))) - return_VALUE(-ENODEV); + return -ENODEV; /* * Check for device status. Device should be * present/enabled/functioning. @@ -173,16 +170,15 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device) if (!((current_status & ACPI_MEMORY_STA_PRESENT) && (current_status & ACPI_MEMORY_STA_ENABLED) && (current_status & ACPI_MEMORY_STA_FUNCTIONAL))) - return_VALUE(-ENODEV); + return -ENODEV; - return_VALUE(0); + return 0; } static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) { int result; - ACPI_FUNCTION_TRACE("acpi_memory_enable_device"); /* Get the range from the _CRS */ result = acpi_memory_get_device_resources(mem_device); @@ -213,7 +209,6 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) union acpi_object arg; unsigned long current_status; - ACPI_FUNCTION_TRACE("acpi_memory_powerdown_device"); /* Issue the _EJ0 command */ arg_list.count = 1; @@ -225,20 +220,20 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) /* Return on _EJ0 failure */ if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed")); - return_VALUE(-ENODEV); + return -ENODEV; } /* Evalute _STA to check if the device is disabled */ status = acpi_evaluate_integer(mem_device->handle, "_STA", NULL, ¤t_status); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; /* Check for device status. Device should be disabled */ if (current_status & ACPI_MEMORY_STA_ENABLED) - return_VALUE(-EINVAL); + return -EINVAL; - return_VALUE(0); + return 0; } static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) @@ -247,7 +242,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) u64 start = mem_device->start_addr; u64 len = mem_device->length; - ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); /* * Ask the VM to offline this memory range. @@ -255,7 +249,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) */ result = remove_memory(start, len); if (result) - return_VALUE(result); + return result; /* Power-off and eject the device */ result = acpi_memory_powerdown_device(mem_device); @@ -274,7 +268,6 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) struct acpi_memory_device *mem_device; struct acpi_device *device; - ACPI_FUNCTION_TRACE("acpi_memory_device_notify"); switch (event) { case ACPI_NOTIFY_BUS_CHECK: @@ -287,7 +280,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) "\nReceived DEVICE CHECK notification for device\n")); if (acpi_memory_get_device(handle, &mem_device)) { printk(KERN_ERR PREFIX "Cannot find driver data\n"); - return_VOID; + return; } if (!acpi_memory_check_device(mem_device)) { @@ -329,7 +322,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static int acpi_memory_device_add(struct acpi_device *device) @@ -337,14 +330,13 @@ static int acpi_memory_device_add(struct acpi_device *device) int result; struct acpi_memory_device *mem_device = NULL; - ACPI_FUNCTION_TRACE("acpi_memory_device_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL); if (!mem_device) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(mem_device, 0, sizeof(struct acpi_memory_device)); mem_device->handle = device->handle; @@ -356,7 +348,7 @@ static int acpi_memory_device_add(struct acpi_device *device) result = acpi_memory_get_device_resources(mem_device); if (result) { kfree(mem_device); - return_VALUE(result); + return result; } /* Set the device state */ @@ -364,22 +356,21 @@ static int acpi_memory_device_add(struct acpi_device *device) printk(KERN_INFO "%s \n", acpi_device_name(device)); - return_VALUE(result); + return result; } static int acpi_memory_device_remove(struct acpi_device *device, int type) { struct acpi_memory_device *mem_device = NULL; - ACPI_FUNCTION_TRACE("acpi_memory_device_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; mem_device = (struct acpi_memory_device *)acpi_driver_data(device); kfree(mem_device); - return_VALUE(0); + return 0; } /* @@ -392,16 +383,15 @@ static acpi_status is_memory_device(acpi_handle handle) struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_device_info *info; - ACPI_FUNCTION_TRACE("is_memory_device"); status = acpi_get_object_info(handle, &buffer); if (ACPI_FAILURE(status)) - return_ACPI_STATUS(status); + return status; info = buffer.pointer; if (!(info->valid & ACPI_VALID_HID)) { acpi_os_free(buffer.pointer); - return_ACPI_STATUS(AE_ERROR); + return AE_ERROR; } hardware_id = info->hardware_id.value; @@ -410,7 +400,7 @@ static acpi_status is_memory_device(acpi_handle handle) status = AE_ERROR; acpi_os_free(buffer.pointer); - return_ACPI_STATUS(status); + return status; } static acpi_status @@ -419,18 +409,17 @@ acpi_memory_register_notify_handler(acpi_handle handle, { acpi_status status; - ACPI_FUNCTION_TRACE("acpi_memory_register_notify_handler"); status = is_memory_device(handle); if (ACPI_FAILURE(status)){ ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); - return_ACPI_STATUS(AE_OK); /* continue */ + return AE_OK; /* continue */ } status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify, NULL); /* continue */ - return_ACPI_STATUS(AE_OK); + return AE_OK; } static acpi_status @@ -439,19 +428,18 @@ acpi_memory_deregister_notify_handler(acpi_handle handle, { acpi_status status; - ACPI_FUNCTION_TRACE("acpi_memory_deregister_notify_handler"); status = is_memory_device(handle); if (ACPI_FAILURE(status)){ ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); - return_ACPI_STATUS(AE_OK); /* continue */ + return AE_OK; /* continue */ } status = acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify); - return_ACPI_STATUS(AE_OK); /* continue */ + return AE_OK; /* continue */ } static int __init acpi_memory_device_init(void) @@ -459,12 +447,11 @@ static int __init acpi_memory_device_init(void) int result; acpi_status status; - ACPI_FUNCTION_TRACE("acpi_memory_device_init"); result = acpi_bus_register_driver(&acpi_memory_device_driver); if (result < 0) - return_VALUE(-ENODEV); + return -ENODEV; status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, @@ -474,17 +461,16 @@ static int __init acpi_memory_device_init(void) if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); acpi_bus_unregister_driver(&acpi_memory_device_driver); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static void __exit acpi_memory_device_exit(void) { acpi_status status; - ACPI_FUNCTION_TRACE("acpi_memory_device_exit"); /* * Adding this to un-install notification handlers for all the device @@ -500,7 +486,7 @@ static void __exit acpi_memory_device_exit(void) acpi_bus_unregister_driver(&acpi_memory_device_driver); - return_VOID; + return; } module_init(acpi_memory_device_init); diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 3b92c94..00b0728 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -132,17 +132,16 @@ acpi_battery_get_info(struct acpi_battery *battery, struct acpi_buffer data = { 0, NULL }; union acpi_object *package = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_get_info"); if (!battery || !bif) - return_VALUE(-EINVAL); + return -EINVAL; /* Evalute _BIF */ status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); - return_VALUE(-ENODEV); + return -ENODEV; } package = (union acpi_object *)buffer.pointer; @@ -177,7 +176,7 @@ acpi_battery_get_info(struct acpi_battery *battery, if (!result) (*bif) = (struct acpi_battery_info *)data.pointer; - return_VALUE(result); + return result; } static int @@ -193,17 +192,16 @@ acpi_battery_get_status(struct acpi_battery *battery, struct acpi_buffer data = { 0, NULL }; union acpi_object *package = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_get_status"); if (!battery || !bst) - return_VALUE(-EINVAL); + return -EINVAL; /* Evalute _BST */ status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); - return_VALUE(-ENODEV); + return -ENODEV; } package = (union acpi_object *)buffer.pointer; @@ -238,7 +236,7 @@ acpi_battery_get_status(struct acpi_battery *battery, if (!result) (*bst) = (struct acpi_battery_status *)data.pointer; - return_VALUE(result); + return result; } static int @@ -248,25 +246,24 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm) union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list arg_list = { 1, &arg0 }; - ACPI_FUNCTION_TRACE("acpi_battery_set_alarm"); if (!battery) - return_VALUE(-EINVAL); + return -EINVAL; if (!battery->flags.alarm) - return_VALUE(-ENODEV); + return -ENODEV; arg0.integer.value = alarm; status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", (u32) alarm)); battery->alarm = alarm; - return_VALUE(0); + return 0; } static int acpi_battery_check(struct acpi_battery *battery) @@ -277,18 +274,17 @@ static int acpi_battery_check(struct acpi_battery *battery) struct acpi_device *device = NULL; struct acpi_battery_info *bif = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_check"); if (!battery) - return_VALUE(-EINVAL); + return -EINVAL; result = acpi_bus_get_device(battery->handle, &device); if (result) - return_VALUE(result); + return result; result = acpi_bus_get_status(device); if (result) - return_VALUE(result); + return result; /* Insertion? */ @@ -300,7 +296,7 @@ static int acpi_battery_check(struct acpi_battery *battery) result = acpi_battery_get_info(battery, &bif); if (result) - return_VALUE(result); + return result; battery->flags.power_unit = bif->power_unit; battery->trips.warning = bif->design_capacity_warning; @@ -324,7 +320,7 @@ static int acpi_battery_check(struct acpi_battery *battery) battery->flags.present = device->status.battery_present; - return_VALUE(result); + return result; } /* -------------------------------------------------------------------------- @@ -339,7 +335,6 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) struct acpi_battery_info *bif = NULL; char *units = "?"; - ACPI_FUNCTION_TRACE("acpi_battery_read_info"); if (!battery) goto end; @@ -409,7 +404,7 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) end: kfree(bif); - return_VALUE(0); + return 0; } 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) struct acpi_battery_status *bst = NULL; char *units = "?"; - ACPI_FUNCTION_TRACE("acpi_battery_read_state"); if (!battery) goto end; @@ -487,7 +481,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) end: kfree(bst); - return_VALUE(0); + return 0; } 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) struct acpi_battery *battery = (struct acpi_battery *)seq->private; char *units = "?"; - ACPI_FUNCTION_TRACE("acpi_battery_read_alarm"); if (!battery) goto end; @@ -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); end: - return_VALUE(0); + return 0; } static ssize_t @@ -538,25 +531,24 @@ acpi_battery_write_alarm(struct file *file, struct seq_file *m = (struct seq_file *)file->private_data; struct acpi_battery *battery = (struct acpi_battery *)m->private; - ACPI_FUNCTION_TRACE("acpi_battery_write_alarm"); if (!battery || (count > sizeof(alarm_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; if (!battery->flags.present) - return_VALUE(-ENODEV); + return -ENODEV; if (copy_from_user(alarm_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; alarm_string[count] = '\0'; result = acpi_battery_set_alarm(battery, simple_strtoul(alarm_string, NULL, 0)); 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) @@ -593,13 +585,12 @@ static int acpi_battery_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_battery_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } @@ -607,7 +598,7 @@ static int acpi_battery_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_battery_info_ops; entry->data = acpi_driver_data(device); @@ -618,7 +609,7 @@ static int acpi_battery_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_battery_state_ops; entry->data = acpi_driver_data(device); @@ -630,19 +621,18 @@ static int acpi_battery_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_battery_alarm_ops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_battery_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_battery_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_BATTERY_FILE_ALARM, @@ -656,7 +646,7 @@ static int acpi_battery_remove_fs(struct acpi_device *device) 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) struct acpi_battery *battery = (struct acpi_battery *)data; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_notify"); if (!battery) - return_VOID; + return; if (acpi_bus_get_device(handle, &device)) - return_VOID; + return; switch (event) { case ACPI_BATTERY_NOTIFY_STATUS: @@ -688,7 +677,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } 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; struct acpi_battery *battery = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; battery = kmalloc(sizeof(struct acpi_battery), GFP_KERNEL); if (!battery) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(battery, 0, sizeof(struct acpi_battery)); battery->handle = device->handle; @@ -738,7 +726,7 @@ static int acpi_battery_add(struct acpi_device *device) kfree(battery); } - return_VALUE(result); + return result; } 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; struct acpi_battery *battery = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; battery = (struct acpi_battery *)acpi_driver_data(device); @@ -761,38 +748,36 @@ static int acpi_battery_remove(struct acpi_device *device, int type) kfree(battery); - return_VALUE(0); + return 0; } static int __init acpi_battery_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_battery_init"); acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); if (!acpi_battery_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_battery_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_battery_driver); if (result < 0) { 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) { - ACPI_FUNCTION_TRACE("acpi_battery_exit"); acpi_bus_unregister_driver(&acpi_battery_driver); remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_battery_init); diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 6c62862..dec044c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -60,20 +60,19 @@ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_bus_get_device"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; /* TBD: Support fixed-feature devices */ status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device); if (ACPI_FAILURE(status) || !*device) { 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); @@ -83,10 +82,9 @@ int acpi_bus_get_status(struct acpi_device *device) acpi_status status = AE_OK; unsigned long sta = 0; - ACPI_FUNCTION_TRACE("acpi_bus_get_status"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; /* * Evaluate _STA if present. @@ -95,7 +93,7 @@ int acpi_bus_get_status(struct acpi_device *device) status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; STRUCT_TO_INT(device->status) = (int)sta; } @@ -119,7 +117,7 @@ int acpi_bus_get_status(struct acpi_device *device) device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status))); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_get_status); @@ -135,11 +133,10 @@ int acpi_bus_get_power(acpi_handle handle, int *state) struct acpi_device *device = NULL; unsigned long psc = 0; - ACPI_FUNCTION_TRACE("acpi_bus_get_power"); result = acpi_bus_get_device(handle, &device); if (result) - return_VALUE(result); + return result; *state = ACPI_STATE_UNKNOWN; @@ -158,12 +155,12 @@ int acpi_bus_get_power(acpi_handle handle, int *state) status = acpi_evaluate_integer(device->handle, "_PSC", NULL, &psc); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; device->power.state = (int)psc; } else if (device->power.flags.power_resources) { result = acpi_power_get_inferred_state(device); if (result) - return_VALUE(result); + return result; } *state = device->power.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", device->pnp.bus_id, device->power.state)); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_get_power); @@ -184,21 +181,20 @@ int acpi_bus_set_power(acpi_handle handle, int state) struct acpi_device *device = NULL; char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' }; - ACPI_FUNCTION_TRACE("acpi_bus_set_power"); result = acpi_bus_get_device(handle, &device); if (result) - return_VALUE(result); + return result; if ((state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) - return_VALUE(-EINVAL); + return -EINVAL; /* Make sure this is a valid target state */ if (!device->flags.power_manageable) { printk(KERN_DEBUG "Device `[%s]is not power manageable", device->kobj.name); - return_VALUE(-ENODEV); + return -ENODEV; } /* * Get device's current power state if it's unknown @@ -210,18 +206,18 @@ int acpi_bus_set_power(acpi_handle handle, int state) if (state == device->power.state) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state)); - return_VALUE(0); + return 0; } } if (!device->power.states[state].flags.valid) { 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)) { printk(KERN_WARNING PREFIX "Cannot set device to a higher-powered" " state than parent\n"); - return_VALUE(-ENODEV); + return -ENODEV; } /* @@ -271,7 +267,7 @@ int acpi_bus_set_power(acpi_handle handle, int state) "Device [%s] transitioned to D%d\n", device->pnp.bus_id, state)); - return_VALUE(result); + return result; } EXPORT_SYMBOL(acpi_bus_set_power); @@ -292,18 +288,17 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) struct acpi_bus_event *event = NULL; unsigned long flags = 0; - ACPI_FUNCTION_TRACE("acpi_bus_generate_event"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; /* drop event on the floor if no one's listening */ if (!event_is_open) - return_VALUE(0); + return 0; event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC); if (!event) - return_VALUE(-ENOMEM); + return -ENOMEM; strcpy(event->device_class, device->pnp.device_class); 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) wake_up_interruptible(&acpi_bus_event_queue); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_generate_event); @@ -328,10 +323,9 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) DECLARE_WAITQUEUE(wait, current); - ACPI_FUNCTION_TRACE("acpi_bus_receive_event"); if (!event) - return_VALUE(-EINVAL); + return -EINVAL; if (list_empty(&acpi_bus_event_list)) { @@ -345,7 +339,7 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) set_current_state(TASK_RUNNING); if (signal_pending(current)) - return_VALUE(-ERESTARTSYS); + return -ERESTARTSYS; } spin_lock_irqsave(&acpi_bus_event_lock, flags); @@ -356,13 +350,13 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) spin_unlock_irqrestore(&acpi_bus_event_lock, flags); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; memcpy(event, entry, sizeof(struct acpi_bus_event)); kfree(entry); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_receive_event); @@ -377,10 +371,9 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) acpi_status status = 0; struct acpi_device_status old_status; - ACPI_FUNCTION_TRACE("acpi_bus_check_device"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; if (status_changed) *status_changed = 0; @@ -397,15 +390,15 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) if (status_changed) *status_changed = 1; } - return_VALUE(0); + return 0; } status = acpi_bus_get_status(device); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status)) - return_VALUE(0); + return 0; if (status_changed) *status_changed = 1; @@ -421,7 +414,7 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) /* TBD: Handle device removal */ } - return_VALUE(0); + return 0; } 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 status_changed = 0; - ACPI_FUNCTION_TRACE("acpi_bus_check_scope"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; /* Status Change? */ result = acpi_bus_check_device(device, &status_changed); if (result) - return_VALUE(result); + return result; if (!status_changed) - return_VALUE(0); + return 0; /* * TBD: Enumerate child devices within this device's scope and * 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) int result = 0; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_bus_notify"); if (acpi_bus_get_device(handle, &device)) - return_VOID; + return; switch (type) { @@ -538,7 +529,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) break; } - return_VOID; + return; } /* -------------------------------------------------------------------------- @@ -552,7 +543,6 @@ static int __init acpi_bus_init_irq(void) struct acpi_object_list arg_list = { 1, &arg }; char *message = NULL; - ACPI_FUNCTION_TRACE("acpi_bus_init_irq"); /* * Let the system know what interrupt model we are using by @@ -571,7 +561,7 @@ static int __init acpi_bus_init_irq(void) break; default: 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); @@ -581,10 +571,10 @@ static int __init acpi_bus_init_irq(void) status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC")); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } void __init acpi_early_init(void) @@ -592,10 +582,9 @@ void __init acpi_early_init(void) acpi_status status = AE_OK; struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt }; - ACPI_FUNCTION_TRACE("acpi_early_init"); if (acpi_disabled) - return_VOID; + return; printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); @@ -655,11 +644,11 @@ void __init acpi_early_init(void) goto error0; } - return_VOID; + return; error0: disable_acpi(); - return_VOID; + return; } static int __init acpi_bus_init(void) @@ -668,7 +657,6 @@ static int __init acpi_bus_init(void) acpi_status status = AE_OK; extern acpi_status acpi_os_initialize1(void); - ACPI_FUNCTION_TRACE("acpi_bus_init"); status = acpi_os_initialize1(); @@ -730,12 +718,12 @@ static int __init acpi_bus_init(void) */ acpi_root_dir = proc_mkdir(ACPI_BUS_FILE_ROOT, NULL); - return_VALUE(0); + return 0; /* Mimic structured exception handling */ error1: acpi_terminate(); - return_VALUE(-ENODEV); + return -ENODEV; } decl_subsys(acpi, NULL, NULL); @@ -744,11 +732,10 @@ static int __init acpi_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_init"); if (acpi_disabled) { printk(KERN_INFO PREFIX "Interpreter disabled.\n"); - return_VALUE(-ENODEV); + return -ENODEV; } firmware_register(&acpi_subsys); @@ -769,7 +756,7 @@ static int __init acpi_init(void) } else disable_acpi(); - return_VALUE(result); + return result; } subsys_initcall(acpi_init); diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 63db284..0259463 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -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; - ACPI_FUNCTION_TRACE("acpi_button_info_seq_show"); if (!button || !button->device) - return_VALUE(0); + return 0; seq_printf(seq, "type: %s\n", acpi_device_name(button->device)); - return_VALUE(0); + return 0; } 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) acpi_status status; unsigned long state; - ACPI_FUNCTION_TRACE("acpi_button_state_seq_show"); if (!button || !button->device) - return_VALUE(0); + return 0; status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state); if (ACPI_FAILURE(status)) { @@ -147,7 +145,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) (state ? "open" : "closed")); } - return_VALUE(0); + return 0; } 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) struct proc_dir_entry *entry = NULL; struct acpi_button *button = NULL; - ACPI_FUNCTION_TRACE("acpi_button_add_fs"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; button = acpi_driver_data(device); @@ -195,19 +192,19 @@ static int acpi_button_add_fs(struct acpi_device *device) } if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; entry->owner = THIS_MODULE; acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; /* 'info' [R] */ entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_button_info_fops; entry->data = acpi_driver_data(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) { struct acpi_button *button = NULL; - ACPI_FUNCTION_TRACE("acpi_button_remove_fs"); button = acpi_driver_data(device); if (acpi_device_dir(device)) { @@ -249,7 +245,7 @@ static int acpi_button_remove_fs(struct acpi_device *device) 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) { struct acpi_button *button = (struct acpi_button *)data; - ACPI_FUNCTION_TRACE("acpi_button_notify"); if (!button || !button->device) - return_VOID; + return; switch (event) { case ACPI_BUTTON_NOTIFY_STATUS: @@ -276,21 +271,20 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static acpi_status acpi_button_notify_fixed(void *data) { struct acpi_button *button = (struct acpi_button *)data; - ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); if (!button) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; 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) @@ -299,14 +293,13 @@ static int acpi_button_add(struct acpi_device *device) acpi_status status = AE_OK; struct acpi_button *button = NULL; - ACPI_FUNCTION_TRACE("acpi_button_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL); if (!button) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(button, 0, sizeof(struct acpi_button)); button->device = device; @@ -400,7 +393,7 @@ static int acpi_button_add(struct acpi_device *device) kfree(button); } - return_VALUE(result); + return result; } 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; struct acpi_button *button = NULL; - ACPI_FUNCTION_TRACE("acpi_button_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; button = acpi_driver_data(device); @@ -438,31 +430,29 @@ static int acpi_button_remove(struct acpi_device *device, int type) kfree(button); - return_VALUE(0); + return 0; } static int __init acpi_button_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_button_init"); acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); if (!acpi_button_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_button_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_button_driver); if (result < 0) { 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) { - ACPI_FUNCTION_TRACE("acpi_button_exit"); acpi_bus_unregister_driver(&acpi_button_driver); @@ -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_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_button_init); diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index e2fcef4..7f7e41d 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -73,17 +73,16 @@ static int is_device_present(acpi_handle handle) acpi_status status; unsigned long sta; - ACPI_FUNCTION_TRACE("is_device_present"); status = acpi_get_handle(handle, "_STA", &temp); 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); 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) { struct acpi_container *container; - ACPI_FUNCTION_TRACE("acpi_container_add"); if (!device) { printk(KERN_ERR PREFIX "device is NULL\n"); - return_VALUE(-EINVAL); + return -EINVAL; } container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL); if (!container) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(container, 0, sizeof(struct acpi_container)); container->handle = device->handle; @@ -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_device_name(device), acpi_device_bid(device))); - return_VALUE(0); + return 0; } 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) struct acpi_device *pdev; int result; - ACPI_FUNCTION_TRACE("container_device_add"); if (acpi_get_parent(handle, &phandle)) { - return_VALUE(-ENODEV); + return -ENODEV; } if (acpi_bus_get_device(phandle, &pdev)) { - return_VALUE(-ENODEV); + return -ENODEV; } if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) { - return_VALUE(-ENODEV); + return -ENODEV; } result = acpi_bus_start(*device); - return_VALUE(result); + return result; } 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; acpi_status status; - ACPI_FUNCTION_TRACE("container_notify_cb"); present = is_device_present(handle); @@ -192,7 +188,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) default: break; } - return_VOID; + return; } static acpi_status @@ -205,11 +201,10 @@ container_walk_namespace_cb(acpi_handle handle, acpi_status status; int *action = context; - ACPI_FUNCTION_TRACE("container_walk_namespace_cb"); status = acpi_get_object_info(handle, &buffer); if (ACPI_FAILURE(status) || !buffer.pointer) { - return_ACPI_STATUS(AE_OK); + return AE_OK; } info = buffer.pointer; @@ -243,7 +238,7 @@ container_walk_namespace_cb(acpi_handle handle, end: acpi_os_free(buffer.pointer); - return_ACPI_STATUS(AE_OK); + return AE_OK; } static int __init acpi_container_init(void) @@ -269,7 +264,6 @@ static void __exit acpi_container_exit(void) { int action = UNINSTALL_NOTIFY_HANDLER; - ACPI_FUNCTION_TRACE("acpi_container_exit"); acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, @@ -278,7 +272,7 @@ static void __exit acpi_container_exit(void) acpi_bus_unregister_driver(&acpi_container_driver); - return_VOID; + return; } module_init(acpi_container_init); diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index ec7bcee..35c6af8 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c @@ -155,13 +155,12 @@ acpi_system_write_debug(struct file *file, { char debug_string[12] = { '\0' }; - ACPI_FUNCTION_TRACE("acpi_system_write_debug"); if (count > sizeof(debug_string) - 1) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(debug_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; debug_string[count] = '\0'; @@ -173,10 +172,10 @@ acpi_system_write_debug(struct file *file, acpi_dbg_level = simple_strtoul(debug_string, NULL, 0); break; default: - return_VALUE(-EINVAL); + return -EINVAL; } - return_VALUE(count); + return count; } static int __init acpi_debug_init(void) @@ -185,10 +184,9 @@ static int __init acpi_debug_init(void) int error = 0; char *name; - ACPI_FUNCTION_TRACE("acpi_debug_init"); if (acpi_disabled) - return_VALUE(0); + return 0; /* 'debug_layer' [R/W] */ name = ACPI_SYSTEM_FILE_DEBUG_LAYER; @@ -213,7 +211,7 @@ static int __init acpi_debug_init(void) goto Error; Done: - return_VALUE(error); + return error; Error: remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir); diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 0bba878..874f912 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -207,7 +207,6 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_ec_wait"); ec->intr.expect_event = event; smp_mb(); @@ -216,7 +215,7 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) case ACPI_EC_EVENT_IBE: if (~acpi_ec_read_status(ec) & event) { ec->intr.expect_event = 0; - return_VALUE(0); + return 0; } break; default: @@ -238,16 +237,16 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) switch (event) { case ACPI_EC_EVENT_OBF: if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) - return_VALUE(0); + return 0; break; case ACPI_EC_EVENT_IBE: if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) - return_VALUE(0); + return 0; break; } - return_VALUE(-ETIME); + return -ETIME; } #ifdef ACPI_FUTURE_USAGE @@ -260,7 +259,6 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) u32 tmp = 0; int status = 0; - ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode"); status = acpi_ec_read_status(ec); if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { @@ -272,22 +270,21 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); if (tmp != 0x90) { /* Burst ACK byte */ - return_VALUE(-EINVAL); + return -EINVAL; } } atomic_set(&ec->intr.leaving_burst, 0); - return_VALUE(0); + return 0; end: 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 status = 0; - ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); status = acpi_ec_read_status(ec); if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ @@ -298,10 +295,10 @@ int acpi_ec_leave_burst_mode(union acpi_ec *ec) acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); } atomic_set(&ec->intr.leaving_burst, 1); - return_VALUE(0); + return 0; end: ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode"); - return_VALUE(-1); + return -1; } #endif /* ACPI_FUTURE_USAGE */ @@ -325,17 +322,16 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) int result = 0; u32 glk = 0; - ACPI_FUNCTION_TRACE("acpi_ec_read"); if (!ec || !data) - return_VALUE(-EINVAL); + return -EINVAL; *data = 0; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } if (down_interruptible(&ec->poll.sem)) { @@ -365,7 +361,7 @@ end_nosem: if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(result); + return result; } 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; u32 glk = 0; - ACPI_FUNCTION_TRACE("acpi_ec_write"); if (!ec) - return_VALUE(-EINVAL); + return -EINVAL; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } if (down_interruptible(&ec->poll.sem)) { @@ -415,7 +410,7 @@ end_nosem: if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(result); + return result; } 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; u32 glk; - ACPI_FUNCTION_TRACE("acpi_ec_read"); if (!ec || !data) - return_VALUE(-EINVAL); + return -EINVAL; *data = 0; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } WARN_ON(in_interrupt()); @@ -467,7 +461,7 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(status); + return status; } 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; u32 glk; - ACPI_FUNCTION_TRACE("acpi_ec_write"); if (!ec) - return_VALUE(-EINVAL); + return -EINVAL; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } WARN_ON(in_interrupt()); @@ -516,7 +509,7 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) if (ec->common.global_lock) 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) acpi_status status = AE_OK; u32 glk = 0; - ACPI_FUNCTION_TRACE("acpi_ec_query"); if (!ec || !data) - return_VALUE(-EINVAL); + return -EINVAL; *data = 0; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } /* @@ -613,23 +605,22 @@ end_nosem: if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(result); + return result; } static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) { int status = 0; u32 glk; - ACPI_FUNCTION_TRACE("acpi_ec_query"); if (!ec || !data) - return_VALUE(-EINVAL); + return -EINVAL; *data = 0; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } down(&ec->intr.sem); @@ -662,7 +653,7 @@ static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(status); + return status; } /* -------------------------------------------------------------------------- @@ -691,13 +682,12 @@ static void acpi_ec_gpe_poll_query(void *ec_cxt) '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); if (!ec_cxt) goto end; if (down_interruptible (&ec->poll.sem)) { - return_VOID; + return; } acpi_hw_low_level_read(8, &value, &ec->common.command_addr); up(&ec->poll.sem); @@ -734,7 +724,6 @@ static void acpi_ec_gpe_intr_query(void *ec_cxt) '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) result = acpi_ec_query(ec, &value); @@ -846,15 +835,14 @@ acpi_ec_space_handler(u32 function, acpi_integer f_v = 0; int i = 0; - ACPI_FUNCTION_TRACE("acpi_ec_space_handler"); if ((address > 0xFF) || !value || !handler_context) - return_VALUE(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; if (bit_width != 8 && acpi_strict) { printk(KERN_WARNING PREFIX "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; @@ -893,16 +881,16 @@ acpi_ec_space_handler(u32 function, out: switch (result) { case -EINVAL: - return_VALUE(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; break; case -ENODEV: - return_VALUE(AE_NOT_FOUND); + return AE_NOT_FOUND; break; case -ETIME: - return_VALUE(AE_TIME); + return AE_TIME; break; default: - return_VALUE(AE_OK); + return AE_OK; } } @@ -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; - ACPI_FUNCTION_TRACE("acpi_ec_read_info"); if (!ec) goto end; @@ -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); end: - return_VALUE(0); + return 0; } 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) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_ec_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; } entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_ec_info_ops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_ec_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_ec_remove_fs"); if (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) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -996,14 +981,13 @@ static int acpi_ec_poll_add(struct acpi_device *device) acpi_status status = AE_OK; union acpi_ec *ec = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); if (!ec) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(ec, 0, sizeof(union acpi_ec)); ec->common.handle = device->handle; @@ -1056,7 +1040,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) if (result) kfree(ec); - return_VALUE(result); + return result; } 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; union acpi_ec *ec = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); if (!ec) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(ec, 0, sizeof(union acpi_ec)); ec->common.handle = device->handle; @@ -1127,17 +1110,16 @@ static int acpi_ec_intr_add(struct acpi_device *device) if (result) kfree(ec); - return_VALUE(result); + return result; } static int acpi_ec_remove(struct acpi_device *device, int type) { union acpi_ec *ec = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_remove"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ec = acpi_driver_data(device); @@ -1145,7 +1127,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type) kfree(ec); - return_VALUE(0); + return 0; } static acpi_status @@ -1184,15 +1166,14 @@ static int acpi_ec_start(struct acpi_device *device) acpi_status status = AE_OK; union acpi_ec *ec = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_start"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ec = acpi_driver_data(device); if (!ec) - return_VALUE(-EINVAL); + return -EINVAL; /* * Get I/O port addresses. Convert to GAS format. @@ -1202,7 +1183,7 @@ static int acpi_ec_start(struct acpi_device *device) if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) { printk(KERN_ERR PREFIX "Error getting I/O port addresses\n"); - return_VALUE(-ENODEV); + return -ENODEV; } ec->common.status_addr = ec->common.command_addr; @@ -1219,7 +1200,7 @@ static int acpi_ec_start(struct acpi_device *device) ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); if (ACPI_FAILURE(status)) { - return_VALUE(-ENODEV); + return -ENODEV; } acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); @@ -1231,10 +1212,10 @@ static int acpi_ec_start(struct acpi_device *device) if (ACPI_FAILURE(status)) { acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &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) @@ -1242,10 +1223,9 @@ static int acpi_ec_stop(struct acpi_device *device, int type) acpi_status status = AE_OK; union acpi_ec *ec = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_stop"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ec = acpi_driver_data(device); @@ -1253,15 +1233,15 @@ static int acpi_ec_stop(struct acpi_device *device, int type) ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; - return_VALUE(0); + return 0; } static acpi_status __init @@ -1531,23 +1511,22 @@ static int __init acpi_ec_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_ec_init"); if (acpi_disabled) - return_VALUE(0); + return 0; acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); if (!acpi_ec_dir) - return_VALUE(-ENODEV); + return -ENODEV; /* Now register the driver for the EC */ result = acpi_bus_register_driver(&acpi_ec_driver); if (result < 0) { remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(result); + return result; } subsys_initcall(acpi_ec_init); @@ -1556,13 +1535,12 @@ subsys_initcall(acpi_ec_init); #if 0 static void __exit acpi_ec_exit(void) { - ACPI_FUNCTION_TRACE("acpi_ec_exit"); acpi_bus_unregister_driver(&acpi_ec_driver); remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); - return_VOID; + return; } #endif /* 0 */ diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index dab09d3..a901b23 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c @@ -48,18 +48,17 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, static int chars_remaining = 0; static char *ptr; - ACPI_FUNCTION_TRACE("acpi_system_read_event"); if (!chars_remaining) { memset(&event, 0, sizeof(struct acpi_bus_event)); if ((file->f_flags & O_NONBLOCK) && (list_empty(&acpi_bus_event_list))) - return_VALUE(-EAGAIN); + return -EAGAIN; result = acpi_bus_receive_event(&event); if (result) - return_VALUE(result); + return result; chars_remaining = sprintf(str, "%s %s %08x %08x\n", event.device_class ? event. @@ -75,13 +74,13 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, } if (copy_to_user(buffer, ptr, count)) - return_VALUE(-EFAULT); + return -EFAULT; *ppos += count; chars_remaining -= count; ptr += count; - return_VALUE(count); + return count; } static int acpi_system_close_event(struct inode *inode, struct file *file) @@ -112,10 +111,9 @@ static int __init acpi_event_init(void) struct proc_dir_entry *entry; int error = 0; - ACPI_FUNCTION_TRACE("acpi_event_init"); if (acpi_disabled) - return_VALUE(0); + return 0; /* 'event' [R] */ entry = create_proc_entry("event", S_IRUSR, acpi_root_dir); @@ -124,7 +122,7 @@ static int __init acpi_event_init(void) else { error = -ENODEV; } - return_VALUE(error); + return error; } subsys_initcall(acpi_event_init); diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 65bdcde..38acc69 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -78,7 +78,6 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset) struct acpi_fan *fan = seq->private; int state = 0; - ACPI_FUNCTION_TRACE("acpi_fan_read_state"); if (fan) { if (acpi_bus_get_power(fan->handle, &state)) @@ -87,7 +86,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset) seq_printf(seq, "status: %s\n", !state ? "on" : "off"); } - return_VALUE(0); + return 0; } 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, struct acpi_fan *fan = (struct acpi_fan *)m->private; char state_string[12] = { '\0' }; - ACPI_FUNCTION_TRACE("acpi_fan_write_state"); if (!fan || (count > sizeof(state_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(state_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; state_string[count] = '\0'; result = acpi_bus_set_power(fan->handle, simple_strtoul(state_string, NULL, 0)); if (result) - return_VALUE(result); + return result; - return_VALUE(count); + return count; } static struct file_operations acpi_fan_state_ops = { @@ -135,16 +133,15 @@ static int acpi_fan_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_fan_add_fs"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_fan_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } @@ -153,19 +150,18 @@ static int acpi_fan_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_fan_state_ops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_fan_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_fan_remove_fs"); if (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) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -186,14 +182,13 @@ static int acpi_fan_add(struct acpi_device *device) struct acpi_fan *fan = NULL; int state = 0; - ACPI_FUNCTION_TRACE("acpi_fan_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL); if (!fan) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(fan, 0, sizeof(struct acpi_fan)); fan->handle = device->handle; @@ -223,17 +218,16 @@ static int acpi_fan_add(struct acpi_device *device) if (result) kfree(fan); - return_VALUE(result); + return result; } static int acpi_fan_remove(struct acpi_device *device, int type) { struct acpi_fan *fan = NULL; - ACPI_FUNCTION_TRACE("acpi_fan_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; fan = (struct acpi_fan *)acpi_driver_data(device); @@ -241,7 +235,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type) kfree(fan); - return_VALUE(0); + return 0; } static int acpi_fan_suspend(struct acpi_device *device, int state) @@ -280,31 +274,29 @@ static int __init acpi_fan_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_fan_init"); acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); if (!acpi_fan_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_fan_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_fan_driver); if (result < 0) { 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) { - ACPI_FUNCTION_TRACE("acpi_fan_exit"); acpi_bus_unregister_driver(&acpi_fan_driver); remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_fan_init); diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index 393dbbc..fd81a0f 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c @@ -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) { - ACPI_FUNCTION_TRACE("hotkey_info_seq_show"); 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) @@ -266,7 +265,6 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) (struct acpi_polling_hotkey *)seq->private; char *buf; - ACPI_FUNCTION_TRACE("hotkey_polling_seq_show"); if (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) seq_printf(seq, "%s", buf); kfree(buf); } - return_VALUE(0); + return 0; } 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) struct list_head *entries; int val = -1; - ACPI_FUNCTION_TRACE("hotkey_get_internal_event"); list_for_each(entries, list->entries) { union acpi_hotkey *key = @@ -305,7 +302,7 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) } } - return_VALUE(val); + return val; } static void @@ -314,15 +311,14 @@ acpi_hotkey_notify_handler(acpi_handle handle, u32 event, void *data) struct acpi_device *device = NULL; u32 internal_event; - ACPI_FUNCTION_TRACE("acpi_hotkey_notify_handler"); if (acpi_bus_get_device(handle, &device)) - return_VOID; + return; internal_event = hotkey_get_internal_event(event, &global_hotkey_list); acpi_bus_generate_event(device, internal_event, 0); - return_VOID; + return; } /* Need to invent automatically hotkey add method */ @@ -346,7 +342,6 @@ static int create_polling_proc(union acpi_hotkey *device) char proc_name[80]; mode_t mode; - ACPI_FUNCTION_TRACE("create_polling_proc"); mode = S_IFREG | S_IRUGO | S_IWUGO; sprintf(proc_name, "%d", device->link.hotkey_standard_num); @@ -356,7 +351,7 @@ static int create_polling_proc(union acpi_hotkey *device) proc = create_proc_entry(proc_name, mode, hotkey_proc_dir); if (!proc) { - return_VALUE(-ENODEV); + return -ENODEV; } else { proc->proc_fops = &hotkey_polling_fops; proc->owner = THIS_MODULE; @@ -365,7 +360,7 @@ static int create_polling_proc(union acpi_hotkey *device) proc->gid = 0; device->poll_hotkey.proc = proc; } - return_VALUE(0); + return 0; } static int hotkey_add(union acpi_hotkey *device) @@ -373,7 +368,6 @@ static int hotkey_add(union acpi_hotkey *device) int status = 0; struct acpi_device *dev = NULL; - ACPI_FUNCTION_TRACE("hotkey_add"); if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) { acpi_bus_get_device(device->event_hotkey.bus_handle, &dev); @@ -388,14 +382,13 @@ static int hotkey_add(union acpi_hotkey *device) list_add_tail(&device->link.entries, global_hotkey_list.entries); - return_VALUE(status); + return status; } static int hotkey_remove(union acpi_hotkey *device) { struct list_head *entries, *next; - ACPI_FUNCTION_TRACE("hotkey_remove"); list_for_each_safe(entries, next, global_hotkey_list.entries) { union acpi_hotkey *key = @@ -409,14 +402,13 @@ static int hotkey_remove(union acpi_hotkey *device) } } kfree(device); - return_VALUE(0); + return 0; } static int hotkey_update(union acpi_hotkey *key) { struct list_head *entries; - ACPI_FUNCTION_TRACE("hotkey_update"); list_for_each(entries, global_hotkey_list.entries) { union acpi_hotkey *tmp = @@ -458,19 +450,18 @@ static int hotkey_update(union acpi_hotkey *key) */ kfree(key); } - return_VALUE(0); + return 0; break; } } - return_VALUE(-ENODEV); + return -ENODEV; } static void free_hotkey_device(union acpi_hotkey *key) { struct acpi_device *dev; - ACPI_FUNCTION_TRACE("free_hotkey_device"); if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { acpi_bus_get_device(key->event_hotkey.bus_handle, &dev); @@ -490,7 +481,7 @@ static void free_hotkey_device(union acpi_hotkey *key) free_poll_hotkey_buffer(key); } kfree(key); - return_VOID; + return; } 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, acpi_handle tmp_handle; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("init_hotkey_device"); if (std_num < 0 || IS_POLL(std_num) || !key) goto do_fail; @@ -538,9 +528,9 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, method, &tmp_handle); if (ACPI_FAILURE(status)) goto do_fail; - return_VALUE(AE_OK); + return AE_OK; do_fail: - return_VALUE(-ENODEV); + return -ENODEV; } static int @@ -552,7 +542,6 @@ init_poll_hotkey_device(union acpi_hotkey *key, acpi_status status = AE_OK; acpi_handle tmp_handle; - ACPI_FUNCTION_TRACE("init_poll_hotkey_device"); if (std_num < 0 || IS_EVENT(std_num) || !key) goto do_fail; @@ -587,22 +576,20 @@ init_poll_hotkey_device(union acpi_hotkey *key, (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); if (!key->poll_hotkey.poll_result) goto do_fail; - return_VALUE(AE_OK); + return AE_OK; do_fail: - return_VALUE(-ENODEV); + return -ENODEV; } static int hotkey_open_config(struct inode *inode, struct file *file) { - ACPI_FUNCTION_TRACE("hotkey_open_config"); - return_VALUE(single_open + return (single_open (file, hotkey_config_seq_show, PDE(inode)->data)); } static int hotkey_poll_open_config(struct inode *inode, struct file *file) { - ACPI_FUNCTION_TRACE("hotkey_poll_open_config"); - return_VALUE(single_open + return (single_open (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) struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; - ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); list_for_each(entries, hotkey_list->entries) { union acpi_hotkey *key = @@ -633,7 +619,7 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset) } } seq_puts(seq, "\n"); - return_VALUE(0); + return 0; } 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 act = { ACPI_PATHNAME_MAX, action_name }; - ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); list_for_each(entries, hotkey_list->entries) { union acpi_hotkey *key = @@ -663,7 +648,7 @@ static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset) } } seq_puts(seq, "\n"); - return_VALUE(0); + return 0; } static int @@ -675,7 +660,6 @@ get_parms(char *config_record, char **method, int *internal_event_num, int *external_event_num) { char *tmp, *tmp1, count; - ACPI_FUNCTION_TRACE(("get_parms")); sscanf(config_record, "%d", cmd); @@ -741,9 +725,9 @@ get_parms(char *config_record, 0) goto do_fail; - return_VALUE(6); + return 6; do_fail: - return_VALUE(-1); + return -1; } /* count is length for one input record */ @@ -760,16 +744,15 @@ static ssize_t hotkey_write_config(struct file *file, int ret = 0; union acpi_hotkey *key = NULL; - ACPI_FUNCTION_TRACE(("hotkey_write_config")); config_record = (char *)kmalloc(count + 1, GFP_KERNEL); if (!config_record) - return_VALUE(-ENOMEM); + return -ENOMEM; if (copy_from_user(config_record, buffer, count)) { kfree(config_record); printk(KERN_ERR PREFIX "Invalid data\n"); - return_VALUE(-EINVAL); + return -EINVAL; } config_record[count] = 0; @@ -790,7 +773,7 @@ static ssize_t hotkey_write_config(struct file *file, kfree(action_handle); kfree(method); printk(KERN_ERR PREFIX "Invalid data format ret=%d\n", ret); - return_VALUE(-EINVAL); + return -EINVAL; } key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); @@ -825,7 +808,7 @@ static ssize_t hotkey_write_config(struct file *file, free_poll_hotkey_buffer(key); kfree(key); printk(KERN_ERR PREFIX "Invalid hotkey\n"); - return_VALUE(-EINVAL); + return -EINVAL; } cont_cmd: @@ -851,7 +834,7 @@ static ssize_t hotkey_write_config(struct file *file, goto fail_out; break; } - return_VALUE(count); + return count; fail_out: if (IS_EVENT(internal_event_num)) free_hotkey_buffer(key); @@ -859,7 +842,7 @@ static ssize_t hotkey_write_config(struct file *file, free_poll_hotkey_buffer(key); kfree(key); 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, union acpi_object in_obj; /* the only param we use */ acpi_status status; - ACPI_FUNCTION_TRACE("write_acpi_int"); params.count = 1; params.pointer = &in_obj; in_obj.type = ACPI_TYPE_INTEGER; @@ -884,7 +866,7 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val, status = acpi_evaluate_object(handle, (char *)method, ¶ms, output); - return_VALUE(status == AE_OK); + return (status == AE_OK); } 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; acpi_status status; - ACPI_FUNCTION_TRACE("read_acpi_int"); output.length = sizeof(out_obj); output.pointer = &out_obj; @@ -904,7 +885,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, val->type = out_obj.type; } else printk(KERN_ERR PREFIX "null val pointer\n"); - return_VALUE((status == AE_OK) + return ((status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER)); } @@ -941,24 +922,23 @@ static ssize_t hotkey_execute_aml_method(struct file *file, int event, method_type, type, value; union acpi_hotkey *key; - ACPI_FUNCTION_TRACE("hotkey_execte_aml_method"); arg = (char *)kmalloc(count + 1, GFP_KERNEL); if (!arg) - return_VALUE(-ENOMEM); + return -ENOMEM; arg[count] = 0; if (copy_from_user(arg, buffer, count)) { kfree(arg); 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) != 4) { kfree(arg); printk(KERN_ERR PREFIX "Invalid argument 3\n"); - return_VALUE(-EINVAL); + return -EINVAL; } kfree(arg); if (type == ACPI_TYPE_INTEGER) { @@ -984,11 +964,11 @@ static ssize_t hotkey_execute_aml_method(struct file *file, } } else { printk(KERN_WARNING "Not supported\n"); - return_VALUE(-EINVAL); + return -EINVAL; } - return_VALUE(count); + return count; do_fail: - return_VALUE(-EINVAL); + return -EINVAL; } @@ -997,7 +977,6 @@ static int __init hotkey_init(void) int result; mode_t mode = S_IFREG | S_IRUGO | S_IWUGO; - ACPI_FUNCTION_TRACE("hotkey_init"); if (acpi_disabled) return -ENODEV; @@ -1084,7 +1063,6 @@ static void __exit hotkey_exit(void) { struct list_head *entries, *next; - ACPI_FUNCTION_TRACE("hotkey_exit"); list_for_each_safe(entries, next, global_hotkey_list.entries) { union acpi_hotkey *key = diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index d51d68f..ec6b7f9 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c @@ -52,13 +52,12 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) { struct resource *requested_res = NULL; - ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges"); if (res->type == ACPI_RESOURCE_TYPE_IO) { struct acpi_resource_io *io_res = &res->data.io; if (io_res->minimum != io_res->maximum) - return_VALUE(AE_OK); + return AE_OK; if (IS_RESERVED_ADDR (io_res->minimum, io_res->address_length)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -92,7 +91,7 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) if (requested_res) requested_res->flags &= ~IORESOURCE_BUSY; - return_VALUE(AE_OK); + return AE_OK; } static int acpi_motherboard_add(struct acpi_device *device) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 7d4cc12..8e46d1b 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -587,19 +587,18 @@ static void acpi_os_execute_deferred(void *context) { struct acpi_os_dpc *dpc = NULL; - ACPI_FUNCTION_TRACE("os_execute_deferred"); dpc = (struct acpi_os_dpc *)context; if (!dpc) { printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); - return_VOID; + return; } dpc->function(dpc->context); kfree(dpc); - return_VOID; + return; } static int acpi_os_execute_thread(void *context) @@ -693,7 +692,6 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle) { spinlock_t *lock_ptr; - ACPI_FUNCTION_TRACE("os_create_lock"); lock_ptr = acpi_os_allocate(sizeof(spinlock_t)); @@ -703,7 +701,7 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle) *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) */ 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_os_free(handle); - return_VOID; + return; } acpi_status @@ -725,11 +722,10 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) { struct semaphore *sem = NULL; - ACPI_FUNCTION_TRACE("os_create_semaphore"); sem = acpi_os_allocate(sizeof(struct semaphore)); if (!sem) - return_ACPI_STATUS(AE_NO_MEMORY); + return AE_NO_MEMORY; memset(sem, 0, sizeof(struct semaphore)); sema_init(sem, initial_units); @@ -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", *handle, initial_units)); - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_os_create_semaphore); @@ -755,17 +751,16 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle) { struct semaphore *sem = (struct semaphore *)handle; - ACPI_FUNCTION_TRACE("os_delete_semaphore"); if (!sem) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); acpi_os_free(sem); sem = NULL; - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_os_delete_semaphore); @@ -785,13 +780,12 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) struct semaphore *sem = (struct semaphore *)handle; int ret = 0; - ACPI_FUNCTION_TRACE("os_wait_semaphore"); if (!sem || (units < 1)) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; if (units > 1) - return_ACPI_STATUS(AE_SUPPORT); + return AE_SUPPORT; ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout)); @@ -850,7 +844,7 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) units, timeout)); } - return_ACPI_STATUS(status); + return status; } EXPORT_SYMBOL(acpi_os_wait_semaphore); @@ -862,20 +856,19 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) { struct semaphore *sem = (struct semaphore *)handle; - ACPI_FUNCTION_TRACE("os_signal_semaphore"); if (!sem || (units < 1)) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; if (units > 1) - return_ACPI_STATUS(AE_SUPPORT); + return AE_SUPPORT; ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, units)); up(sem); - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_os_signal_semaphore); diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 3e7d019..1e2ae6e 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c @@ -47,11 +47,10 @@ struct acpi_pci_data { static void acpi_pci_data_handler(acpi_handle handle, u32 function, void *context) { - ACPI_FUNCTION_TRACE("acpi_pci_data_handler"); /* 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) struct acpi_device *device = NULL; struct acpi_pci_data *data = NULL; - ACPI_FUNCTION_TRACE("acpi_get_pci_id"); if (!id) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; result = acpi_bus_get_device(handle, &device); if (result) { printk(KERN_ERR PREFIX "Invalid ACPI Bus context for device %s\n", 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); @@ -86,7 +84,7 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) ACPI_EXCEPTION((AE_INFO, status, "Invalid ACPI-PCI context for device %s", acpi_device_bid(device))); - return_ACPI_STATUS(status); + return status; } *id = data->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, id->device, id->function)); - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_get_pci_id); @@ -120,14 +118,13 @@ int acpi_pci_bind(struct acpi_device *device) struct pci_dev *dev; struct pci_bus *bus; - ACPI_FUNCTION_TRACE("acpi_pci_bind"); if (!device || !device->parent) - return_VALUE(-EINVAL); + return -EINVAL; pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); if (!pathname) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(pathname, 0, ACPI_PATHNAME_MAX); buffer.length = ACPI_PATHNAME_MAX; buffer.pointer = pathname; @@ -135,7 +132,7 @@ int acpi_pci_bind(struct acpi_device *device) data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); if (!data) { kfree(pathname); - return_VALUE(-ENOMEM); + return -ENOMEM; } memset(data, 0, sizeof(struct acpi_pci_data)); @@ -269,7 +266,7 @@ int acpi_pci_bind(struct acpi_device *device) if (result) kfree(data); - return_VALUE(result); + return result; } int acpi_pci_unbind(struct acpi_device *device) @@ -280,14 +277,13 @@ int acpi_pci_unbind(struct acpi_device *device) char *pathname = NULL; struct acpi_buffer buffer = { 0, NULL }; - ACPI_FUNCTION_TRACE("acpi_pci_unbind"); if (!device || !device->parent) - return_VALUE(-EINVAL); + return -EINVAL; pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); if (!pathname) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(pathname, 0, ACPI_PATHNAME_MAX); buffer.length = ACPI_PATHNAME_MAX; @@ -322,7 +318,7 @@ int acpi_pci_unbind(struct acpi_device *device) kfree(data); end: - return_VALUE(result); + return result; } int @@ -335,11 +331,10 @@ acpi_pci_bind_root(struct acpi_device *device, char *pathname = NULL; struct acpi_buffer buffer = { 0, NULL }; - ACPI_FUNCTION_TRACE("acpi_pci_bind_root"); pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); if (!pathname) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(pathname, 0, ACPI_PATHNAME_MAX); buffer.length = ACPI_PATHNAME_MAX; @@ -347,13 +342,13 @@ acpi_pci_bind_root(struct acpi_device *device, if (!device || !id || !bus) { kfree(pathname); - return_VALUE(-EINVAL); + return -EINVAL; } data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); if (!data) { kfree(pathname); - return_VALUE(-ENOMEM); + return -ENOMEM; } memset(data, 0, sizeof(struct acpi_pci_data)); @@ -381,5 +376,5 @@ acpi_pci_bind_root(struct acpi_device *device, if (result != 0) kfree(data); - return_VALUE(result); + return result; } diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index f24a6100..fb96e3b 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -55,10 +55,9 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, struct list_head *node = NULL; struct acpi_prt_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry"); if (!acpi_prt.count) - return_PTR(NULL); + return NULL; /* * 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, && (device == entry->id.device) && (pin == entry->pin)) { spin_unlock(&acpi_prt_lock); - return_PTR(entry); + return entry; } } spin_unlock(&acpi_prt_lock); - return_PTR(NULL); + return NULL; } static int @@ -87,14 +86,13 @@ acpi_pci_irq_add_entry(acpi_handle handle, { struct acpi_prt_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_irq_add_entry"); if (!prt) - return_VALUE(-EINVAL); + return -EINVAL; entry = kmalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL); if (!entry) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(entry, 0, sizeof(struct acpi_prt_entry)); entry->id.segment = segment; @@ -141,7 +139,7 @@ acpi_pci_irq_add_entry(acpi_handle handle, acpi_prt.count++; spin_unlock(&acpi_prt_lock); - return_VALUE(0); + return 0; } static void @@ -163,11 +161,10 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) struct acpi_pci_routing_table *entry = NULL; static int first_time = 1; - ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt"); pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); if (!pathname) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(pathname, 0, ACPI_PATHNAME_MAX); if (first_time) { @@ -199,12 +196,12 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) if (status != AE_BUFFER_OVERFLOW) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", acpi_format_exception(status))); - return_VALUE(-ENODEV); + return -ENODEV; } prt = kmalloc(buffer.length, GFP_KERNEL); if (!prt) { - return_VALUE(-ENOMEM); + return -ENOMEM; } memset(prt, 0, buffer.length); buffer.pointer = prt; @@ -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_format_exception(status))); kfree(buffer.pointer); - return_VALUE(-ENODEV); + return -ENODEV; } entry = prt; @@ -227,7 +224,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) kfree(prt); - return_VALUE(0); + return 0; } void acpi_pci_irq_del_prt(int segment, int bus) @@ -262,7 +259,6 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, { int irq; - ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq"); if (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, if (irq < 0) { printk(KERN_WARNING PREFIX "Invalid IRQ link routing entry\n"); - return_VALUE(-1); + return -1; } } else { irq = entry->link.index; @@ -280,7 +276,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); - return_VALUE(irq); + return irq; } static int @@ -289,13 +285,12 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry, { int irq; - ACPI_FUNCTION_TRACE("acpi_pci_free_irq"); if (entry->link.handle) { irq = acpi_pci_link_free_irq(entry->link.handle); } else { irq = entry->link.index; } - return_VALUE(irq); + return irq; } /* @@ -315,7 +310,6 @@ acpi_pci_irq_lookup(struct pci_bus *bus, int bus_nr = bus->number; int ret; - ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Searching for PRT entry for %02x:%02x:%02x[%c]\n", @@ -324,11 +318,11 @@ acpi_pci_irq_lookup(struct pci_bus *bus, entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); if (!entry) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n")); - return_VALUE(-1); + return -1; } ret = func(entry, triggering, polarity, link); - return_VALUE(ret); + return ret; } /* @@ -346,10 +340,9 @@ acpi_pci_irq_derive(struct pci_dev *dev, int irq = -1; u8 bridge_pin = 0; - ACPI_FUNCTION_TRACE("acpi_pci_irq_derive"); if (!dev) - return_VALUE(-EINVAL); + return -EINVAL; /* * 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, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No interrupt pin configured for device %s\n", pci_name(bridge))); - return_VALUE(-1); + return -1; } /* Pin is from 0 to 3 */ bridge_pin--; @@ -381,13 +374,13 @@ acpi_pci_irq_derive(struct pci_dev *dev, if (irq < 0) { printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n", pci_name(dev)); - return_VALUE(-1); + return -1; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n", 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) char *link = NULL; int rc; - ACPI_FUNCTION_TRACE("acpi_pci_irq_enable"); if (!dev) - return_VALUE(-EINVAL); + return -EINVAL; pin = dev->pin; if (!pin) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No interrupt pin configured for device %s\n", pci_name(dev))); - return_VALUE(0); + return 0; } pin--; if (!dev->bus) { 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) printk(" - using IRQ %d\n", dev->irq); acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); - return_VALUE(0); + return 0; } else { printk("\n"); - return_VALUE(0); + return 0; } } @@ -464,7 +456,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) if (rc < 0) { printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " "to register GSI\n", pci_name(dev), ('A' + pin)); - return_VALUE(rc); + return rc; } dev->irq = rc; @@ -478,7 +470,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_pci_irq_enable); @@ -495,14 +487,13 @@ void acpi_pci_irq_disable(struct pci_dev *dev) int triggering = ACPI_LEVEL_SENSITIVE; int polarity = ACPI_ACTIVE_LOW; - ACPI_FUNCTION_TRACE("acpi_pci_irq_disable"); if (!dev || !dev->bus) - return_VOID; + return; pin = dev->pin; if (!pin) - return_VOID; + return; pin--; /* @@ -520,7 +511,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) &triggering, &polarity, NULL, acpi_pci_free_irq); if (gsi < 0) - return_VOID; + return; /* * TBD: It might be worth clearing dev->irq by magic constant @@ -532,5 +523,5 @@ void acpi_pci_irq_disable(struct pci_dev *dev) acpi_unregister_gsi(gsi); - return_VOID; + return; } diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index d7aa9c1..1badce2 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -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; u32 i = 0; - ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); switch (resource->type) { case ACPI_RESOURCE_TYPE_START_DEPENDENT: - return_ACPI_STATUS(AE_OK); + return AE_OK; case ACPI_RESOURCE_TYPE_IRQ: { struct acpi_resource_irq *p = &resource->data.irq; if (!p || !p->interrupt_count) { printk(KERN_WARNING PREFIX "Blank IRQ resource\n"); - return_ACPI_STATUS(AE_OK); + return AE_OK; } for (i = 0; (i < p->interrupt_count @@ -142,7 +141,7 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) if (!p || !p->interrupt_count) { printk(KERN_WARNING PREFIX "Blank EXT IRQ resource\n"); - return_ACPI_STATUS(AE_OK); + return AE_OK; } for (i = 0; (i < p->interrupt_count @@ -162,33 +161,32 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) } default: 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) { acpi_status status; - ACPI_FUNCTION_TRACE("acpi_pci_link_get_possible"); if (!link) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, acpi_pci_link_check_possible, link); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS")); - return_VALUE(-ENODEV); + return -ENODEV; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d possible IRQs\n", link->irq.possible_count)); - return_VALUE(0); + return 0; } static acpi_status @@ -196,7 +194,6 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) { int *irq = (int *)context; - ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); switch (resource->type) { case ACPI_RESOURCE_TYPE_IRQ: @@ -209,7 +206,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Blank IRQ resource\n")); - return_ACPI_STATUS(AE_OK); + return AE_OK; } *irq = p->interrupts[0]; break; @@ -225,7 +222,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) */ printk(KERN_WARNING PREFIX "Blank EXT IRQ resource\n"); - return_ACPI_STATUS(AE_OK); + return AE_OK; } *irq = p->interrupts[0]; break; @@ -234,9 +231,9 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) default: printk(KERN_ERR PREFIX "Resource %d isn't an IRQ\n", resource->type); 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) acpi_status status = AE_OK; int irq = 0; - ACPI_FUNCTION_TRACE("acpi_pci_link_get_current"); if (!link || !link->handle) - return_VALUE(-EINVAL); + return -EINVAL; link->irq.active = 0; @@ -270,7 +266,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) if (!link->device->status.enabled) { 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) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); end: - return_VALUE(result); + return result; } 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; struct acpi_buffer buffer = { 0, NULL }; - ACPI_FUNCTION_TRACE("acpi_pci_link_set"); if (!link || !irq) - return_VALUE(-EINVAL); + return -EINVAL; resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC); if (!resource) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(resource, 0, 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) end: kfree(resource); - return_VALUE(result); + return result; } /* -------------------------------------------------------------------------- @@ -487,7 +482,6 @@ int __init acpi_irq_penalty_init(void) struct acpi_pci_link *link = NULL; int i = 0; - ACPI_FUNCTION_TRACE("acpi_irq_penalty_init"); /* * Update penalties to facilitate IRQ balancing. @@ -524,7 +518,7 @@ int __init acpi_irq_penalty_init(void) /* Add a penalty for the SCI */ 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 */ @@ -534,13 +528,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) int irq; int i; - ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); if (link->irq.initialized) { if (link->refcnt == 0) /* This means the link is disabled but initialized */ 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) "Try pci=noacpi or acpi=off\n", acpi_device_name(link->device), acpi_device_bid(link->device)); - return_VALUE(-ENODEV); + return -ENODEV; } else { acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; printk(PREFIX "%s [%s] enabled at IRQ %d\n", @@ -597,7 +590,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) link->irq.initialized = 1; - return_VALUE(0); + return 0; } /* @@ -615,36 +608,35 @@ acpi_pci_link_allocate_irq(acpi_handle handle, struct acpi_device *device = NULL; struct acpi_pci_link *link = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq"); result = acpi_bus_get_device(handle, &device); if (result) { printk(KERN_ERR PREFIX "Invalid link device\n"); - return_VALUE(-1); + return -1; } link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { printk(KERN_ERR PREFIX "Invalid link context\n"); - return_VALUE(-1); + return -1; } /* TBD: Support multiple index (IRQ) entries per Link Device */ if (index) { printk(KERN_ERR PREFIX "Invalid index %d\n", index); - return_VALUE(-1); + return -1; } mutex_lock(&acpi_link_lock); if (acpi_pci_link_allocate(link)) { mutex_unlock(&acpi_link_lock); - return_VALUE(-1); + return -1; } if (!link->irq.active) { mutex_unlock(&acpi_link_lock); printk(KERN_ERR PREFIX "Link active IRQ is 0!\n"); - return_VALUE(-1); + return -1; } link->refcnt++; mutex_unlock(&acpi_link_lock); @@ -658,7 +650,7 @@ acpi_pci_link_allocate_irq(acpi_handle handle, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link %s is referenced\n", 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) struct acpi_pci_link *link = NULL; acpi_status result; - ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq"); result = acpi_bus_get_device(handle, &device); if (result) { printk(KERN_ERR PREFIX "Invalid link device\n"); - return_VALUE(-1); + return -1; } link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { printk(KERN_ERR PREFIX "Invalid link context\n"); - return_VALUE(-1); + return -1; } mutex_lock(&acpi_link_lock); if (!link->irq.initialized) { mutex_unlock(&acpi_link_lock); printk(KERN_ERR PREFIX "Link isn't initialized\n"); - return_VALUE(-1); + return -1; } #ifdef FUTURE_USE /* @@ -711,7 +702,7 @@ int acpi_pci_link_free_irq(acpi_handle handle) acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); } 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) int i = 0; int found = 0; - ACPI_FUNCTION_TRACE("acpi_pci_link_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); if (!link) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(link, 0, sizeof(struct acpi_pci_link)); link->device = device; @@ -781,17 +771,16 @@ static int acpi_pci_link_add(struct acpi_device *device) if (result) kfree(link); - return_VALUE(result); + return result; } 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) - return_VALUE(acpi_pci_link_set(link, link->irq.active)); + return (acpi_pci_link_set(link, link->irq.active)); else - return_VALUE(0); + return 0; } /* @@ -804,7 +793,6 @@ static int irqrouter_resume(struct sys_device *dev) struct list_head *node = NULL; struct acpi_pci_link *link = NULL; - ACPI_FUNCTION_TRACE("irqrouter_resume"); /* Make sure SCI is enabled again (Apple firmware bug?) */ 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) acpi_pci_link_resume(link); } acpi_in_resume = 0; - return_VALUE(0); + return 0; } static int acpi_pci_link_remove(struct acpi_device *device, int type) { struct acpi_pci_link *link = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_link_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; 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) kfree(link); - return_VALUE(0); + return 0; } /* @@ -945,34 +932,32 @@ static int __init irqrouter_init_sysfs(void) { int error; - ACPI_FUNCTION_TRACE("irqrouter_init_sysfs"); if (acpi_disabled || acpi_noirq) - return_VALUE(0); + return 0; error = sysdev_class_register(&irqrouter_sysdev_class); if (!error) error = sysdev_register(&device_irqrouter); - return_VALUE(error); + return error; } device_initcall(irqrouter_init_sysfs); static int __init acpi_pci_link_init(void) { - ACPI_FUNCTION_TRACE("acpi_pci_link_init"); if (acpi_noirq) - return_VALUE(0); + return 0; acpi_link.count = 0; INIT_LIST_HEAD(&acpi_link.entries); 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); diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 1930397..8f10442 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -160,14 +160,13 @@ static int acpi_pci_root_add(struct acpi_device *device) unsigned long value = 0; acpi_handle handle = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_root_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; root = kmalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); if (!root) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(root, 0, sizeof(struct acpi_pci_root)); INIT_LIST_HEAD(&root->node); @@ -307,46 +306,43 @@ static int acpi_pci_root_add(struct acpi_device *device) kfree(root); } - return_VALUE(result); + return result; } static int acpi_pci_root_start(struct acpi_device *device) { struct acpi_pci_root *root; - ACPI_FUNCTION_TRACE("acpi_pci_root_start"); list_for_each_entry(root, &acpi_pci_roots, node) { if (root->handle == device->handle) { 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) { struct acpi_pci_root *root = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_root_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; root = (struct acpi_pci_root *)acpi_driver_data(device); kfree(root); - return_VALUE(0); + return 0; } static int __init acpi_pci_root_init(void) { - ACPI_FUNCTION_TRACE("acpi_pci_root_init"); if (acpi_pci_disabled) - return_VALUE(0); + return 0; /* DEBUG: acpi_dbg_layer = ACPI_PCI_COMPONENT; @@ -354,9 +350,9 @@ static int __init acpi_pci_root_init(void) */ 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); diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index efc4bb7..224f729 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -98,22 +98,21 @@ acpi_power_get_context(acpi_handle handle, int result = 0; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_power_get_context"); if (!resource) - return_VALUE(-ENODEV); + return -ENODEV; result = acpi_bus_get_device(handle, &device); if (result) { printk(KERN_WARNING PREFIX "Getting context [%p]\n", handle); - return_VALUE(result); + return result; } *resource = (struct acpi_power_resource *)acpi_driver_data(device); if (!resource) - return_VALUE(-ENODEV); + return -ENODEV; - return_VALUE(0); + return 0; } 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; unsigned long sta = 0; - ACPI_FUNCTION_TRACE("acpi_power_get_state"); if (!resource) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; if (sta & 0x01) resource->state = ACPI_POWER_RESOURCE_STATE_ON; @@ -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", 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) @@ -147,20 +145,19 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) struct acpi_power_resource *resource = NULL; u32 i = 0; - ACPI_FUNCTION_TRACE("acpi_power_get_list_state"); if (!list || !state) - return_VALUE(-EINVAL); + return -EINVAL; /* The state of the list is 'on' IFF all resources are 'on'. */ for (i = 0; i < list->count; i++) { result = acpi_power_get_context(list->handles[i], &resource); if (result) - return_VALUE(result); + return result; result = acpi_power_get_state(resource); if (result) - return_VALUE(result); + return result; *state = resource->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", *state ? "on" : "off")); - return_VALUE(result); + return result; } 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_power_resource *resource = NULL; - ACPI_FUNCTION_TRACE("acpi_power_on"); result = acpi_power_get_context(handle, &resource); if (result) - return_VALUE(result); + return result; resource->references++; @@ -193,29 +189,29 @@ static int acpi_power_on(acpi_handle handle) || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n", resource->name)); - return_VALUE(0); + return 0; } status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; result = acpi_power_get_state(resource); if (result) - return_VALUE(result); + return result; if (resource->state != ACPI_POWER_RESOURCE_STATE_ON) - return_VALUE(-ENOEXEC); + return -ENOEXEC; /* Update the power resource's _device_ power state */ result = acpi_bus_get_device(resource->handle, &device); if (result) - return_VALUE(result); + return result; device->power.state = ACPI_STATE_D0; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", resource->name)); - return_VALUE(0); + return 0; } 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_power_resource *resource = NULL; - ACPI_FUNCTION_TRACE("acpi_power_off_device"); result = acpi_power_get_context(handle, &resource); if (result) - return_VALUE(result); + return result; if (resource->references) resource->references--; @@ -238,35 +233,35 @@ static int acpi_power_off_device(acpi_handle handle) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is still in use, dereferencing\n", device->pnp.bus_id)); - return_VALUE(0); + return 0; } if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n", device->pnp.bus_id)); - return_VALUE(0); + return 0; } status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; result = acpi_power_get_state(resource); if (result) - return_VALUE(result); + return result; if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF) - return_VALUE(-ENOEXEC); + return -ENOEXEC; /* Update the power resource's _device_ power state */ result = acpi_bus_get_device(resource->handle, &device); if (result) - return_VALUE(result); + return result; device->power.state = ACPI_STATE_D3; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", resource->name)); - return_VALUE(0); + return 0; } /* @@ -282,9 +277,8 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) int i; int ret = 0; - ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_power"); if (!dev || !dev->wakeup.flags.valid) - return_VALUE(-1); + return -1; arg.integer.value = 1; /* Open power resource */ @@ -293,7 +287,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) if (ret) { printk(KERN_ERR PREFIX "Transition power state\n"); dev->wakeup.flags.valid = 0; - return_VALUE(-1); + return -1; } } @@ -305,7 +299,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) ret = -1; } - return_VALUE(ret); + return ret; } /* @@ -321,10 +315,9 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) int i; int ret = 0; - ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device_power"); if (!dev || !dev->wakeup.flags.valid) - return_VALUE(-1); + return -1; arg.integer.value = 0; /* Execute PSW */ @@ -332,7 +325,7 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { printk(KERN_ERR PREFIX "Evaluate _PSW\n"); dev->wakeup.flags.valid = 0; - return_VALUE(-1); + return -1; } /* Close power resource */ @@ -341,11 +334,11 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) if (ret) { printk(KERN_ERR PREFIX "Transition power state\n"); 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) int list_state = 0; int i = 0; - ACPI_FUNCTION_TRACE("acpi_power_get_inferred_state"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; device->power.state = ACPI_STATE_UNKNOWN; @@ -377,17 +369,17 @@ int acpi_power_get_inferred_state(struct acpi_device *device) result = acpi_power_get_list_state(list, &list_state); if (result) - return_VALUE(result); + return result; if (list_state == ACPI_POWER_RESOURCE_STATE_ON) { device->power.state = i; - return_VALUE(0); + return 0; } } device->power.state = ACPI_STATE_D3; - return_VALUE(0); + return 0; } 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 */ int i = 0; - ACPI_FUNCTION_TRACE("acpi_power_transition"); if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) - return_VALUE(-EINVAL); + return -EINVAL; if ((device->power.state < ACPI_STATE_D0) || (device->power.state > ACPI_STATE_D3)) - return_VALUE(-ENODEV); + return -ENODEV; cl = &device->power.states[device->power.state].resources; tl = &device->power.states[state].resources; @@ -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", 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) { struct acpi_power_resource *resource = NULL; - ACPI_FUNCTION_TRACE("acpi_power_seq_show"); resource = (struct acpi_power_resource *)seq->private; @@ -484,7 +474,7 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset) resource->order, resource->references); end: - return_VALUE(0); + return 0; } 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) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_power_add_fs"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_power_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; } /* 'status' [R] */ entry = create_proc_entry(ACPI_POWER_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-EIO); + return -EIO; else { entry->proc_fops = &acpi_power_fops; entry->data = acpi_driver_data(device); } - return_VALUE(0); + return 0; } static int acpi_power_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_power_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_POWER_FILE_STATUS, @@ -532,7 +520,7 @@ static int acpi_power_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -547,14 +535,13 @@ static int acpi_power_add(struct acpi_device *device) union acpi_object acpi_object; struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object }; - ACPI_FUNCTION_TRACE("acpi_power_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL); if (!resource) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(resource, 0, sizeof(struct acpi_power_resource)); resource->handle = device->handle; @@ -599,17 +586,16 @@ static int acpi_power_add(struct acpi_device *device) if (result) kfree(resource); - return_VALUE(result); + return result; } static int acpi_power_remove(struct acpi_device *device, int type) { struct acpi_power_resource *resource = NULL; - ACPI_FUNCTION_TRACE("acpi_power_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; resource = (struct acpi_power_resource *)acpi_driver_data(device); @@ -617,31 +603,30 @@ static int acpi_power_remove(struct acpi_device *device, int type) kfree(resource); - return_VALUE(0); + return 0; } static int __init acpi_power_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_power_init"); if (acpi_disabled) - return_VALUE(0); + return 0; INIT_LIST_HEAD(&acpi_power_resource_list); acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); if (!acpi_power_dir) - return_VALUE(-ENODEV); + return -ENODEV; result = acpi_bus_register_driver(&acpi_power_driver); if (result < 0) { remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } subsys_initcall(acpi_power_init); diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 80bbf18..5267432 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -122,10 +122,9 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev) u8 value1 = 0; u8 value2 = 0; - ACPI_FUNCTION_TRACE("acpi_processor_errata_piix4"); if (!dev) - return_VALUE(-EINVAL); + return -EINVAL; /* * Note that 'dev' references the PIIX4 ACPI Controller. @@ -218,7 +217,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Type-F DMA livelock erratum (C3 disabled)\n")); - return_VALUE(0); + return 0; } 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; struct pci_dev *dev = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_errata"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; /* * PIIX4 @@ -242,7 +240,7 @@ static int acpi_processor_errata(struct acpi_processor *pr) pci_dev_put(dev); } - return_VALUE(result); + return result; } /* -------------------------------------------------------------------------- @@ -258,10 +256,9 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr) struct acpi_object_list *pdc_in = pr->pdc; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); if (!pdc_in) - return_VALUE(status); + return status; status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); @@ -269,7 +266,7 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "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) { struct acpi_processor *pr = (struct acpi_processor *)seq->private; - ACPI_FUNCTION_TRACE("acpi_processor_info_seq_show"); if (!pr) goto end; @@ -301,7 +297,7 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) pr->flags.limit ? "yes" : "no"); end: - return_VALUE(0); + return 0; } 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) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_processor_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; } acpi_device_dir(device)->owner = THIS_MODULE; @@ -328,7 +323,7 @@ static int acpi_processor_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-EIO); + return -EIO; else { entry->proc_fops = &acpi_processor_info_fops; entry->data = acpi_driver_data(device); @@ -340,7 +335,7 @@ static int acpi_processor_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - return_VALUE(-EIO); + return -EIO; else { entry->proc_fops = &acpi_processor_throttling_fops; entry->data = acpi_driver_data(device); @@ -352,19 +347,18 @@ static int acpi_processor_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - return_VALUE( -EIO); + return -EIO; else { entry->proc_fops = &acpi_processor_limit_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_processor_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_processor_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, @@ -377,7 +371,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* 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) int cpu_index; static int cpu0_initialized; - ACPI_FUNCTION_TRACE("acpi_processor_get_info"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (num_online_cpus() > 1) errata.smp = TRUE; @@ -454,7 +447,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); if (ACPI_FAILURE(status)) { 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) printk(KERN_ERR PREFIX "Getting cpuindex for acpiid 0x%x\n", pr->acpi_id); - return_VALUE(-ENODEV); + return -ENODEV; } } @@ -521,7 +514,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) acpi_processor_get_throttling_info(pr); acpi_processor_get_limit_info(pr); - return_VALUE(0); + return 0; } static void *processor_device_array[NR_CPUS]; @@ -532,14 +525,13 @@ static int acpi_processor_start(struct acpi_device *device) acpi_status status = AE_OK; struct acpi_processor *pr; - ACPI_FUNCTION_TRACE("acpi_processor_start"); pr = acpi_driver_data(device); result = acpi_processor_get_info(pr); if (result) { /* Processor is physically not present */ - return_VALUE(0); + return 0; } BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); @@ -553,7 +545,7 @@ static int acpi_processor_start(struct acpi_device *device) processor_device_array[pr->id] != (void *)device) { printk(KERN_WARNING "BIOS reported wrong ACPI id" "for the processor\n"); - return_VALUE(-ENODEV); + return -ENODEV; } processor_device_array[pr->id] = (void *)device; @@ -581,7 +573,7 @@ static int acpi_processor_start(struct acpi_device *device) end: - return_VALUE(result); + return result; } 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_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_notify"); if (!pr) - return_VOID; + return; if (acpi_bus_get_device(pr->handle, &device)) - return_VOID; + return; switch (event) { case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: @@ -613,21 +604,20 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static int acpi_processor_add(struct acpi_device *device) { struct acpi_processor *pr = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; pr = kmalloc(sizeof(struct acpi_processor), GFP_KERNEL); if (!pr) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(pr, 0, sizeof(struct acpi_processor)); pr->handle = device->handle; @@ -635,7 +625,7 @@ static int acpi_processor_add(struct acpi_device *device) strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); acpi_driver_data(device) = pr; - return_VALUE(0); + return 0; } 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; struct acpi_processor *pr = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; pr = (struct acpi_processor *)acpi_driver_data(device); if (pr->id >= NR_CPUS) { kfree(pr); - return_VALUE(0); + return 0; } if (type == ACPI_BUS_REMOVAL_EJECT) { if (acpi_processor_handle_eject(pr)) - return_VALUE(-EINVAL); + return -EINVAL; } acpi_processor_power_exit(pr, device); @@ -671,7 +660,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type) kfree(pr); - return_VALUE(0); + return 0; } #ifdef CONFIG_ACPI_HOTPLUG_CPU @@ -686,14 +675,13 @@ static int is_processor_present(acpi_handle handle) acpi_status status; unsigned long sta = 0; - ACPI_FUNCTION_TRACE("is_processor_present"); status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) { ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); - return_VALUE(0); + return 0; } - return_VALUE(1); + return 1; } static @@ -703,30 +691,29 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) struct acpi_device *pdev; struct acpi_processor *pr; - ACPI_FUNCTION_TRACE("acpi_processor_device_add"); if (acpi_get_parent(handle, &phandle)) { - return_VALUE(-ENODEV); + return -ENODEV; } if (acpi_bus_get_device(phandle, &pdev)) { - return_VALUE(-ENODEV); + return -ENODEV; } if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) { - return_VALUE(-ENODEV); + return -ENODEV; } acpi_bus_start(*device); pr = acpi_driver_data(*device); if (!pr) - return_VALUE(-ENODEV); + return -ENODEV; if ((pr->id >= 0) && (pr->id < NR_CPUS)) { kobject_uevent(&(*device)->kobj, KOBJ_ONLINE); } - return_VALUE(0); + return 0; } static void @@ -736,7 +723,6 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) struct acpi_device *device = NULL; int result; - ACPI_FUNCTION_TRACE("acpi_processor_hotplug_notify"); switch (event) { case ACPI_NOTIFY_BUS_CHECK: @@ -788,7 +774,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) if (!pr) { printk(KERN_ERR PREFIX "Driver data is NULL, dropping EJECT\n"); - return_VOID; + return; } if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) @@ -800,7 +786,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static acpi_status @@ -839,21 +825,20 @@ processor_walk_namespace_cb(acpi_handle handle, 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)) { - return_VALUE(AE_ERROR); + return AE_ERROR; } if (acpi_map_lsapic(handle, p_cpu)) - return_VALUE(AE_ERROR); + return AE_ERROR; if (arch_register_cpu(*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) @@ -910,20 +895,19 @@ static int __init acpi_processor_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_processor_init"); memset(&processors, 0, sizeof(processors)); memset(&errata, 0, sizeof(errata)); acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); if (!acpi_processor_dir) - return_VALUE(0); + return 0; acpi_processor_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_processor_driver); if (result < 0) { remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); - return_VALUE(0); + return 0; } acpi_processor_install_hotplug_notify(); @@ -932,12 +916,11 @@ static int __init acpi_processor_init(void) acpi_processor_ppc_init(); - return_VALUE(0); + return 0; } static void __exit acpi_processor_exit(void) { - ACPI_FUNCTION_TRACE("acpi_processor_exit"); acpi_processor_ppc_exit(); @@ -949,7 +932,7 @@ static void __exit acpi_processor_exit(void) remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_processor_init); diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 786851d..89d3fd4 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -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 *cx; - ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; /* * 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) } if (!state_is_set) - return_VALUE(-ENODEV); + return -ENODEV; /* demotion */ for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { @@ -583,18 +582,17 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) higher = cx; } - return_VALUE(0); + return 0; } static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) { - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (!pr->pblk) - return_VALUE(-ENODEV); + return -ENODEV; /* if info is obtained from pblk/fadt, type equals state */ 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) * an SMP system. */ if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up) - return_VALUE(-ENODEV); + return -ENODEV; #endif /* determine C2 and C3 address from pblk */ @@ -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_C3].address)); - return_VALUE(0); + return 0; } 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. */ 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) pr->power.states[ACPI_STATE_C0].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) @@ -652,10 +649,9 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *cst; - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); if (nocst) - return_VALUE(-ENODEV); + return -ENODEV; current_count = 1; @@ -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); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n")); - return_VALUE(-ENODEV); + return -ENODEV; } cst = (union acpi_object *)buffer.pointer; @@ -773,15 +769,14 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) end: acpi_os_free(buffer.pointer); - return_VALUE(status); + return status; } static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) { - ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c2"); if (!cx->address) - return_VOID; + return; /* * 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) else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "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) cx->valid = 1; cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); - return_VOID; + return; } 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; - ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3"); if (!cx->address) - return_VOID; + return; /* * 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, else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "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, else if (errata.piix4.fdma) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "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 */ @@ -850,7 +844,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, if (!pr->flags.bm_control) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "C3 support requires bus mastering control\n")); - return_VOID; + return; } } else { /* @@ -861,7 +855,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cache invalidation should work properly" " for C3 to be enabled on SMP systems\n")); - return_VOID; + return; } acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); @@ -876,7 +870,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, cx->valid = 1; cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); - return_VOID; + return; } 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) unsigned int i; int result; - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info"); /* NOTE: the idle thread may not be running while calling * this function */ @@ -958,7 +951,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) */ result = acpi_processor_set_power_policy(pr); if (result) - return_VALUE(result); + return result; /* * 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) } } - return_VALUE(0); + return 0; } int acpi_processor_cst_has_changed(struct acpi_processor *pr) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_processor_cst_has_changed"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (nocst) { - return_VALUE(-ENODEV); + return -ENODEV; } if (!pr->flags.power_setup_done) - return_VALUE(-ENODEV); + return -ENODEV; /* Fall back to the default idle loop */ pm_idle = pm_idle_save; @@ -1000,7 +992,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) pm_idle = acpi_processor_idle; - return_VALUE(result); + return result; } /* proc interface */ @@ -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; unsigned int i; - ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show"); if (!pr) goto end; @@ -1068,7 +1059,7 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) } end: - return_VALUE(0); + return 0; } 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, struct proc_dir_entry *entry = NULL; unsigned int i; - ACPI_FUNCTION_TRACE("acpi_processor_power_init"); if (!first_run) { dmi_check_system(processor_power_dmi_table); @@ -1104,7 +1094,7 @@ int acpi_processor_power_init(struct acpi_processor *pr, } if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (acpi_fadt.cst_cnt && !nocst) { status = @@ -1149,13 +1139,12 @@ int acpi_processor_power_init(struct acpi_processor *pr, pr->flags.power_setup_done = 1; - return_VALUE(0); + return 0; } int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_processor_power_exit"); pr->flags.power_setup_done = 0; @@ -1175,5 +1164,5 @@ int acpi_processor_power_exit(struct acpi_processor *pr, cpu_idle_wait(); } - return_VALUE(0); + return 0; } diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 5c24ac4..14a00e5 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -108,10 +108,9 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) acpi_status status = 0; unsigned long ppc = 0; - ACPI_FUNCTION_TRACE("acpi_processor_get_platform_limit"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; /* * _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) if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC")); - return_VALUE(-ENODEV); + return -ENODEV; } pr->performance_platform_limit = (int)ppc; - return_VALUE(0); + return 0; } 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) union acpi_object *pct = NULL; union acpi_object obj = { 0 }; - ACPI_FUNCTION_TRACE("acpi_processor_get_performance_control"); status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PCT")); - return_VALUE(-ENODEV); + return -ENODEV; } pct = (union acpi_object *)buffer.pointer; @@ -220,7 +218,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) end: acpi_os_free(buffer.pointer); - return_VALUE(result); + return result; } 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; int i; - ACPI_FUNCTION_TRACE("acpi_processor_get_performance_states"); status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PSS")); - return_VALUE(-ENODEV); + return -ENODEV; } pss = (union acpi_object *)buffer.pointer; @@ -299,7 +296,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) end: acpi_os_free(buffer.pointer); - return_VALUE(result); + return result; } 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_handle handle = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info"); if (!pr || !pr->performance || !pr->handle) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_get_handle(pr->handle, "_PCT", &handle); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI-based processor performance control unavailable\n")); - return_VALUE(-ENODEV); + return -ENODEV; } result = acpi_processor_get_performance_control(pr); if (result) - return_VALUE(result); + return result; result = acpi_processor_get_performance_states(pr); if (result) - return_VALUE(result); + return result; result = acpi_processor_get_platform_limit(pr); if (result) - return_VALUE(result); + return result; - return_VALUE(0); + return 0; } 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; static int is_done = 0; - ACPI_FUNCTION_TRACE("acpi_processor_notify_smm"); if (!(acpi_processor_ppc_status & PPC_REGISTERED)) - return_VALUE(-EBUSY); + return -EBUSY; if (!try_module_get(calling_module)) - return_VALUE(-EINVAL); + return -EINVAL; /* is_done is set to negative if an error occured, * and to postitive if _no_ error occured, but SMM @@ -355,10 +350,10 @@ int acpi_processor_notify_smm(struct module *calling_module) */ if (is_done > 0) { module_put(calling_module); - return_VALUE(0); + return 0; } else if (is_done < 0) { module_put(calling_module); - return_VALUE(is_done); + return is_done; } is_done = -EIO; @@ -367,7 +362,7 @@ int acpi_processor_notify_smm(struct module *calling_module) if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_cnt\n")); module_put(calling_module); - return_VALUE(0); + return 0; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -389,7 +384,7 @@ int acpi_processor_notify_smm(struct module *calling_module) "smi_cmd [0x%x]", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); module_put(calling_module); - return_VALUE(status); + return status; } /* 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) if (!(acpi_processor_ppc_status & PPC_IN_USE)) module_put(calling_module); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_processor_notify_smm); @@ -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; int i; - ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show"); if (!pr) goto end; @@ -444,7 +438,7 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) (u32) pr->performance->states[i].transition_latency); end: - return_VALUE(0); + return 0; } static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) @@ -466,23 +460,22 @@ acpi_processor_write_performance(struct file *file, unsigned int new_state = 0; struct cpufreq_policy policy; - ACPI_FUNCTION_TRACE("acpi_processor_write_performance"); if (!pr || (count > sizeof(state_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; perf = pr->performance; if (!perf) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(state_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; state_string[count] = '\0'; new_state = simple_strtoul(state_string, NULL, 0); if (new_state >= perf->state_count) - return_VALUE(-EINVAL); + return -EINVAL; cpufreq_get_policy(&policy, pr->id); @@ -492,9 +485,9 @@ acpi_processor_write_performance(struct file *file, result = cpufreq_set_policy(&policy); if (result) - return_VALUE(result); + return result; - return_VALUE(count); + return count; } 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 acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); if (acpi_bus_get_device(pr->handle, &device)) - return_VOID; + return; /* add file 'performance' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, @@ -517,23 +509,22 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr) entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VOID; + return; } static void acpi_cpufreq_remove_file(struct acpi_processor *pr) { struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); if (acpi_bus_get_device(pr->handle, &device)) - return_VOID; + return; /* remove file 'performance' */ remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, acpi_device_dir(device)); - return_VOID; + return; } #else @@ -777,22 +768,21 @@ acpi_processor_register_performance(struct acpi_processor_performance { struct acpi_processor *pr; - ACPI_FUNCTION_TRACE("acpi_processor_register_performance"); if (!(acpi_processor_ppc_status & PPC_REGISTERED)) - return_VALUE(-EINVAL); + return -EINVAL; mutex_lock(&performance_mutex); pr = processors[cpu]; if (!pr) { mutex_unlock(&performance_mutex); - return_VALUE(-ENODEV); + return -ENODEV; } if (pr->performance) { mutex_unlock(&performance_mutex); - return_VALUE(-EBUSY); + return -EBUSY; } WARN_ON(!performance); @@ -802,13 +792,13 @@ acpi_processor_register_performance(struct acpi_processor_performance if (acpi_processor_get_performance_info(pr)) { pr->performance = NULL; mutex_unlock(&performance_mutex); - return_VALUE(-EIO); + return -EIO; } acpi_cpufreq_add_file(pr); mutex_unlock(&performance_mutex); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_processor_register_performance); @@ -819,14 +809,13 @@ acpi_processor_unregister_performance(struct acpi_processor_performance { struct acpi_processor *pr; - ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); mutex_lock(&performance_mutex); pr = processors[cpu]; if (!pr) { mutex_unlock(&performance_mutex); - return_VOID; + return; } if (pr->performance) @@ -837,7 +826,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance mutex_unlock(&performance_mutex); - return_VOID; + return; } EXPORT_SYMBOL(acpi_processor_unregister_performance); diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 0f86d02..ef5e0f6 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -54,13 +54,12 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) u16 px = 0; u16 tx = 0; - ACPI_FUNCTION_TRACE("acpi_processor_apply_limit"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (!pr->flags.limit) - return_VALUE(-ENODEV); + return -ENODEV; if (pr->flags.throttling) { if (pr->limit.user.tx > tx) @@ -84,7 +83,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) if (result) printk(KERN_ERR PREFIX "Unable to set limit\n"); - return_VALUE(result); + return result; } #ifdef CONFIG_CPU_FREQ @@ -200,19 +199,18 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) struct acpi_device *device = NULL; int tx = 0, max_tx_px = 0; - ACPI_FUNCTION_TRACE("acpi_processor_set_thermal_limit"); if ((type < ACPI_PROCESSOR_LIMIT_NONE) || (type > ACPI_PROCESSOR_LIMIT_DECREMENT)) - return_VALUE(-EINVAL); + return -EINVAL; result = acpi_bus_get_device(handle, &device); if (result) - return_VALUE(result); + return result; pr = (struct acpi_processor *)acpi_driver_data(device); if (!pr) - return_VALUE(-ENODEV); + return -ENODEV; /* Thermal limits are always relative to the current Px/Tx state. */ if (pr->flags.throttling) @@ -296,22 +294,21 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) } else result = 0; if (max_tx_px) - return_VALUE(1); + return 1; else - return_VALUE(result); + return result; } int acpi_processor_get_limit_info(struct acpi_processor *pr) { - ACPI_FUNCTION_TRACE("acpi_processor_get_limit_info"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (pr->flags.throttling) pr->flags.limit = 1; - return_VALUE(0); + return 0; } /* /proc interface */ @@ -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; - ACPI_FUNCTION_TRACE("acpi_processor_limit_seq_show"); if (!pr) goto end; @@ -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); end: - return_VALUE(0); + return 0; } 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, int px = 0; int tx = 0; - ACPI_FUNCTION_TRACE("acpi_processor_write_limit"); if (!pr || (count > sizeof(limit_string) - 1)) { - return_VALUE(-EINVAL); + return -EINVAL; } if (copy_from_user(limit_string, buffer, count)) { - return_VALUE(-EFAULT); + return -EFAULT; } limit_string[count] = '\0'; if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { printk(KERN_ERR PREFIX "Invalid data format\n"); - return_VALUE(-EINVAL); + return -EINVAL; } if (pr->flags.throttling) { if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { printk(KERN_ERR PREFIX "Invalid tx\n"); - return_VALUE(-EINVAL); + return -EINVAL; } pr->limit.user.tx = tx; } result = acpi_processor_apply_limit(pr); - return_VALUE(count); + return count; } struct file_operations acpi_processor_limit_fops = { diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 2de40bd..d044ec5 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c @@ -55,13 +55,12 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) u32 duty_mask = 0; u32 duty_value = 0; - ACPI_FUNCTION_TRACE("acpi_processor_get_throttling"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (!pr->flags.throttling) - return_VALUE(-ENODEV); + return -ENODEV; pr->throttling.state = 0; @@ -93,7 +92,7 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) "Throttling state is T%d (%d%% throttling applied)\n", state, pr->throttling.states[state].performance)); - return_VALUE(0); + return 0; } 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_value = 0; - ACPI_FUNCTION_TRACE("acpi_processor_set_throttling"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if ((state < 0) || (state > (pr->throttling.state_count - 1))) - return_VALUE(-EINVAL); + return -EINVAL; if (!pr->flags.throttling) - return_VALUE(-ENODEV); + return -ENODEV; if (state == pr->throttling.state) - return_VALUE(0); + return 0; /* * Calculate the duty_value and duty_mask. @@ -165,7 +163,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) (pr->throttling.states[state].performance ? pr-> throttling.states[state].performance / 10 : 0))); - return_VALUE(0); + return 0; } 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 i = 0; - ACPI_FUNCTION_TRACE("acpi_processor_get_throttling_info"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "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) pr->throttling.duty_width)); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; /* TBD: Support ACPI 2.0 objects */ if (!pr->throttling.address) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); - return_VALUE(0); + return 0; } else if (!pr->throttling.duty_width) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); - return_VALUE(0); + return 0; } /* TBD: Support duty_cycle values that span bit 4. */ else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { 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) if (errata.piix4.throttle) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Throttling not supported on PIIX4 A- or B-step\n")); - return_VALUE(0); + return 0; } pr->throttling.state_count = 1 << acpi_fadt.duty_width; @@ -254,7 +251,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) if (result) pr->flags.throttling = 0; - return_VALUE(result); + return result; } /* proc interface */ @@ -266,7 +263,6 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, int i = 0; int result = 0; - ACPI_FUNCTION_TRACE("acpi_processor_throttling_seq_show"); if (!pr) goto end; @@ -296,7 +292,7 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, throttling.states[i].performance / 10 : 0)); end: - return_VALUE(0); + return 0; } static int acpi_processor_throttling_open_fs(struct inode *inode, @@ -315,13 +311,12 @@ static ssize_t acpi_processor_write_throttling(struct file * file, struct acpi_processor *pr = (struct acpi_processor *)m->private; char state_string[12] = { '\0' }; - ACPI_FUNCTION_TRACE("acpi_processor_write_throttling"); if (!pr || (count > sizeof(state_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(state_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; state_string[count] = '\0'; @@ -329,9 +324,9 @@ static ssize_t acpi_processor_write_throttling(struct file * file, simple_strtoul(state_string, NULL, 0)); if (result) - return_VALUE(result); + return result; - return_VALUE(count); + return count; } struct file_operations acpi_processor_throttling_fops = { diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 18c8e3e..a7b1fda 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -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) { - ACPI_FUNCTION_TRACE("acpi_bus_data_handler"); /* TBD */ - return_VOID; + return; } 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; u32 i = 0; - ACPI_FUNCTION_TRACE("acpi_bus_get_power_flags"); /* * Power Management Flags @@ -228,7 +226,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) device->power.state = ACPI_STATE_UNKNOWN; - return_VALUE(0); + return 0; } 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) struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *package = NULL; - ACPI_FUNCTION_TRACE("acpi_bus_get_wakeup_flags"); /* _PRW */ 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) end: if (ACPI_FAILURE(status)) 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) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_bus_driver_init"); if (!device || !driver) - return_VALUE(-EINVAL); + return -EINVAL; if (!driver->ops.add) - return_VALUE(-ENOSYS); + return -ENOSYS; result = driver->ops.add(device); if (result) { device->driver = NULL; acpi_driver_data(device) = NULL; - return_VALUE(result); + return result; } device->driver = driver; @@ -512,7 +508,7 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Driver successfully bound to device\n")); - return_VALUE(0); + return 0; } 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; struct acpi_driver *driver; - ACPI_FUNCTION_TRACE("acpi_start_single_object"); if (!(driver = device->driver)) - return_VALUE(0); + return 0; if (driver->ops.start) { result = driver->ops.start(device); @@ -531,14 +526,13 @@ static int acpi_start_single_object(struct acpi_device *device) driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL); } - return_VALUE(result); + return result; } static void acpi_driver_attach(struct acpi_driver *drv) { struct list_head *node, *next; - ACPI_FUNCTION_TRACE("acpi_driver_attach"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_device_list) { @@ -567,7 +561,6 @@ static void acpi_driver_detach(struct acpi_driver *drv) { struct list_head *node, *next; - ACPI_FUNCTION_TRACE("acpi_driver_detach"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_device_list) { @@ -597,17 +590,16 @@ static void acpi_driver_detach(struct acpi_driver *drv) */ int acpi_bus_register_driver(struct acpi_driver *driver) { - ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); if (acpi_disabled) - return_VALUE(-ENODEV); + return -ENODEV; spin_lock(&acpi_device_lock); list_add_tail(&driver->node, &acpi_bus_drivers); spin_unlock(&acpi_device_lock); acpi_driver_attach(driver); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_register_driver); @@ -645,7 +637,6 @@ static int acpi_bus_find_driver(struct acpi_device *device) int result = 0; struct list_head *node, *next; - ACPI_FUNCTION_TRACE("acpi_bus_find_driver"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_bus_drivers) { @@ -665,7 +656,7 @@ static int acpi_bus_find_driver(struct acpi_device *device) spin_unlock(&acpi_device_lock); Done: - return_VALUE(result); + return result; } /* -------------------------------------------------------------------------- @@ -677,7 +668,6 @@ static int acpi_bus_get_flags(struct acpi_device *device) acpi_status status = AE_OK; acpi_handle temp = NULL; - ACPI_FUNCTION_TRACE("acpi_bus_get_flags"); /* Presence of _STA indicates 'dynamic_status' */ status = acpi_get_handle(device->handle, "_STA", &temp); @@ -723,7 +713,7 @@ static int acpi_bus_get_flags(struct acpi_device *device) /* TBD: Peformance management */ - return_VALUE(0); + return 0; } 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) int result = 0; struct acpi_driver *driver; - ACPI_FUNCTION_TRACE("acpi_bus_remove"); if (!dev) - return_VALUE(-EINVAL); + return -EINVAL; driver = dev->driver; @@ -929,12 +918,12 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) if (driver->ops.stop) { result = driver->ops.stop(dev, ACPI_BUS_REMOVAL_EJECT); if (result) - return_VALUE(result); + return result; } result = dev->driver->ops.remove(dev, ACPI_BUS_REMOVAL_EJECT); if (result) { - return_VALUE(result); + return result; } atomic_dec(&dev->driver->references); @@ -943,7 +932,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) } if (!rmdevice) - return_VALUE(0); + return 0; if (dev->flags.bus_address) { if ((dev->parent) && (dev->parent->ops.unbind)) @@ -952,7 +941,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT); - return_VALUE(0); + return 0; } static int @@ -962,15 +951,14 @@ acpi_add_single_object(struct acpi_device **child, int result = 0; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_add_single_object"); if (!child) - return_VALUE(-EINVAL); + return -EINVAL; device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL); if (!device) { printk(KERN_ERR PREFIX "Memory allocation error\n"); - return_VALUE(-ENOMEM); + return -ENOMEM; } memset(device, 0, sizeof(struct acpi_device)); @@ -1095,7 +1083,7 @@ acpi_add_single_object(struct acpi_device **child, kfree(device); } - return_VALUE(result); + return result; } 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; u32 level = 1; - ACPI_FUNCTION_TRACE("acpi_bus_scan"); if (!start) - return_VALUE(-EINVAL); + return -EINVAL; parent = start; phandle = start->handle; @@ -1208,7 +1195,7 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) } } - return_VALUE(0); + return 0; } int @@ -1218,7 +1205,6 @@ acpi_bus_add(struct acpi_device **child, int result; struct acpi_bus_ops ops; - ACPI_FUNCTION_TRACE("acpi_bus_add"); result = acpi_add_single_object(child, parent, handle, type); if (!result) { @@ -1226,7 +1212,7 @@ acpi_bus_add(struct acpi_device **child, ops.acpi_op_add = 1; result = acpi_bus_scan(*child, &ops); } - return_VALUE(result); + return result; } EXPORT_SYMBOL(acpi_bus_add); @@ -1236,10 +1222,9 @@ int acpi_bus_start(struct acpi_device *device) int result; struct acpi_bus_ops ops; - ACPI_FUNCTION_TRACE("acpi_bus_start"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; result = acpi_start_single_object(device); if (!result) { @@ -1247,7 +1232,7 @@ int acpi_bus_start(struct acpi_device *device) ops.acpi_op_start = 1; result = acpi_bus_scan(device, &ops); } - return_VALUE(result); + return result; } EXPORT_SYMBOL(acpi_bus_start); @@ -1313,10 +1298,9 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) int result = 0; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed"); if (!root) - return_VALUE(-ENODEV); + return -ENODEV; /* * Enumerate all fixed-feature devices. @@ -1337,7 +1321,7 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) result = acpi_start_single_object(device); } - return_VALUE(result); + return result; } @@ -1439,10 +1423,9 @@ static int __init acpi_scan_init(void) int result; struct acpi_bus_ops ops; - ACPI_FUNCTION_TRACE("acpi_scan_init"); if (acpi_disabled) - return_VALUE(0); + return 0; kset_register(&acpi_namespace_kset); @@ -1487,7 +1470,7 @@ static int __init acpi_scan_init(void) acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); Done: - return_VALUE(result); + return result; } subsys_initcall(acpi_scan_init); diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 56a746b..c90bd2f 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c @@ -47,10 +47,9 @@ extern struct fadt_descriptor acpi_fadt; 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); - return_VALUE(0); + return 0; } static int acpi_system_info_open_fs(struct inode *inode, struct file *file) @@ -80,17 +79,16 @@ acpi_system_read_dsdt(struct file *file, struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; ssize_t res; - ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; res = simple_read_from_buffer(buffer, count, ppos, dsdt.pointer, dsdt.length); acpi_os_free(dsdt.pointer); - return_VALUE(res); + return res; } static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t, @@ -108,17 +106,16 @@ acpi_system_read_fadt(struct file *file, struct acpi_buffer fadt = { ACPI_ALLOCATE_BUFFER, NULL }; ssize_t res; - ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; res = simple_read_from_buffer(buffer, count, ppos, fadt.pointer, fadt.length); acpi_os_free(fadt.pointer); - return_VALUE(res); + return res; } static int __init acpi_system_init(void) @@ -127,10 +124,9 @@ static int __init acpi_system_init(void) int error = 0; char *name; - ACPI_FUNCTION_TRACE("acpi_system_init"); if (acpi_disabled) - return_VALUE(0); + return 0; /* 'info' [R] */ name = ACPI_SYSTEM_FILE_INFO; @@ -158,7 +154,7 @@ static int __init acpi_system_init(void) goto Error; Done: - return_VALUE(error); + return error; Error: remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 1b97549..c855f44 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -222,51 +222,48 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_thermal_get_temperature"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; tz->last_temperature = tz->temperature; status = acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", tz->temperature)); - return_VALUE(0); + return 0; } static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_thermal_get_polling_frequency"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_integer(tz->handle, "_TZP", NULL, &tz->polling_frequency); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", tz->polling_frequency)); - return_VALUE(0); + return 0; } static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) { - ACPI_FUNCTION_TRACE("acpi_thermal_set_polling"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; 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) "Polling frequency set to %lu seconds\n", tz->polling_frequency)); - return_VALUE(0); + return 0; } 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 }; acpi_handle handle = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_set_cooling_mode"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_get_handle(tz->handle, "_SCP", &handle); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); - return_VALUE(-ENODEV); + return -ENODEV; } arg0.integer.value = mode; status = acpi_evaluate_object(handle, NULL, &arg_list, NULL); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; tz->cooling_mode = mode; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", mode ? "passive" : "active")); - return_VALUE(0); + return 0; } 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; int i = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_get_trip_points"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; /* Critical Shutdown (required) */ @@ -326,7 +321,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) if (ACPI_FAILURE(status)) { tz->trips.critical.flags.valid = 0; ACPI_EXCEPTION((AE_INFO, status, "No critical threshold")); - return_VALUE(-ENODEV); + return -ENODEV; } else { tz->trips.critical.flags.valid = 1; ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -417,24 +412,23 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) "Invalid active threshold [%d]", i)); } - return_VALUE(0); + return 0; } static int acpi_thermal_get_devices(struct acpi_thermal *tz) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_thermal_get_devices"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; - return_VALUE(0); + return 0; } 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 *envp[3] = { NULL, NULL, NULL }; - ACPI_FUNCTION_TRACE("acpi_thermal_call_usermode"); if (!path) - return_VALUE(-EINVAL); + return -EINVAL; argv[0] = path; @@ -455,7 +448,7 @@ static int acpi_thermal_call_usermode(char *path) call_usermodehelper(argv[0], argv, envp, 0); - return_VALUE(0); + return 0; } 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; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_critical"); if (!tz || !tz->trips.critical.flags.valid) - return_VALUE(-EINVAL); + return -EINVAL; if (tz->temperature >= tz->trips.critical.temperature) { printk(KERN_WARNING PREFIX "Critical trip point\n"); @@ -476,7 +468,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) result = acpi_bus_get_device(tz->handle, &device); if (result) - return_VALUE(result); + return result; printk(KERN_EMERG "Critical temperature reached (%ld C), shutting down.\n", @@ -486,7 +478,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); - return_VALUE(0); + return 0; } 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; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_hot"); if (!tz || !tz->trips.hot.flags.valid) - return_VALUE(-EINVAL); + return -EINVAL; if (tz->temperature >= tz->trips.hot.temperature) { printk(KERN_WARNING PREFIX "Hot trip point\n"); @@ -507,14 +498,14 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) result = acpi_bus_get_device(tz->handle, &device); if (result) - return_VALUE(result); + return result; acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, tz->trips.hot.flags.enabled); /* TBD: Call user-mode "sleep(S4)" function */ - return_VALUE(0); + return 0; } 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 i = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_passive"); if (!tz || !tz->trips.passive.flags.valid) return; @@ -613,7 +603,6 @@ static void acpi_thermal_active(struct acpi_thermal *tz) int j = 0; unsigned long maxtemp = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_active"); if (!tz) return; @@ -695,18 +684,17 @@ static void acpi_thermal_check(void *data) int i = 0; struct acpi_thermal_state state; - ACPI_FUNCTION_TRACE("acpi_thermal_check"); if (!tz) { printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); - return_VOID; + return; } state = tz->state; result = acpi_thermal_get_temperature(tz); if (result) - return_VOID; + return; memset(&tz->state, 0, sizeof(tz->state)); @@ -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) { struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; - ACPI_FUNCTION_TRACE("acpi_thermal_state_seq_show"); if (!tz) goto end; @@ -831,7 +818,7 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) } end: - return_VALUE(0); + return 0; } 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) int result = 0; struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; - ACPI_FUNCTION_TRACE("acpi_thermal_temp_seq_show"); if (!tz) goto end; @@ -857,7 +843,7 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) KELVIN_TO_CELSIUS(tz->temperature)); end: - return_VALUE(0); + return 0; } 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) int i = 0; int j = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_trip_seq_show"); if (!tz) goto end; @@ -911,7 +896,7 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) } end: - return_VALUE(0); + return 0; } 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, int *active; int i = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points"); limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); if (!limit_string) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); if (!active) { kfree(limit_string); - return_VALUE(-ENOMEM); + return -ENOMEM; } if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { @@ -980,14 +964,13 @@ acpi_thermal_write_trip_points(struct file *file, end: kfree(active); kfree(limit_string); - return_VALUE(count); + return count; } static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) { struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; - ACPI_FUNCTION_TRACE("acpi_thermal_cooling_seq_show"); if (!tz) goto end; @@ -1003,7 +986,7 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) tz->cooling_mode ? "passive" : "active"); end: - return_VALUE(0); + return 0; } 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, int result = 0; char mode_string[12] = { '\0' }; - ACPI_FUNCTION_TRACE("acpi_thermal_write_cooling_mode"); if (!tz || (count > sizeof(mode_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; if (!tz->flags.cooling_mode) - return_VALUE(-ENODEV); + return -ENODEV; if (copy_from_user(mode_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; mode_string[count] = '\0'; @@ -1039,18 +1021,17 @@ acpi_thermal_write_cooling_mode(struct file *file, simple_strtoul(mode_string, NULL, 0)); if (result) - return_VALUE(result); + return result; acpi_thermal_check(tz); - return_VALUE(count); + return count; } static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) { struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; - ACPI_FUNCTION_TRACE("acpi_thermal_polling_seq_show"); if (!tz) goto end; @@ -1064,7 +1045,7 @@ static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) (tz->polling_frequency / 10)); end: - return_VALUE(0); + return 0; } static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) @@ -1084,13 +1065,12 @@ acpi_thermal_write_polling(struct file *file, char polling_string[12] = { '\0' }; int seconds = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_write_polling"); if (!tz || (count > sizeof(polling_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(polling_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; polling_string[count] = '\0'; @@ -1098,24 +1078,23 @@ acpi_thermal_write_polling(struct file *file, result = acpi_thermal_set_polling(tz, seconds); if (result) - return_VALUE(result); + return result; acpi_thermal_check(tz); - return_VALUE(count); + return count; } static int acpi_thermal_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_thermal_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } @@ -1123,7 +1102,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_thermal_state_fops; entry->data = acpi_driver_data(device); @@ -1134,7 +1113,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_thermal_temp_fops; entry->data = acpi_driver_data(device); @@ -1146,7 +1125,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_thermal_trip_fops; entry->data = acpi_driver_data(device); @@ -1158,7 +1137,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_thermal_cooling_fops; entry->data = acpi_driver_data(device); @@ -1170,19 +1149,18 @@ static int acpi_thermal_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_thermal_polling_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_thermal_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, @@ -1199,7 +1177,7 @@ static int acpi_thermal_remove_fs(struct acpi_device *device) 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) struct acpi_thermal *tz = (struct acpi_thermal *)data; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_notify"); if (!tz) - return_VOID; + return; if (acpi_bus_get_device(tz->handle, &device)) - return_VOID; + return; switch (event) { case ACPI_THERMAL_NOTIFY_TEMPERATURE: @@ -1239,27 +1216,26 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static int acpi_thermal_get_info(struct acpi_thermal *tz) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_get_info"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; /* Get temperature [_TMP] (required) */ result = acpi_thermal_get_temperature(tz); if (result) - return_VALUE(result); + return result; /* Get trip points [_CRT, _PSV, etc.] (required) */ result = acpi_thermal_get_trip_points(tz); if (result) - return_VALUE(result); + return result; /* Set the cooling mode [_SCP] to active cooling (default) */ 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) if (!result) tz->flags.devices = 1; - return_VALUE(0); + return 0; } 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; struct acpi_thermal *tz = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL); if (!tz) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(tz, 0, sizeof(struct acpi_thermal)); tz->handle = device->handle; @@ -1354,7 +1329,7 @@ static int acpi_thermal_add(struct acpi_device *device) kfree(tz); } - return_VALUE(result); + return result; } 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; struct acpi_thermal *tz = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; tz = (struct acpi_thermal *)acpi_driver_data(device); @@ -1396,7 +1370,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) acpi_thermal_remove_fs(device); kfree(tz); - return_VALUE(0); + return 0; } 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; if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; tz = (struct acpi_thermal *)acpi_driver_data(device); @@ -1417,31 +1391,29 @@ static int __init acpi_thermal_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_init"); acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); if (!acpi_thermal_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_thermal_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_thermal_driver); if (result < 0) { 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) { - ACPI_FUNCTION_TRACE("acpi_thermal_exit"); acpi_bus_unregister_driver(&acpi_thermal_driver); remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_thermal_init); diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index a5da4ef..1930e1a 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -58,22 +58,21 @@ acpi_extract_package(union acpi_object *package, u8 *head = NULL; u8 *tail = NULL; - ACPI_FUNCTION_TRACE("acpi_extract_package"); if (!package || (package->type != ACPI_TYPE_PACKAGE) || (package->package.count < 1)) { 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)) { printk(KERN_WARNING PREFIX "Invalid format argument\n"); - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; } if (!buffer) { 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; @@ -81,7 +80,7 @@ acpi_extract_package(union acpi_object *package, printk(KERN_WARNING PREFIX "Format specifies more objects [%d]" " than exist in package [%d].\n", format_count, package->package.count); - return_ACPI_STATUS(AE_BAD_DATA); + return AE_BAD_DATA; } format_string = (char *)format->pointer; @@ -94,7 +93,7 @@ acpi_extract_package(union acpi_object *package, union acpi_object *element = &(package->package.elements[i]); if (!element) { - return_ACPI_STATUS(AE_BAD_DATA); + return AE_BAD_DATA; } switch (element->type) { @@ -116,7 +115,7 @@ acpi_extract_package(union acpi_object *package, " [%d]: got number, expecing" " [%c]\n", i, format_string[i]); - return_ACPI_STATUS(AE_BAD_DATA); + return AE_BAD_DATA; break; } break; @@ -142,7 +141,7 @@ acpi_extract_package(union acpi_object *package, " [%d] got string/buffer," " expecing [%c]\n", i, format_string[i]); - return_ACPI_STATUS(AE_BAD_DATA); + return AE_BAD_DATA; break; } break; @@ -153,7 +152,7 @@ acpi_extract_package(union acpi_object *package, "Found unsupported element at index=%d\n", i)); /* TBD: handle nested packages... */ - return_ACPI_STATUS(AE_SUPPORT); + return AE_SUPPORT; break; } } @@ -163,9 +162,9 @@ acpi_extract_package(union acpi_object *package, */ if (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) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; } head = buffer->pointer; @@ -180,7 +179,7 @@ acpi_extract_package(union acpi_object *package, union acpi_object *element = &(package->package.elements[i]); if (!element) { - return_ACPI_STATUS(AE_BAD_DATA); + return AE_BAD_DATA; } switch (element->type) { @@ -245,7 +244,7 @@ acpi_extract_package(union acpi_object *package, } } - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_extract_package); @@ -259,14 +258,13 @@ acpi_evaluate_integer(acpi_handle handle, union acpi_object *element; struct acpi_buffer buffer = { 0, NULL }; - ACPI_FUNCTION_TRACE("acpi_evaluate_integer"); if (!data) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; element = kmalloc(sizeof(union acpi_object), GFP_KERNEL); if (!element) - return_ACPI_STATUS(AE_NO_MEMORY); + return AE_NO_MEMORY; memset(element, 0, sizeof(union acpi_object)); buffer.length = sizeof(union acpi_object); @@ -275,13 +273,13 @@ acpi_evaluate_integer(acpi_handle handle, if (ACPI_FAILURE(status)) { acpi_util_eval_error(handle, pathname, status); kfree(element); - return_ACPI_STATUS(status); + return status; } if (element->type != ACPI_TYPE_INTEGER) { acpi_util_eval_error(handle, pathname, AE_BAD_DATA); kfree(element); - return_ACPI_STATUS(AE_BAD_DATA); + return AE_BAD_DATA; } *data = element->integer.value; @@ -289,7 +287,7 @@ acpi_evaluate_integer(acpi_handle handle, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%lu]\n", *data)); - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_evaluate_integer); @@ -304,15 +302,14 @@ acpi_evaluate_string(acpi_handle handle, acpi_object *element = NULL; acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - ACPI_FUNCTION_TRACE("acpi_evaluate_string"); if (!data) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; status = acpi_evaluate_object(handle, pathname, arguments, &buffer); if (ACPI_FAILURE(status)) { acpi_util_eval_error(handle, pathname, status); - return_ACPI_STATUS(status); + return status; } element = (acpi_object *) buffer.pointer; @@ -321,13 +318,13 @@ acpi_evaluate_string(acpi_handle handle, || (element->type != ACPI_TYPE_BUFFER) || !element->string.length) { 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); if (!data) { printk(KERN_ERR PREFIX "Memory allocation\n"); - return_VALUE(-ENOMEM); + return -ENOMEM; } memset(*data, 0, element->string.length + 1); @@ -337,7 +334,7 @@ acpi_evaluate_string(acpi_handle handle, acpi_os_free(buffer.pointer); - return_ACPI_STATUS(AE_OK); + return AE_OK; } #endif @@ -353,10 +350,9 @@ acpi_evaluate_reference(acpi_handle handle, struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; u32 i = 0; - ACPI_FUNCTION_TRACE("acpi_evaluate_reference"); if (!list) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; } /* Evaluate object. */ @@ -390,7 +386,7 @@ acpi_evaluate_reference(acpi_handle handle, } if (package->package.count > ACPI_MAX_HANDLES) { - return_ACPI_STATUS(AE_NO_MEMORY); + return AE_NO_MEMORY; } list->count = package->package.count; @@ -424,7 +420,7 @@ acpi_evaluate_reference(acpi_handle handle, acpi_os_free(buffer.pointer); - return_ACPI_STATUS(status); + return status; } EXPORT_SYMBOL(acpi_evaluate_reference); diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index ca37da5..9feb633 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -272,10 +272,9 @@ static int acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) { int status; - ACPI_FUNCTION_TRACE("acpi_video_device_query"); status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state); - return_VALUE(status); + return status; } static int @@ -284,11 +283,10 @@ acpi_video_device_get_state(struct acpi_video_device *device, { int status; - ACPI_FUNCTION_TRACE("acpi_video_device_get_state"); status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state); - return_VALUE(status); + return status; } static int @@ -299,12 +297,11 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state) struct acpi_object_list args = { 1, &arg0 }; unsigned long ret; - ACPI_FUNCTION_TRACE("acpi_video_device_set_state"); arg0.integer.value = state; status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret); - return_VALUE(status); + return status; } static int @@ -315,13 +312,12 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *obj; - ACPI_FUNCTION_TRACE("acpi_video_device_lcd_query_levels"); *levels = NULL; status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer); if (!ACPI_SUCCESS(status)) - return_VALUE(status); + return status; obj = (union acpi_object *)buffer.pointer; if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { printk(KERN_ERR PREFIX "Invalid _BCL data\n"); @@ -331,12 +327,12 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, *levels = obj; - return_VALUE(0); + return 0; err: kfree(buffer.pointer); - return_VALUE(status); + return status; } static int @@ -346,13 +342,12 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list args = { 1, &arg0 }; - ACPI_FUNCTION_TRACE("acpi_video_device_lcd_set_level"); arg0.integer.value = level; status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL); printk(KERN_DEBUG "set_level status: %x\n", status); - return_VALUE(status); + return status; } static int @@ -360,11 +355,10 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, unsigned long *level) { int status; - ACPI_FUNCTION_TRACE("acpi_video_device_lcd_get_level_current"); status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); - return_VALUE(status); + return status; } static int @@ -377,22 +371,21 @@ acpi_video_device_EDID(struct acpi_video_device *device, union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list args = { 1, &arg0 }; - ACPI_FUNCTION_TRACE("acpi_video_device_get_EDID"); *edid = NULL; if (!device) - return_VALUE(-ENODEV); + return -ENODEV; if (length == 128) arg0.integer.value = 1; else if (length == 256) arg0.integer.value = 2; else - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; obj = (union acpi_object *)buffer.pointer; @@ -404,7 +397,7 @@ acpi_video_device_EDID(struct acpi_video_device *device, kfree(obj); } - return_VALUE(status); + return status; } /* bus */ @@ -417,7 +410,6 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list args = { 1, &arg0 }; - ACPI_FUNCTION_TRACE("acpi_video_bus_set_POST"); arg0.integer.value = option; @@ -425,7 +417,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) if (ACPI_SUCCESS(status)) status = tmp ? (-EINVAL) : (AE_OK); - return_VALUE(status); + return status; } static int @@ -433,11 +425,10 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id) { int status; - ACPI_FUNCTION_TRACE("acpi_video_bus_get_POST"); status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id); - return_VALUE(status); + return status; } static int @@ -445,12 +436,11 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video, unsigned long *options) { int status; - ACPI_FUNCTION_TRACE("acpi_video_bus_POST_options"); status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); *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) union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 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) { status = -1; @@ -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); Failed: - return_VALUE(status); + return status; } /* @@ -514,7 +503,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) union acpi_object *obj = NULL; struct acpi_video_device_brightness *br = NULL; - ACPI_FUNCTION_TRACE("acpi_video_device_find_cap"); memset(&device->cap, 0, 4); @@ -582,7 +570,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) kfree(obj); - return_VOID; + return; } /* @@ -629,10 +617,9 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) { acpi_status status = -ENOENT; - ACPI_FUNCTION_TRACE("acpi_video_bus_check"); if (!video) - return_VALUE(-EINVAL); + return -EINVAL; /* Since there is no HID, CID and so on for VGA driver, we have * to check well known required nodes. @@ -656,7 +643,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) 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) struct acpi_video_device *dev = (struct acpi_video_device *)seq->private; - ACPI_FUNCTION_TRACE("acpi_video_device_info_seq_show"); if (!dev) goto end; @@ -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"); end: - return_VALUE(0); + return 0; } static int @@ -708,7 +694,6 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) (struct acpi_video_device *)seq->private; unsigned long state; - ACPI_FUNCTION_TRACE("acpi_video_device_state_seq_show"); if (!dev) goto end; @@ -728,7 +713,7 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) seq_printf(seq, "\n"); end: - return_VALUE(0); + return 0; } static int @@ -749,13 +734,12 @@ acpi_video_device_write_state(struct file *file, char str[12] = { 0 }; u32 state = 0; - ACPI_FUNCTION_TRACE("acpi_video_device_write_state"); if (!dev || count + 1 > sizeof str) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(str, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; str[count] = 0; state = simple_strtoul(str, NULL, 0); @@ -764,9 +748,9 @@ acpi_video_device_write_state(struct file *file, status = acpi_video_device_set_state(dev, state); if (status) - return_VALUE(-EFAULT); + return -EFAULT; - return_VALUE(count); + return count; } static int @@ -776,11 +760,10 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset) (struct acpi_video_device *)seq->private; int i; - ACPI_FUNCTION_TRACE("acpi_video_device_brightness_seq_show"); if (!dev || !dev->brightness) { seq_printf(seq, "\n"); - return_VALUE(0); + return 0; } seq_printf(seq, "levels: "); @@ -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, "\ncurrent: %d\n", dev->brightness->curr); - return_VALUE(0); + return 0; } static int @@ -809,19 +792,18 @@ acpi_video_device_write_brightness(struct file *file, unsigned int level = 0; int i; - ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness"); if (!dev || !dev->brightness || count + 1 > sizeof str) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(str, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; str[count] = 0; level = simple_strtoul(str, NULL, 0); if (level > 100) - return_VALUE(-EFAULT); + return -EFAULT; /* validate though the list of available levels */ for (i = 0; i < dev->brightness->count; i++) @@ -832,7 +814,7 @@ acpi_video_device_write_brightness(struct file *file, break; } - return_VALUE(count); + return count; } 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; union acpi_object *edid = NULL; - ACPI_FUNCTION_TRACE("acpi_video_device_EDID_seq_show"); if (!dev) goto out; @@ -868,7 +849,7 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) else kfree(edid); - return_VALUE(0); + return 0; } static int @@ -883,27 +864,26 @@ static int acpi_video_device_add_fs(struct acpi_device *device) struct proc_dir_entry *entry = NULL; struct acpi_video_device *vid_dev; - ACPI_FUNCTION_TRACE("acpi_video_device_add_fs"); if (!device) - return_VALUE(-ENODEV); + return -ENODEV; vid_dev = (struct acpi_video_device *)acpi_driver_data(device); if (!vid_dev) - return_VALUE(-ENODEV); + return -ENODEV; if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), vid_dev->video->dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } /* 'info' [R] */ entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_video_device_info_fops; entry->data = acpi_driver_data(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, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { acpi_video_device_state_fops.write = acpi_video_device_write_state; entry->proc_fops = &acpi_video_device_state_fops; @@ -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, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; entry->proc_fops = &acpi_video_device_brightness_fops; @@ -939,24 +919,23 @@ static int acpi_video_device_add_fs(struct acpi_device *device) /* 'EDID' [R] */ entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_video_device_EDID_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_video_device_remove_fs(struct acpi_device *device) { struct acpi_video_device *vid_dev; - ACPI_FUNCTION_TRACE("acpi_video_device_remove_fs"); vid_dev = (struct acpi_video_device *)acpi_driver_data(device); if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) - return_VALUE(-ENODEV); + return -ENODEV; if (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) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* video bus */ @@ -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; - ACPI_FUNCTION_TRACE("acpi_video_bus_info_seq_show"); if (!video) goto end; @@ -988,7 +966,7 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset) video->flags.post ? "yes" : "no"); end: - return_VALUE(0); + return 0; } 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) { struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; - ACPI_FUNCTION_TRACE("acpi_video_bus_ROM_seq_show"); if (!video) goto end; @@ -1010,7 +987,7 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) seq_printf(seq, "\n"); end: - return_VALUE(0); + return 0; } 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) unsigned long options; int status; - ACPI_FUNCTION_TRACE("acpi_video_bus_POST_info_seq_show"); if (!video) goto end; @@ -1047,7 +1023,7 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) } else seq_printf(seq, "\n"); end: - return_VALUE(0); + return 0; } static int @@ -1063,7 +1039,6 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) int status; unsigned long id; - ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show"); if (!video) goto end; @@ -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]); end: - return_VALUE(0); + return 0; } 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; - ACPI_FUNCTION_TRACE("acpi_video_bus_DOS_seq_show"); 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) @@ -1112,22 +1086,21 @@ acpi_video_bus_write_POST(struct file *file, char str[12] = { 0 }; unsigned long opt, options; - ACPI_FUNCTION_TRACE("acpi_video_bus_write_POST"); if (!video || count + 1 > sizeof str) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_video_bus_POST_options(video, &options); if (!ACPI_SUCCESS(status)) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(str, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; str[count] = 0; opt = strtoul(str, NULL, 0); if (opt > 3) - return_VALUE(-EFAULT); + return -EFAULT; /* just in case an OEM 'forget' the motherboard... */ options |= 1; @@ -1135,11 +1108,11 @@ acpi_video_bus_write_POST(struct file *file, if (options & (1ul << opt)) { status = acpi_video_bus_set_POST(video, opt); if (!ACPI_SUCCESS(status)) - return_VALUE(-EFAULT); + return -EFAULT; } - return_VALUE(count); + return count; } static ssize_t @@ -1153,25 +1126,24 @@ acpi_video_bus_write_DOS(struct file *file, char str[12] = { 0 }; unsigned long opt; - ACPI_FUNCTION_TRACE("acpi_video_bus_write_DOS"); if (!video || count + 1 > sizeof str) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(str, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; str[count] = 0; opt = strtoul(str, NULL, 0); if (opt > 7) - return_VALUE(-EFAULT); + return -EFAULT; status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2); 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) @@ -1179,7 +1151,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) struct proc_dir_entry *entry = NULL; struct acpi_video_bus *video; - ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs"); video = (struct acpi_video_bus *)acpi_driver_data(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_video_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; video->dir = acpi_device_dir(device); acpi_device_dir(device)->owner = THIS_MODULE; } @@ -1195,7 +1166,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) /* 'info' [R] */ entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_video_bus_info_fops; entry->data = acpi_driver_data(device); @@ -1205,7 +1176,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) /* 'ROM' [R] */ entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_video_bus_ROM_fops; entry->data = acpi_driver_data(device); @@ -1216,7 +1187,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) entry = create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { entry->proc_fops = &acpi_video_bus_POST_info_fops; entry->data = acpi_driver_data(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, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; entry->proc_fops = &acpi_video_bus_POST_fops; @@ -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, acpi_device_dir(device)); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; else { acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; entry->proc_fops = &acpi_video_bus_DOS_fops; @@ -1249,14 +1220,13 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_video_bus_remove_fs(struct acpi_device *device) { struct acpi_video_bus *video; - ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs"); video = (struct acpi_video_bus *)acpi_driver_data(device); @@ -1270,7 +1240,7 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -1287,10 +1257,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device, int status; struct acpi_video_device *data; - ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); if (!device || !video) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); @@ -1298,7 +1267,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL); if (!data) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(data, 0, sizeof(struct acpi_video_device)); @@ -1349,10 +1318,10 @@ acpi_video_bus_get_one_device(struct acpi_device *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, struct acpi_video_device *device) { int i; - ACPI_FUNCTION_TRACE("acpi_video_device_bind"); #define IDS_VAL(i) video->attached_array[i].value.int_val #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) union acpi_object *dod = NULL; union acpi_object *obj; - ACPI_FUNCTION_TRACE("acpi_video_device_enumerate"); status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer); if (!ACPI_SUCCESS(status)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD")); - return_VALUE(status); + return status; } dod = (union acpi_object *)buffer.pointer; @@ -1484,7 +1451,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) video->attached_count = count; out: 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) unsigned long state; int status = 0; - ACPI_FUNCTION_TRACE("acpi_video_switch_output"); list_for_each_safe(node, next, &video->video_device_list) { 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) break; } - return_VALUE(status); + return status; } static int @@ -1567,7 +1533,6 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, int status = 0; struct list_head *node, *next; - ACPI_FUNCTION_TRACE("acpi_video_get_devices"); acpi_video_device_enumerate(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) @@ -1593,10 +1558,9 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) acpi_status status; struct acpi_video_bus *video; - ACPI_FUNCTION_TRACE("acpi_video_bus_put_one_device"); if (!device || !device->video) - return_VALUE(-ENOENT); + return -ENOENT; video = device->video; @@ -1609,7 +1573,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) ACPI_DEVICE_NOTIFY, acpi_video_device_notify); - return_VALUE(0); + return 0; } 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; struct list_head *node, *next; - ACPI_FUNCTION_TRACE("acpi_video_bus_put_devices"); list_for_each_safe(node, next, &video->video_device_list) { struct acpi_video_device *data = @@ -1636,7 +1599,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) kfree(data); } - return_VALUE(0); + return 0; } /* acpi_video interface */ @@ -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_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_video_bus_notify"); printk("video bus notify\n"); if (!video) - return_VOID; + return; if (acpi_bus_get_device(handle, &device)) - return_VOID; + return; switch (event) { 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) break; } - return_VOID; + return; } 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_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_video_device_notify"); printk("video device notify\n"); if (!video_device) - return_VOID; + return; if (acpi_bus_get_device(handle, &device)) - return_VOID; + return; switch (event) { 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) "Unsupported event [0x%x]\n", event)); break; } - return_VOID; + return; } 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; struct acpi_video_bus *video = NULL; - ACPI_FUNCTION_TRACE("acpi_video_bus_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; video = kmalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); if (!video) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(video, 0, sizeof(struct acpi_video_bus)); video->handle = device->handle; @@ -1791,7 +1751,7 @@ static int acpi_video_bus_add(struct acpi_device *device) if (result) kfree(video); - return_VALUE(result); + return result; } 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; struct acpi_video_bus *video = NULL; - ACPI_FUNCTION_TRACE("acpi_video_bus_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; 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) kfree(video->attached_array); kfree(video); - return_VALUE(0); + return 0; } static int @@ -1828,10 +1787,9 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver) acpi_handle h_dummy2; acpi_handle h_dummy3; - ACPI_FUNCTION_TRACE("acpi_video_bus_match"); if (!device || !driver) - return_VALUE(-EINVAL); + return -EINVAL; /* Since there is no HID, CID for ACPI Video drivers, we have * 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) /* Does this device able to support video switching ? */ if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) && ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) - return_VALUE(0); + return 0; /* Does this device able to retrieve a video ROM ? */ 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 ? */ 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, "_SPD", &h_dummy3))) - return_VALUE(0); + return 0; - return_VALUE(-ENODEV); + return -ENODEV; } static int __init acpi_video_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_video_init"); /* acpi_dbg_level = 0xFFFFFFFF; @@ -1868,27 +1825,26 @@ static int __init acpi_video_init(void) acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); if (!acpi_video_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_video_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_video_bus); if (result < 0) { 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) { - ACPI_FUNCTION_TRACE("acpi_video_exit"); acpi_bus_unregister_driver(&acpi_video_bus); remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_video_init); -- cgit v0.10.2 From e8406b4485730031d91872086456bd052948686b Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Fri, 2 Jun 2006 15:58:00 -0400 Subject: [ACPI] Print error message if remove/install notify handler fails Signed-off-by: Thomas Renniger Signed-off-by: Len Brown diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 76c34a6..4f948df 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -414,12 +414,13 @@ acpi_remove_notify_handler(acpi_handle device, if ((!device) || (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + status = AE_BAD_PARAMETER; + goto exit; } status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Convert and validate the device handle */ @@ -427,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device, node = acpi_ns_map_handle_to_node(device); if (!node) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Root Object */ @@ -441,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device, ((handler_type & ACPI_DEVICE_NOTIFY) && !acpi_gbl_device_notify.handler)) { status = AE_NOT_EXIST; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -450,7 +451,7 @@ acpi_remove_notify_handler(acpi_handle device, acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } if (handler_type & ACPI_SYSTEM_NOTIFY) { @@ -473,7 +474,7 @@ acpi_remove_notify_handler(acpi_handle device, if (!acpi_ev_is_notify_object(node)) { status = AE_TYPE; - goto unlock_and_exit; + goto unlock; } /* Check for an existing internal object */ @@ -481,7 +482,7 @@ acpi_remove_notify_handler(acpi_handle device, obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { status = AE_NOT_EXIST; - goto unlock_and_exit; + goto unlock; } /* Object exists - make sure there's an existing handler */ @@ -491,7 +492,7 @@ acpi_remove_notify_handler(acpi_handle device, if ((!notify_obj) || (notify_obj->notify.handler != handler)) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -499,7 +500,7 @@ acpi_remove_notify_handler(acpi_handle device, acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Remove the handler */ @@ -512,7 +513,7 @@ acpi_remove_notify_handler(acpi_handle device, if ((!notify_obj) || (notify_obj->notify.handler != handler)) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -520,7 +521,7 @@ acpi_remove_notify_handler(acpi_handle device, acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Remove the handler */ @@ -529,8 +530,11 @@ acpi_remove_notify_handler(acpi_handle device, } } - unlock_and_exit: +unlock: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); +exit: + if (ACPI_FAILURE(status)) + ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); return_ACPI_STATUS(status); } @@ -568,12 +572,13 @@ acpi_install_gpe_handler(acpi_handle gpe_device, /* Parameter validation */ if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + status = AE_BAD_PARAMETER; + goto exit; } status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Ensure that we have a valid GPE number */ @@ -581,7 +586,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure that there isn't a handler there already */ @@ -589,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { status = AE_ALREADY_EXISTS; - goto unlock_and_exit; + goto unlock; } /* Allocate and init handler object */ @@ -597,7 +602,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); if (!handler) { status = AE_NO_MEMORY; - goto unlock_and_exit; + goto unlock; } handler->address = address; @@ -608,7 +613,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - goto unlock_and_exit; + goto unlock; } /* Install the handler */ @@ -623,8 +628,12 @@ acpi_install_gpe_handler(acpi_handle gpe_device, acpi_os_release_lock(acpi_gbl_gpe_lock, flags); - unlock_and_exit: +unlock: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); +exit: + if (ACPI_FAILURE(status)) + ACPI_EXCEPTION((AE_INFO, status, + "Installing notify handler failed")); return_ACPI_STATUS(status); } -- cgit v0.10.2 From 5e7d8818114f08ad9078d2c1a8a88d78d49de8dc Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sat, 24 Jun 2006 19:36:00 -0400 Subject: ACPI: asus_acpi_init: propagate correct return value Cc: Bjorn Helgaas Acked-by: Francois Romieu Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 839f423..055cfd5 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c @@ -1232,7 +1232,7 @@ static int __init asus_acpi_init(void) result = acpi_bus_register_driver(&asus_hotk_driver); if (result < 0) { remove_proc_entry(PROC_ASUS, acpi_root_dir); - return -ENODEV; + return result; } /* -- cgit v0.10.2 From a6a888b3c20cf559c8a2e6e4d86c570dda2ef0f5 Mon Sep 17 00:00:00 2001 From: Kristen Accardi Date: Sat, 24 Jun 2006 19:36:00 -0400 Subject: KEVENT: add new uevent for dock so that userspace can be notified of dock and undock events. Signed-off-by: Kristen Carlson Accardi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 2d22932..0503b2e 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -46,6 +46,8 @@ enum kobject_action { KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */ KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */ KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */ + KOBJ_UNDOCK = (__force kobject_action_t) 0x08, /* undocking */ + KOBJ_DOCK = (__force kobject_action_t) 0x09, /* dock */ }; struct kobject { diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 7f20e7b..2b1530f 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -50,6 +50,10 @@ static char *action_to_string(enum kobject_action action) return "offline"; case KOBJ_ONLINE: return "online"; + case KOBJ_DOCK: + return "dock"; + case KOBJ_UNDOCK: + return "undock"; default: return NULL; } -- cgit v0.10.2 From a5e1b94008f2a96abf4a0c0371a55a56b320c13e Mon Sep 17 00:00:00 2001 From: Kristen Accardi Date: Wed, 28 Jun 2006 03:07:16 -0400 Subject: ACPI: dock driver Create a driver which lives in the acpi subsystem to handle dock events. This driver is not an "ACPI" driver, because acpi drivers require that the object be present when the driver is loaded. Signed-off-by: Kristen Carlson Accardi Cc: Dave Hansen Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 94b8d82..ce15aed 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -133,6 +133,13 @@ config ACPI_FAN This driver adds support for ACPI fan devices, allowing user-mode applications to perform basic fan control (on, off, status). +config ACPI_DOCK + tristate "Dock" + depends on !ACPI_IBM_DOCK + default y + help + This driver adds support for ACPI controlled docking stations + config ACPI_PROCESSOR tristate "Processor" default y diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 5984b4f..f0a68ec 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -42,6 +42,7 @@ obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_BUTTON) += button.o obj-$(CONFIG_ACPI_EC) += ec.o obj-$(CONFIG_ACPI_FAN) += fan.o +obj-$(CONFIG_ACPI_DOCK) += dock.o obj-$(CONFIG_ACPI_VIDEO) += video.o obj-$(CONFIG_ACPI_HOTKEY) += hotkey.o obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c new file mode 100644 index 0000000..510a945 --- /dev/null +++ b/drivers/acpi/dock.c @@ -0,0 +1,739 @@ +/* + * dock.c - ACPI dock station driver + * + * Copyright (C) 2006 Kristen Carlson Accardi + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#include +#include +#include +#include +#include +#include +#include + +#define ACPI_DOCK_DRIVER_NAME "ACPI Dock Station Driver" + +ACPI_MODULE_NAME("dock") +MODULE_AUTHOR("Kristen Carlson Accardi"); +MODULE_DESCRIPTION(ACPI_DOCK_DRIVER_NAME); +MODULE_LICENSE("GPL"); + +static struct atomic_notifier_head dock_notifier_list; + +struct dock_station { + acpi_handle handle; + unsigned long last_dock_time; + u32 flags; + spinlock_t dd_lock; + spinlock_t hp_lock; + struct list_head dependent_devices; + struct list_head hotplug_devices; +}; + +struct dock_dependent_device { + struct list_head list; + struct list_head hotplug_list; + acpi_handle handle; + acpi_notify_handler handler; + void *context; +}; + +#define DOCK_DOCKING 0x00000001 +#define DOCK_EVENT KOBJ_DOCK +#define UNDOCK_EVENT KOBJ_UNDOCK + +static struct dock_station *dock_station; + +/***************************************************************************** + * Dock Dependent device functions * + *****************************************************************************/ +/** + * alloc_dock_dependent_device - allocate and init a dependent device + * @handle: the acpi_handle of the dependent device + * + * Allocate memory for a dependent device structure for a device referenced + * by the acpi handle + */ +static struct dock_dependent_device * +alloc_dock_dependent_device(acpi_handle handle) +{ + struct dock_dependent_device *dd; + + dd = kzalloc(sizeof(*dd), GFP_KERNEL); + if (dd) { + dd->handle = handle; + INIT_LIST_HEAD(&dd->list); + INIT_LIST_HEAD(&dd->hotplug_list); + } + return dd; +} + +/** + * add_dock_dependent_device - associate a device with the dock station + * @ds: The dock station + * @dd: The dependent device + * + * Add the dependent device to the dock's dependent device list. + */ +static void +add_dock_dependent_device(struct dock_station *ds, + struct dock_dependent_device *dd) +{ + spin_lock(&ds->dd_lock); + list_add_tail(&dd->list, &ds->dependent_devices); + spin_unlock(&ds->dd_lock); +} + +/** + * dock_add_hotplug_device - associate a hotplug handler with the dock station + * @ds: The dock station + * @dd: The dependent device struct + * + * Add the dependent device to the dock's hotplug device list + */ +static void +dock_add_hotplug_device(struct dock_station *ds, + struct dock_dependent_device *dd) +{ + spin_lock(&ds->hp_lock); + list_add_tail(&dd->hotplug_list, &ds->hotplug_devices); + spin_unlock(&ds->hp_lock); +} + +/** + * dock_del_hotplug_device - remove a hotplug handler from the dock station + * @ds: The dock station + * @dd: the dependent device struct + * + * Delete the dependent device from the dock's hotplug device list + */ +static void +dock_del_hotplug_device(struct dock_station *ds, + struct dock_dependent_device *dd) +{ + spin_lock(&ds->hp_lock); + list_del(&dd->hotplug_list); + spin_unlock(&ds->hp_lock); +} + +/** + * find_dock_dependent_device - get a device dependent on this dock + * @ds: the dock station + * @handle: the acpi_handle of the device we want + * + * iterate over the dependent device list for this dock. If the + * dependent device matches the handle, return. + */ +static struct dock_dependent_device * +find_dock_dependent_device(struct dock_station *ds, acpi_handle handle) +{ + struct dock_dependent_device *dd; + + spin_lock(&ds->dd_lock); + list_for_each_entry(dd, &ds->dependent_devices, list) { + if (handle == dd->handle) { + spin_unlock(&ds->dd_lock); + return dd; + } + } + spin_unlock(&ds->dd_lock); + return NULL; +} + +/***************************************************************************** + * Dock functions * + *****************************************************************************/ +/** + * is_dock - see if a device is a dock station + * @handle: acpi handle of the device + * + * If an acpi object has a _DCK method, then it is by definition a dock + * station, so return true. + */ +static int is_dock(acpi_handle handle) +{ + acpi_status status; + acpi_handle tmp; + + status = acpi_get_handle(handle, "_DCK", &tmp); + if (ACPI_FAILURE(status)) + return 0; + return 1; +} + +/** + * is_dock_device - see if a device is on a dock station + * @handle: acpi handle of the device + * + * If this device is either the dock station itself, + * or is a device dependent on the dock station, then it + * is a dock device + */ +int is_dock_device(acpi_handle handle) +{ + if (!dock_station) + return 0; + + if (is_dock(handle) || find_dock_dependent_device(dock_station, handle)) + return 1; + + return 0; +} + +EXPORT_SYMBOL_GPL(is_dock_device); + +/** + * dock_present - see if the dock station is present. + * @ds: the dock station + * + * execute the _STA method. note that present does not + * imply that we are docked. + */ +static int dock_present(struct dock_station *ds) +{ + unsigned long sta; + acpi_status status; + + if (ds) { + status = acpi_evaluate_integer(ds->handle, "_STA", NULL, &sta); + if (ACPI_SUCCESS(status) && sta) + return 1; + } + return 0; +} + + + +/** + * dock_create_acpi_device - add new devices to acpi + * @handle - handle of the device to add + * + * This function will create a new acpi_device for the given + * handle if one does not exist already. This should cause + * acpi to scan for drivers for the given devices, and call + * matching driver's add routine. + * + * Returns a pointer to the acpi_device corresponding to the handle. + */ +static struct acpi_device * dock_create_acpi_device(acpi_handle handle) +{ + struct acpi_device *device = NULL; + struct acpi_device *parent_device; + acpi_handle parent; + int ret; + + if (acpi_bus_get_device(handle, &device)) { + /* + * no device created for this object, + * so we should create one. + */ + acpi_get_parent(handle, &parent); + if (acpi_bus_get_device(parent, &parent_device)) + parent_device = NULL; + + ret = acpi_bus_add(&device, parent_device, handle, + ACPI_BUS_TYPE_DEVICE); + if (ret) { + pr_debug("error adding bus, %x\n", + -ret); + return NULL; + } + } + return device; +} + +/** + * dock_remove_acpi_device - remove the acpi_device struct from acpi + * @handle - the handle of the device to remove + * + * Tell acpi to remove the acpi_device. This should cause any loaded + * driver to have it's remove routine called. + */ +static void dock_remove_acpi_device(acpi_handle handle) +{ + struct acpi_device *device; + int ret; + + if (!acpi_bus_get_device(handle, &device)) { + ret = acpi_bus_trim(device, 1); + if (ret) + pr_debug("error removing bus, %x\n", -ret); + } +} + + +/** + * hotplug_dock_devices - insert or remove devices on the dock station + * @ds: the dock station + * @event: either bus check or eject request + * + * Some devices on the dock station need to have drivers called + * to perform hotplug operations after a dock event has occurred. + * Traverse the list of dock devices that have registered a + * hotplug handler, and call the handler. + */ +static void hotplug_dock_devices(struct dock_station *ds, u32 event) +{ + struct dock_dependent_device *dd; + + spin_lock(&ds->hp_lock); + + /* + * First call driver specific hotplug functions + */ + list_for_each_entry(dd, &ds->hotplug_devices, hotplug_list) { + if (dd->handler) + dd->handler(dd->handle, event, dd->context); + } + + /* + * Now make sure that an acpi_device is created for each + * dependent device, or removed if this is an eject request. + * This will cause acpi_drivers to be stopped/started if they + * exist + */ + list_for_each_entry(dd, &ds->dependent_devices, list) { + if (event == ACPI_NOTIFY_EJECT_REQUEST) + dock_remove_acpi_device(dd->handle); + else + dock_create_acpi_device(dd->handle); + } + spin_unlock(&ds->hp_lock); +} + +static void dock_event(struct dock_station *ds, u32 event, int num) +{ + struct acpi_device *device; + + device = dock_create_acpi_device(ds->handle); + if (device) + kobject_uevent(&device->kobj, num); +} + +/** + * eject_dock - respond to a dock eject request + * @ds: the dock station + * + * This is called after _DCK is called, to execute the dock station's + * _EJ0 method. + */ +static void eject_dock(struct dock_station *ds) +{ + struct acpi_object_list arg_list; + union acpi_object arg; + acpi_status status; + acpi_handle tmp; + + /* all dock devices should have _EJ0, but check anyway */ + status = acpi_get_handle(ds->handle, "_EJ0", &tmp); + if (ACPI_FAILURE(status)) { + pr_debug("No _EJ0 support for dock device\n"); + return; + } + + arg_list.count = 1; + arg_list.pointer = &arg; + arg.type = ACPI_TYPE_INTEGER; + arg.integer.value = 1; + + if (ACPI_FAILURE(acpi_evaluate_object(ds->handle, "_EJ0", + &arg_list, NULL))) + pr_debug("Failed to evaluate _EJ0!\n"); +} + +/** + * handle_dock - handle a dock event + * @ds: the dock station + * @dock: to dock, or undock - that is the question + * + * Execute the _DCK method in response to an acpi event + */ +static void handle_dock(struct dock_station *ds, int dock) +{ + acpi_status status; + struct acpi_object_list arg_list; + union acpi_object arg; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *obj; + + acpi_get_name(ds->handle, ACPI_FULL_PATHNAME, &name_buffer); + obj = name_buffer.pointer; + + printk(KERN_INFO PREFIX "%s\n", dock ? "docking" : "undocking"); + + /* _DCK method has one argument */ + arg_list.count = 1; + arg_list.pointer = &arg; + arg.type = ACPI_TYPE_INTEGER; + arg.integer.value = dock; + status = acpi_evaluate_object(ds->handle, "_DCK", &arg_list, &buffer); + if (ACPI_FAILURE(status)) + pr_debug("%s: failed to execute _DCK\n", obj->string.pointer); + kfree(buffer.pointer); + kfree(name_buffer.pointer); +} + +static inline void dock(struct dock_station *ds) +{ + handle_dock(ds, 1); +} + +static inline void undock(struct dock_station *ds) +{ + handle_dock(ds, 0); +} + +static inline void begin_dock(struct dock_station *ds) +{ + ds->flags |= DOCK_DOCKING; +} + +static inline void complete_dock(struct dock_station *ds) +{ + ds->flags &= ~(DOCK_DOCKING); + ds->last_dock_time = jiffies; +} + +/** + * dock_in_progress - see if we are in the middle of handling a dock event + * @ds: the dock station + * + * Sometimes while docking, false dock events can be sent to the driver + * because good connections aren't made or some other reason. Ignore these + * if we are in the middle of doing something. + */ +static int dock_in_progress(struct dock_station *ds) +{ + if ((ds->flags & DOCK_DOCKING) || + time_before(jiffies, (ds->last_dock_time + HZ))) + return 1; + return 0; +} + +/** + * register_dock_notifier - add yourself to the dock notifier list + * @nb: the callers notifier block + * + * If a driver wishes to be notified about dock events, they can + * use this function to put a notifier block on the dock notifier list. + * this notifier call chain will be called after a dock event, but + * before hotplugging any new devices. + */ +int register_dock_notifier(struct notifier_block *nb) +{ + return atomic_notifier_chain_register(&dock_notifier_list, nb); +} + +EXPORT_SYMBOL_GPL(register_dock_notifier); + +/** + * unregister_dock_notifier - remove yourself from the dock notifier list + * @nb: the callers notifier block + */ +void unregister_dock_notifier(struct notifier_block *nb) +{ + atomic_notifier_chain_unregister(&dock_notifier_list, nb); +} + +EXPORT_SYMBOL_GPL(unregister_dock_notifier); + +/** + * register_hotplug_dock_device - register a hotplug function + * @handle: the handle of the device + * @handler: the acpi_notifier_handler to call after docking + * @context: device specific data + * + * If a driver would like to perform a hotplug operation after a dock + * event, they can register an acpi_notifiy_handler to be called by + * the dock driver after _DCK is executed. + */ +int +register_hotplug_dock_device(acpi_handle handle, acpi_notify_handler handler, + void *context) +{ + struct dock_dependent_device *dd; + + if (!dock_station) + return -ENODEV; + + /* + * make sure this handle is for a device dependent on the dock, + * this would include the dock station itself + */ + dd = find_dock_dependent_device(dock_station, handle); + if (dd) { + dd->handler = handler; + dd->context = context; + dock_add_hotplug_device(dock_station, dd); + return 0; + } + + return -EINVAL; +} + +EXPORT_SYMBOL_GPL(register_hotplug_dock_device); + +/** + * unregister_hotplug_dock_device - remove yourself from the hotplug list + * @handle: the acpi handle of the device + */ +void unregister_hotplug_dock_device(acpi_handle handle) +{ + struct dock_dependent_device *dd; + + if (!dock_station) + return; + + dd = find_dock_dependent_device(dock_station, handle); + if (dd) + dock_del_hotplug_device(dock_station, dd); +} + +EXPORT_SYMBOL_GPL(unregister_hotplug_dock_device); + +/** + * dock_notify - act upon an acpi dock notification + * @handle: the dock station handle + * @event: the acpi event + * @data: our driver data struct + * + * If we are notified to dock, then check to see if the dock is + * present and then dock. Notify all drivers of the dock event, + * and then hotplug and devices that may need hotplugging. For undock + * check to make sure the dock device is still present, then undock + * and hotremove all the devices that may need removing. + */ +static void dock_notify(acpi_handle handle, u32 event, void *data) +{ + struct dock_station *ds = (struct dock_station *)data; + + switch (event) { + case ACPI_NOTIFY_BUS_CHECK: + if (!dock_in_progress(ds) && dock_present(ds)) { + begin_dock(ds); + dock(ds); + if (!dock_present(ds)) { + printk(KERN_ERR PREFIX "Unable to dock!\n"); + break; + } + atomic_notifier_call_chain(&dock_notifier_list, + event, NULL); + hotplug_dock_devices(ds, event); + complete_dock(ds); + dock_event(ds, event, DOCK_EVENT); + } + break; + case ACPI_NOTIFY_DEVICE_CHECK: + /* + * According to acpi spec 3.0a, if a DEVICE_CHECK notification + * is sent and _DCK is present, it is assumed to mean an + * undock request. This notify routine will only be called + * for objects defining _DCK, so we will fall through to eject + * request here. However, we will pass an eject request through + * to the driver who wish to hotplug. + */ + case ACPI_NOTIFY_EJECT_REQUEST: + if (!dock_in_progress(ds) && dock_present(ds)) { + /* + * here we need to generate the undock + * event prior to actually doing the undock + * so that the device struct still exists. + */ + dock_event(ds, event, UNDOCK_EVENT); + hotplug_dock_devices(ds, ACPI_NOTIFY_EJECT_REQUEST); + undock(ds); + eject_dock(ds); + if (dock_present(ds)) + printk(KERN_ERR PREFIX "Unable to undock!\n"); + } + break; + default: + printk(KERN_ERR PREFIX "Unknown dock event %d\n", event); + } +} + +/** + * find_dock_devices - find devices on the dock station + * @handle: the handle of the device we are examining + * @lvl: unused + * @context: the dock station private data + * @rv: unused + * + * This function is called by acpi_walk_namespace. It will + * check to see if an object has an _EJD method. If it does, then it + * will see if it is dependent on the dock station. + */ +static acpi_status +find_dock_devices(acpi_handle handle, u32 lvl, void *context, void **rv) +{ + acpi_status status; + acpi_handle tmp; + struct dock_station *ds = (struct dock_station *)context; + struct dock_dependent_device *dd; + + status = acpi_bus_get_ejd(handle, &tmp); + if (ACPI_FAILURE(status)) + return AE_OK; + + if (tmp == ds->handle) { + dd = alloc_dock_dependent_device(handle); + if (dd) + add_dock_dependent_device(ds, dd); + } + + return AE_OK; +} + +/** + * dock_add - add a new dock station + * @handle: the dock station handle + * + * allocated and initialize a new dock station device. Find all devices + * that are on the dock station, and register for dock event notifications. + */ +static int dock_add(acpi_handle handle) +{ + int ret; + acpi_status status; + struct dock_dependent_device *dd; + + /* allocate & initialize the dock_station private data */ + dock_station = kzalloc(sizeof(*dock_station), GFP_KERNEL); + if (!dock_station) + return -ENOMEM; + dock_station->handle = handle; + dock_station->last_dock_time = jiffies - HZ; + INIT_LIST_HEAD(&dock_station->dependent_devices); + INIT_LIST_HEAD(&dock_station->hotplug_devices); + spin_lock_init(&dock_station->dd_lock); + spin_lock_init(&dock_station->hp_lock); + + /* Find dependent devices */ + acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, find_dock_devices, dock_station, + NULL); + + /* add the dock station as a device dependent on itself */ + dd = alloc_dock_dependent_device(handle); + if (!dd) { + kfree(dock_station); + return -ENOMEM; + } + add_dock_dependent_device(dock_station, dd); + + /* register for dock events */ + status = acpi_install_notify_handler(dock_station->handle, + ACPI_SYSTEM_NOTIFY, + dock_notify, dock_station); + + if (ACPI_FAILURE(status)) { + printk(KERN_ERR PREFIX "Error installing notify handler\n"); + ret = -ENODEV; + goto dock_add_err; + } + + printk(KERN_INFO PREFIX "%s \n", ACPI_DOCK_DRIVER_NAME); + + return 0; + +dock_add_err: + kfree(dock_station); + kfree(dd); + return ret; +} + +/** + * dock_remove - free up resources related to the dock station + */ +static int dock_remove(void) +{ + struct dock_dependent_device *dd, *tmp; + acpi_status status; + + if (!dock_station) + return 0; + + /* remove dependent devices */ + list_for_each_entry_safe(dd, tmp, &dock_station->dependent_devices, + list) + kfree(dd); + + /* remove dock notify handler */ + status = acpi_remove_notify_handler(dock_station->handle, + ACPI_SYSTEM_NOTIFY, + dock_notify); + if (ACPI_FAILURE(status)) + printk(KERN_ERR "Error removing notify handler\n"); + + /* free dock station memory */ + kfree(dock_station); + return 0; +} + +/** + * find_dock - look for a dock station + * @handle: acpi handle of a device + * @lvl: unused + * @context: counter of dock stations found + * @rv: unused + * + * This is called by acpi_walk_namespace to look for dock stations. + */ +static acpi_status +find_dock(acpi_handle handle, u32 lvl, void *context, void **rv) +{ + int *count = (int *)context; + acpi_status status = AE_OK; + + if (is_dock(handle)) { + if (dock_add(handle) >= 0) { + (*count)++; + status = AE_CTRL_TERMINATE; + } + } + return status; +} + +static int __init dock_init(void) +{ + int num = 0; + + dock_station = NULL; + + /* look for a dock station */ + acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, find_dock, &num, NULL); + + if (!num) + return -ENODEV; + + return 0; +} + +static void __exit dock_exit(void) +{ + dock_remove(); +} + +postcore_initcall(dock_init); +module_exit(dock_exit); diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index a7b1fda..401e723 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -663,6 +663,29 @@ static int acpi_bus_find_driver(struct acpi_device *device) Device Enumeration -------------------------------------------------------------------------- */ +acpi_status +acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) +{ + acpi_status status; + acpi_handle tmp; + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + union acpi_object *obj; + + status = acpi_get_handle(handle, "_EJD", &tmp); + if (ACPI_FAILURE(status)) + return status; + + status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer); + if (ACPI_SUCCESS(status)) { + obj = buffer.pointer; + status = acpi_get_handle(NULL, obj->string.pointer, ejd); + kfree(buffer.pointer); + } + return status; +} +EXPORT_SYMBOL_GPL(acpi_bus_get_ejd); + + static int acpi_bus_get_flags(struct acpi_device *device) { acpi_status status = AE_OK; diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index a2b3e39..f338e40 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -334,7 +334,7 @@ int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, acpi_handle handle, int type); int acpi_bus_trim(struct acpi_device *start, int rmdevice); int acpi_bus_start(struct acpi_device *device); - +acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd); int acpi_match_ids(struct acpi_device *device, char *ids); int acpi_create_dir(struct acpi_device *); void acpi_remove_dir(struct acpi_device *); diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index b425f9b..6a5bdce 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -110,4 +110,21 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type); extern int acpi_specific_hotkey_enabled; +/*-------------------------------------------------------------------------- + Dock Station + -------------------------------------------------------------------------- */ +#if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE) +extern int is_dock_device(acpi_handle handle); +extern int register_dock_notifier(struct notifier_block *nb); +extern void unregister_dock_notifier(struct notifier_block *nb); +extern int register_hotplug_dock_device(acpi_handle handle, + acpi_notify_handler handler, void *context); +extern void unregister_hotplug_dock_device(acpi_handle handle); +#else +#define is_dock_device(h) (0) +#define register_dock_notifier(nb) (-ENODEV) +#define unregister_dock_notifier(nb) do { } while(0) +#define register_hotplug_dock_device(h1, h2, c) (-ENODEV) +#define unregister_hotplug_dock_device(h) do { } while(0) +#endif #endif /*__ACPI_DRIVERS_H__*/ -- cgit v0.10.2 From 4e8662bbd680c54496189ac68f398e847f3ca374 Mon Sep 17 00:00:00 2001 From: Kristen Accardi Date: Wed, 28 Jun 2006 03:08:06 -0400 Subject: ACPIPHP: use ACPI dock driver Modify the acpiphp driver to use the ACPI dock driver for dock notifications. Only load the acpiphp driver if we find we have pci dock devices. Signed-off-by: Kristen Carlson Accardi Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/pci/hotplug/Makefile b/drivers/pci/hotplug/Makefile index 421cfff..34a1891 100644 --- a/drivers/pci/hotplug/Makefile +++ b/drivers/pci/hotplug/Makefile @@ -40,8 +40,7 @@ ibmphp-objs := ibmphp_core.o \ ibmphp_hpc.o acpiphp-objs := acpiphp_core.o \ - acpiphp_glue.o \ - acpiphp_dock.o + acpiphp_glue.o rpaphp-objs := rpaphp_core.o \ rpaphp_pci.o \ diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index 17a93f8..e8fddf9 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h @@ -130,7 +130,7 @@ struct acpiphp_func { struct list_head sibling; struct pci_dev *pci_dev; - + struct notifier_block nb; acpi_handle handle; u8 function; /* pci function# */ @@ -151,24 +151,6 @@ struct acpiphp_attention_info }; -struct dependent_device { - struct list_head device_list; - struct list_head pci_list; - acpi_handle handle; - struct acpiphp_func *func; -}; - - -struct acpiphp_dock_station { - acpi_handle handle; - u32 last_dock_time; - u32 flags; - struct acpiphp_func *dock_bridge; - struct list_head dependent_devices; - struct list_head pci_dependent_devices; -}; - - /* PCI bus bridge HID */ #define ACPI_PCI_HOST_HID "PNP0A03" @@ -207,11 +189,6 @@ struct acpiphp_dock_station { #define FUNC_HAS_PS2 (0x00000040) #define FUNC_HAS_PS3 (0x00000080) #define FUNC_HAS_DCK (0x00000100) -#define FUNC_IS_DD (0x00000200) - -/* dock station flags */ -#define DOCK_DOCKING (0x00000001) -#define DOCK_HAS_BRIDGE (0x00000002) /* function prototypes */ @@ -236,16 +213,6 @@ extern u8 acpiphp_get_latch_status (struct acpiphp_slot *slot); extern u8 acpiphp_get_adapter_status (struct acpiphp_slot *slot); extern u32 acpiphp_get_address (struct acpiphp_slot *slot); -/* acpiphp_dock.c */ -extern int find_dock_station(void); -extern void remove_dock_station(void); -extern void add_dependent_device(struct dependent_device *new_dd); -extern void add_pci_dependent_device(struct dependent_device *new_dd); -extern struct dependent_device *get_dependent_device(acpi_handle handle); -extern int is_dependent_device(acpi_handle handle); -extern int detect_dependent_devices(acpi_handle *bridge_handle); -extern struct dependent_device *alloc_dependent_device(acpi_handle handle); - /* variables */ extern int acpiphp_debug; diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index 4f1b0da..34de569 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c @@ -416,27 +416,12 @@ void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *acpiphp_slot) static int __init acpiphp_init(void) { - int retval; - int docking_station; - info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); acpiphp_debug = debug; - docking_station = find_dock_station(); - /* read all the ACPI info from the system */ - retval = init_acpi(); - - /* if we have found a docking station, we should - * go ahead and load even if init_acpi has found - * no slots. This handles the case when the _DCK - * method not defined under the actual dock bridge - */ - if (docking_station) - return 0; - else - return retval; + return init_acpi(); } @@ -444,8 +429,6 @@ static void __exit acpiphp_exit(void) { /* deallocate internal data structures etc. */ acpiphp_glue_exit(); - - remove_dock_station(); } module_init(acpiphp_init); diff --git a/drivers/pci/hotplug/acpiphp_dock.c b/drivers/pci/hotplug/acpiphp_dock.c deleted file mode 100644 index 4f1aaf1..0000000 --- a/drivers/pci/hotplug/acpiphp_dock.c +++ /dev/null @@ -1,438 +0,0 @@ -/* - * ACPI PCI HotPlug dock functions to ACPI CA subsystem - * - * Copyright (C) 2006 Kristen Carlson Accardi (kristen.c.accardi@intel.com) - * Copyright (C) 2006 Intel Corporation - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Send feedback to - * - */ -#include -#include - -#include -#include -#include -#include - -#include "../pci.h" -#include "pci_hotplug.h" -#include "acpiphp.h" - -static struct acpiphp_dock_station *ds; -#define MY_NAME "acpiphp_dock" - - -int is_dependent_device(acpi_handle handle) -{ - return (get_dependent_device(handle) ? 1 : 0); -} - - -static acpi_status -find_dependent_device(acpi_handle handle, u32 lvl, void *context, void **rv) -{ - int *count = (int *)context; - - if (is_dependent_device(handle)) { - (*count)++; - return AE_CTRL_TERMINATE; - } else { - return AE_OK; - } -} - - - - -void add_dependent_device(struct dependent_device *new_dd) -{ - list_add_tail(&new_dd->device_list, &ds->dependent_devices); -} - - -void add_pci_dependent_device(struct dependent_device *new_dd) -{ - list_add_tail(&new_dd->pci_list, &ds->pci_dependent_devices); -} - - - -struct dependent_device * get_dependent_device(acpi_handle handle) -{ - struct dependent_device *dd; - - if (!ds) - return NULL; - - list_for_each_entry(dd, &ds->dependent_devices, device_list) { - if (handle == dd->handle) - return dd; - } - return NULL; -} - - - -struct dependent_device *alloc_dependent_device(acpi_handle handle) -{ - struct dependent_device *dd; - - dd = kzalloc(sizeof(*dd), GFP_KERNEL); - if (dd) { - INIT_LIST_HEAD(&dd->pci_list); - INIT_LIST_HEAD(&dd->device_list); - dd->handle = handle; - } - return dd; -} - - - -static int is_dock(acpi_handle handle) -{ - acpi_status status; - acpi_handle tmp; - - status = acpi_get_handle(handle, "_DCK", &tmp); - if (ACPI_FAILURE(status)) { - return 0; - } - return 1; -} - - - -static int dock_present(void) -{ - unsigned long sta; - acpi_status status; - - if (ds) { - status = acpi_evaluate_integer(ds->handle, "_STA", NULL, &sta); - if (ACPI_SUCCESS(status) && sta) - return 1; - } - return 0; -} - - - -static void eject_dock(void) -{ - struct acpi_object_list arg_list; - union acpi_object arg; - - arg_list.count = 1; - arg_list.pointer = &arg; - arg.type = ACPI_TYPE_INTEGER; - arg.integer.value = 1; - - if (ACPI_FAILURE(acpi_evaluate_object(ds->handle, "_EJ0", - &arg_list, NULL)) || dock_present()) - warn("%s: failed to eject dock!\n", __FUNCTION__); - - return; -} - - - - -static acpi_status handle_dock(int dock) -{ - acpi_status status; - struct acpi_object_list arg_list; - union acpi_object arg; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - - dbg("%s: %s\n", __FUNCTION__, dock ? "docking" : "undocking"); - - /* _DCK method has one argument */ - arg_list.count = 1; - arg_list.pointer = &arg; - arg.type = ACPI_TYPE_INTEGER; - arg.integer.value = dock; - status = acpi_evaluate_object(ds->handle, "_DCK", - &arg_list, &buffer); - if (ACPI_FAILURE(status)) - err("%s: failed to execute _DCK\n", __FUNCTION__); - acpi_os_free(buffer.pointer); - - return status; -} - - - -static inline void dock(void) -{ - handle_dock(1); -} - - - -static inline void undock(void) -{ - handle_dock(0); -} - - - -/* - * the _DCK method can do funny things... and sometimes not - * hah-hah funny. - * - * TBD - figure out a way to only call fixups for - * systems that require them. - */ -static void post_dock_fixups(void) -{ - struct pci_bus *bus; - u32 buses; - struct dependent_device *dd; - - list_for_each_entry(dd, &ds->pci_dependent_devices, pci_list) { - bus = dd->func->slot->bridge->pci_bus; - - /* fixup bad _DCK function that rewrites - * secondary bridge on slot - */ - pci_read_config_dword(bus->self, - PCI_PRIMARY_BUS, - &buses); - - if (((buses >> 8) & 0xff) != bus->secondary) { - buses = (buses & 0xff000000) - | ((unsigned int)(bus->primary) << 0) - | ((unsigned int)(bus->secondary) << 8) - | ((unsigned int)(bus->subordinate) << 16); - pci_write_config_dword(bus->self, - PCI_PRIMARY_BUS, - buses); - } - } -} - - - -static void hotplug_pci(u32 type) -{ - struct dependent_device *dd; - - list_for_each_entry(dd, &ds->pci_dependent_devices, pci_list) - handle_hotplug_event_func(dd->handle, type, dd->func); -} - - - -static inline void begin_dock(void) -{ - ds->flags |= DOCK_DOCKING; -} - - -static inline void complete_dock(void) -{ - ds->flags &= ~(DOCK_DOCKING); - ds->last_dock_time = jiffies; -} - - -static int dock_in_progress(void) -{ - if (ds->flags & DOCK_DOCKING || - ds->last_dock_time == jiffies) { - dbg("dock in progress\n"); - return 1; - } - return 0; -} - - - -static void -handle_hotplug_event_dock(acpi_handle handle, u32 type, void *context) -{ - dbg("%s: enter\n", __FUNCTION__); - - switch (type) { - case ACPI_NOTIFY_BUS_CHECK: - dbg("BUS Check\n"); - if (!dock_in_progress() && dock_present()) { - begin_dock(); - dock(); - if (!dock_present()) { - err("Unable to dock!\n"); - break; - } - post_dock_fixups(); - hotplug_pci(type); - complete_dock(); - } - break; - case ACPI_NOTIFY_EJECT_REQUEST: - dbg("EJECT request\n"); - if (!dock_in_progress() && dock_present()) { - hotplug_pci(type); - undock(); - eject_dock(); - if (dock_present()) - err("Unable to undock!\n"); - } - break; - } -} - - - - -static acpi_status -find_dock_ejd(acpi_handle handle, u32 lvl, void *context, void **rv) -{ - acpi_status status; - acpi_handle tmp; - acpi_handle dck_handle = (acpi_handle) context; - char objname[64]; - struct acpi_buffer buffer = { .length = sizeof(objname), - .pointer = objname }; - struct acpi_buffer ejd_buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *ejd_obj; - - status = acpi_get_handle(handle, "_EJD", &tmp); - if (ACPI_FAILURE(status)) - return AE_OK; - - /* make sure we are dependent on the dock device, - * by executing the _EJD method, then getting a handle - * to the device referenced by that name. If that - * device handle is the same handle as the dock station - * handle, then we are a device dependent on the dock station - */ - acpi_get_name(dck_handle, ACPI_FULL_PATHNAME, &buffer); - status = acpi_evaluate_object(handle, "_EJD", NULL, &ejd_buffer); - if (ACPI_FAILURE(status)) { - err("Unable to execute _EJD!\n"); - goto find_ejd_out; - } - ejd_obj = ejd_buffer.pointer; - status = acpi_get_handle(NULL, ejd_obj->string.pointer, &tmp); - if (ACPI_FAILURE(status)) - goto find_ejd_out; - - if (tmp == dck_handle) { - struct dependent_device *dd; - dbg("%s: found device dependent on dock\n", __FUNCTION__); - dd = alloc_dependent_device(handle); - if (!dd) { - err("Can't allocate memory for dependent device!\n"); - goto find_ejd_out; - } - add_dependent_device(dd); - } - -find_ejd_out: - acpi_os_free(ejd_buffer.pointer); - return AE_OK; -} - - - -int detect_dependent_devices(acpi_handle *bridge_handle) -{ - acpi_status status; - int count; - - count = 0; - - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge_handle, - (u32)1, find_dependent_device, - (void *)&count, NULL); - - return count; -} - - - - - -static acpi_status -find_dock(acpi_handle handle, u32 lvl, void *context, void **rv) -{ - int *count = (int *)context; - - if (is_dock(handle)) { - dbg("%s: found dock\n", __FUNCTION__); - ds = kzalloc(sizeof(*ds), GFP_KERNEL); - ds->handle = handle; - INIT_LIST_HEAD(&ds->dependent_devices); - INIT_LIST_HEAD(&ds->pci_dependent_devices); - - /* look for devices dependent on dock station */ - acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, find_dock_ejd, handle, NULL); - - acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, - handle_hotplug_event_dock, ds); - (*count)++; - } - - return AE_OK; -} - - - - -int find_dock_station(void) -{ - int num = 0; - - ds = NULL; - - /* start from the root object, because some laptops define - * _DCK methods outside the scope of PCI (IBM x-series laptop) - */ - acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, find_dock, &num, NULL); - - return num; -} - - - -void remove_dock_station(void) -{ - struct dependent_device *dd, *tmp; - if (ds) { - if (ACPI_FAILURE(acpi_remove_notify_handler(ds->handle, - ACPI_SYSTEM_NOTIFY, handle_hotplug_event_dock))) - err("failed to remove dock notify handler\n"); - - /* free all dependent devices */ - list_for_each_entry_safe(dd, tmp, &ds->dependent_devices, - device_list) - kfree(dd); - - /* no need to touch the pci_dependent_device list, - * cause all memory was freed above - */ - kfree(ds); - } -} - - diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index d370f99..faf7eed 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -116,6 +116,59 @@ is_ejectable_slot(acpi_handle handle, u32 lvl, void *context, void **rv) } } +/* callback routine to check for the existance of a pci dock device */ +static acpi_status +is_pci_dock_device(acpi_handle handle, u32 lvl, void *context, void **rv) +{ + int *count = (int *)context; + + if (is_dock_device(handle)) { + (*count)++; + return AE_CTRL_TERMINATE; + } else { + return AE_OK; + } +} + + + + +/* + * the _DCK method can do funny things... and sometimes not + * hah-hah funny. + * + * TBD - figure out a way to only call fixups for + * systems that require them. + */ +static int post_dock_fixups(struct notifier_block *nb, unsigned long val, + void *v) +{ + struct acpiphp_func *func = container_of(nb, struct acpiphp_func, nb); + struct pci_bus *bus = func->slot->bridge->pci_bus; + u32 buses; + + if (!bus->self) + return NOTIFY_OK; + + /* fixup bad _DCK function that rewrites + * secondary bridge on slot + */ + pci_read_config_dword(bus->self, + PCI_PRIMARY_BUS, + &buses); + + if (((buses >> 8) & 0xff) != bus->secondary) { + buses = (buses & 0xff000000) + | ((unsigned int)(bus->primary) << 0) + | ((unsigned int)(bus->secondary) << 8) + | ((unsigned int)(bus->subordinate) << 16); + pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses); + } + return NOTIFY_OK; +} + + + /* callback routine to register each ACPI PCI slot object */ static acpi_status @@ -124,7 +177,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) struct acpiphp_bridge *bridge = (struct acpiphp_bridge *)context; struct acpiphp_slot *slot; struct acpiphp_func *newfunc; - struct dependent_device *dd; acpi_handle tmp; acpi_status status = AE_OK; unsigned long adr, sun; @@ -137,7 +189,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) status = acpi_get_handle(handle, "_EJ0", &tmp); - if (ACPI_FAILURE(status) && !(is_dependent_device(handle))) + if (ACPI_FAILURE(status) && !(is_dock_device(handle))) return AE_OK; device = (adr >> 16) & 0xffff; @@ -162,18 +214,8 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) if (ACPI_SUCCESS(acpi_get_handle(handle, "_PS3", &tmp))) newfunc->flags |= FUNC_HAS_PS3; - if (ACPI_SUCCESS(acpi_get_handle(handle, "_DCK", &tmp))) { + if (ACPI_SUCCESS(acpi_get_handle(handle, "_DCK", &tmp))) newfunc->flags |= FUNC_HAS_DCK; - /* add to devices dependent on dock station, - * because this may actually be the dock bridge - */ - dd = alloc_dependent_device(handle); - if (!dd) - err("Can't allocate memory for " - "new dependent device!\n"); - else - add_dependent_device(dd); - } status = acpi_evaluate_integer(handle, "_SUN", NULL, &sun); if (ACPI_FAILURE(status)) @@ -225,20 +267,23 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); } - /* if this is a device dependent on a dock station, - * associate the acpiphp_func to the dependent_device - * struct. - */ - if ((dd = get_dependent_device(handle))) { - newfunc->flags |= FUNC_IS_DD; - /* - * we don't want any devices which is dependent - * on the dock to have it's _EJ0 method executed. - * because we need to run _DCK first. + if (is_dock_device(handle)) { + /* we don't want to call this device's _EJ0 + * because we want the dock notify handler + * to call it after it calls _DCK */ newfunc->flags &= ~FUNC_HAS_EJ0; - dd->func = newfunc; - add_pci_dependent_device(dd); + if (register_hotplug_dock_device(handle, + handle_hotplug_event_func, newfunc)) + dbg("failed to register dock device\n"); + + /* we need to be notified when dock events happen + * outside of the hotplug operation, since we may + * need to do fixups before we can hotplug. + */ + newfunc->nb.notifier_call = post_dock_fixups; + if (register_dock_notifier(&newfunc->nb)) + dbg("failed to register a dock notifier"); } /* install notify handler */ @@ -277,6 +322,15 @@ static int detect_ejectable_slots(acpi_handle *bridge_handle) status = acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge_handle, (u32)1, is_ejectable_slot, (void *)&count, NULL); + /* + * we also need to add this bridge if there is a dock bridge or + * other pci device on a dock station (removable) + */ + if (!count) + status = acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge_handle, + (u32)1, is_pci_dock_device, (void *)&count, + NULL); + return count; } @@ -487,8 +541,7 @@ find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv) goto out; /* check if this bridge has ejectable slots */ - if ((detect_ejectable_slots(handle) > 0) || - (detect_dependent_devices(handle) > 0)) { + if ((detect_ejectable_slots(handle) > 0)) { dbg("found PCI-to-PCI bridge at PCI %s\n", pci_name(dev)); add_p2p_bridge(handle, dev); } @@ -605,6 +658,10 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge) list_for_each_safe (list, tmp, &slot->funcs) { struct acpiphp_func *func; func = list_entry(list, struct acpiphp_func, sibling); + if (is_dock_device(func->handle)) { + unregister_hotplug_dock_device(func->handle); + unregister_dock_notifier(&func->nb); + } if (!(func->flags & FUNC_HAS_DCK)) { status = acpi_remove_notify_handler(func->handle, ACPI_SYSTEM_NOTIFY, -- cgit v0.10.2 From 2b85e1307fe3a84eca2e1a21c6c857359908dab4 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Tue, 27 Jun 2006 01:50:14 -0400 Subject: ACPI: static-ize handle_hotplug_event_func() Signed-off-by: Len Brown diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index e8fddf9..be104ec 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h @@ -203,7 +203,6 @@ extern int acpiphp_glue_init (void); extern void acpiphp_glue_exit (void); extern int acpiphp_get_num_slots (void); typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data); -void handle_hotplug_event_func(acpi_handle, u32, void*); extern int acpiphp_enable_slot (struct acpiphp_slot *slot); extern int acpiphp_disable_slot (struct acpiphp_slot *slot); diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index faf7eed..b3899cf 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -59,6 +59,7 @@ static LIST_HEAD(bridge_list); static void handle_hotplug_event_bridge (acpi_handle, u32, void *); static void acpiphp_sanitize_bus(struct pci_bus *bus); static void acpiphp_set_hpp_values(acpi_handle handle, struct pci_bus *bus); +static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context); /* @@ -1497,7 +1498,7 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont * handles ACPI event notification on slots * */ -void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context) +static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context) { struct acpiphp_func *func; char objname[64]; -- cgit v0.10.2 From 95b38b3f453c16de0f8cddcde3e71050bbfb37b9 Mon Sep 17 00:00:00 2001 From: Kristen Accardi Date: Wed, 28 Jun 2006 03:09:54 -0400 Subject: ACPIPHP: prevent duplicate slot numbers when no _SUN Dock bridges generally do not implement _SUN, yet show up as ejectable slots. If you have more than one ejectable slot that does not implement SUN, with the current code you will get duplicate slot numbers. So, if there is no _SUN, use the current count of the number of slots found instead. Signed-off-by: Kristen Carlson Accardi Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index b3899cf..ef95d12 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -219,8 +219,13 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) newfunc->flags |= FUNC_HAS_DCK; status = acpi_evaluate_integer(handle, "_SUN", NULL, &sun); - if (ACPI_FAILURE(status)) - sun = -1; + if (ACPI_FAILURE(status)) { + /* + * use the count of the number of slots we've found + * for the number of the slot + */ + sun = bridge->nr_slots+1; + } /* search for objects that share the same slot */ for (slot = bridge->slots; slot; slot = slot->next) -- cgit v0.10.2 From 967440e3be1af06ad4dc7bb18d2e3c16130fe067 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 23 Jun 2006 17:04:00 -0400 Subject: ACPI: ACPICA 20060623 Implemented a new acpi_spinlock type for the OSL lock interfaces. This allows the type to be customized to the host OS for improved efficiency (since a spinlock is usually a very small object.) Implemented support for "ignored" bits in the ACPI registers. According to the ACPI specification, these bits should be preserved when writing the registers via a read/modify/write cycle. There are 3 bits preserved in this manner: PM1_CONTROL[0] (SCI_EN), PM1_CONTROL[9], and PM1_STATUS[11]. http://bugzilla.kernel.org/show_bug.cgi?id=3691 Implemented the initial deployment of new OSL mutex interfaces. Since some host operating systems have separate mutex and semaphore objects, this feature was requested. The base code now uses mutexes (and the new mutex interfaces) wherever a binary semaphore was used previously. However, for the current release, the mutex interfaces are defined as macros to map them to the existing semaphore interfaces. Fixed several problems with the support for the control method SyncLevel parameter. The SyncLevel now works according to the ACPI specification and in concert with the Mutex SyncLevel parameter, since the current SyncLevel is a property of the executing thread. Mutual exclusion for control methods is now implemented with a mutex instead of a semaphore. Fixed three instances of the use of the C shift operator in the bitfield support code (exfldio.c) to avoid the use of a shift value larger than the target data width. The behavior of C compilers is undefined in this case and can cause unpredictable results, and therefore the case must be detected and avoided. (Fiodor Suietov) Added an info message whenever an SSDT or OEM table is loaded dynamically via the Load() or LoadTable() ASL operators. This should improve debugging capability since it will show exactly what tables have been loaded (beyond the tables present in the RSDT/XSDT.) Signed-off-by: Bob Moore Signed-off-by: Len Brown diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index bbdf990..daf51b5 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c @@ -125,37 +125,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, if (info->table_desc->pointer->revision == 1) { node->flags |= ANOBJ_DATA_WIDTH_32; } -#ifdef ACPI_INIT_PARSE_METHODS - /* - * Note 11/2005: Removed this code to parse all methods during table - * load because it causes problems if there are any errors during the - * parse. Also, it seems like overkill and we probably don't want to - * abort a table load because of an issue with a single method. - */ - - /* - * Print a dot for each method unless we are going to print - * the entire pathname - */ - if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); - } - /* - * Always parse methods to detect errors, we will delete - * the parse tree below - */ - status = acpi_ds_parse_method(obj_handle); - if (ACPI_FAILURE(status)) { - ACPI_ERROR((AE_INFO, - "Method %p [%4.4s] - parse failure, %s", - obj_handle, - acpi_ut_get_node_name(obj_handle), - acpi_format_exception(status))); - - /* This parse failed, but we will continue parsing more methods */ - } -#endif info->method_count++; break; diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index bc9aca4..a39a33f 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -52,6 +52,10 @@ #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsmethod") +/* Local prototypes */ +static acpi_status +acpi_ds_create_method_mutex(union acpi_operand_object *method_desc); + /******************************************************************************* * * FUNCTION: acpi_ds_method_error @@ -67,6 +71,7 @@ ACPI_MODULE_NAME("dsmethod") * Note: Allows the exception handler to change the status code * ******************************************************************************/ + acpi_status acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) { @@ -113,11 +118,51 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) /******************************************************************************* * + * FUNCTION: acpi_ds_create_method_mutex + * + * PARAMETERS: obj_desc - The method object + * + * RETURN: Status + * + * DESCRIPTION: Create a mutex object for a serialized control method + * + ******************************************************************************/ + +static acpi_status +acpi_ds_create_method_mutex(union acpi_operand_object *method_desc) +{ + union acpi_operand_object *mutex_desc; + acpi_status status; + + ACPI_FUNCTION_NAME(ds_create_method_mutex); + + /* Create the new mutex object */ + + mutex_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX); + if (!mutex_desc) { + return_ACPI_STATUS(AE_NO_MEMORY); + } + + /* Create the actual OS Mutex */ + + status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + mutex_desc->mutex.sync_level = method_desc->method.sync_level; + method_desc->method.mutex = mutex_desc; + return_ACPI_STATUS(AE_OK); +} + +/******************************************************************************* + * * FUNCTION: acpi_ds_begin_method_execution * * PARAMETERS: method_node - Node of the method * obj_desc - The method object - * calling_method_node - Caller of this method (if non-null) + * walk_state - current state, NULL if not yet executing + * a method. * * RETURN: Status * @@ -128,9 +173,9 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) ******************************************************************************/ acpi_status -acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, - union acpi_operand_object * obj_desc, - struct acpi_namespace_node * calling_method_node) +acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, + union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state) { acpi_status status = AE_OK; @@ -149,35 +194,80 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, } /* - * If there is a concurrency limit on this method, we need to - * obtain a unit from the method semaphore. + * If this method is serialized, we need to acquire the method mutex. */ - if (obj_desc->method.semaphore) { + if (obj_desc->method.method_flags & AML_METHOD_SERIALIZED) { /* - * Allow recursive method calls, up to the reentrancy/concurrency - * limit imposed by the SERIALIZED rule and the sync_level method - * parameter. - * - * The point of this code is to avoid permanently blocking a - * thread that is making recursive method calls. + * Create a mutex for the method if it is defined to be Serialized + * and a mutex has not already been created. We defer the mutex creation + * until a method is actually executed, to minimize the object count */ - if (method_node == calling_method_node) { - if (obj_desc->method.thread_count >= - obj_desc->method.concurrency) { - return_ACPI_STATUS(AE_AML_METHOD_LIMIT); + if (!obj_desc->method.mutex) { + status = acpi_ds_create_method_mutex(obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* - * Get a unit from the method semaphore. This releases the - * interpreter if we block (then reacquires it) + * The current_sync_level (per-thread) must be less than or equal to + * the sync level of the method. This mechanism provides some + * deadlock prevention + * + * Top-level method invocation has no walk state at this point */ - status = - acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, - ACPI_WAIT_FOREVER); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + if (walk_state && + (walk_state->thread->current_sync_level > + obj_desc->method.mutex->mutex.sync_level)) { + ACPI_ERROR((AE_INFO, + "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%d)", + acpi_ut_get_node_name(method_node), + walk_state->thread->current_sync_level)); + + return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } + + /* + * Obtain the method mutex if necessary. Do not acquire mutex for a + * recursive call. + */ + if (!walk_state || + !obj_desc->method.mutex->mutex.owner_thread || + (walk_state->thread != + obj_desc->method.mutex->mutex.owner_thread)) { + /* + * Acquire the method mutex. This releases the interpreter if we + * block (and reacquires it before it returns) + */ + status = + acpi_ex_system_wait_mutex(obj_desc->method.mutex-> + mutex.os_mutex, + ACPI_WAIT_FOREVER); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* Update the mutex and walk info and save the original sync_level */ + + if (walk_state) { + obj_desc->method.mutex->mutex. + original_sync_level = + walk_state->thread->current_sync_level; + + obj_desc->method.mutex->mutex.owner_thread = + walk_state->thread; + walk_state->thread->current_sync_level = + obj_desc->method.sync_level; + } else { + obj_desc->method.mutex->mutex. + original_sync_level = + obj_desc->method.mutex->mutex.sync_level; + } + } + + /* Always increase acquisition depth */ + + obj_desc->method.mutex->mutex.acquisition_depth++; } /* @@ -200,10 +290,10 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, return_ACPI_STATUS(status); cleanup: - /* On error, must signal the method semaphore if present */ + /* On error, must release the method mutex (if present) */ - if (obj_desc->method.semaphore) { - (void)acpi_os_signal_semaphore(obj_desc->method.semaphore, 1); + if (obj_desc->method.mutex) { + acpi_os_release_mutex(obj_desc->method.mutex->mutex.os_mutex); } return_ACPI_STATUS(status); } @@ -253,10 +343,10 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, return_ACPI_STATUS(AE_NULL_OBJECT); } - /* Init for new method, possibly wait on concurrency semaphore */ + /* Init for new method, possibly wait on method mutex */ status = acpi_ds_begin_method_execution(method_node, obj_desc, - this_walk_state->method_node); + this_walk_state); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -478,6 +568,8 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, * created, delete all locals and arguments, and delete the parse * tree if requested. * + * MUTEX: Interpreter is locked + * ******************************************************************************/ void @@ -503,26 +595,21 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, } /* - * Lock the parser while we terminate this method. - * If this is the last thread executing the method, - * we have additional cleanup to perform + * If method is serialized, release the mutex and restore the + * current sync level for this thread */ - status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD); - if (ACPI_FAILURE(status)) { - return_VOID; - } + if (method_desc->method.mutex) { - /* Signal completion of the execution of this method if necessary */ + /* Acquisition Depth handles recursive calls */ - if (method_desc->method.semaphore) { - status = - acpi_os_signal_semaphore(method_desc->method.semaphore, 1); - if (ACPI_FAILURE(status)) { - - /* Ignore error and continue */ + method_desc->method.mutex->mutex.acquisition_depth--; + if (!method_desc->method.mutex->mutex.acquisition_depth) { + walk_state->thread->current_sync_level = + method_desc->method.mutex->mutex. + original_sync_level; - ACPI_EXCEPTION((AE_INFO, status, - "Could not signal method semaphore")); + acpi_os_release_mutex(method_desc->method.mutex->mutex. + os_mutex); } } @@ -537,7 +624,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - goto exit; + return_VOID; } /* @@ -580,18 +667,16 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, /* * Support to dynamically change a method from not_serialized to * Serialized if it appears that the method is incorrectly written and - * does not support multiple thread execution. The best example of this - * is if such a method creates namespace objects and blocks. A second + * does not support multiple thread execution. The best example of this + * is if such a method creates namespace objects and blocks. A second * thread will fail with an AE_ALREADY_EXISTS exception * * This code is here because we must wait until the last thread exits * before creating the synchronization semaphore. */ - if ((method_desc->method.concurrency == 1) && - (!method_desc->method.semaphore)) { - status = acpi_os_create_semaphore(1, 1, - &method_desc->method. - semaphore); + if ((method_desc->method.method_flags & AML_METHOD_SERIALIZED) + && (!method_desc->method.mutex)) { + status = acpi_ds_create_method_mutex(method_desc); } /* No more threads, we can free the owner_id */ @@ -599,144 +684,5 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, acpi_ut_release_owner_id(&method_desc->method.owner_id); } - exit: - (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD); return_VOID; } - -#ifdef ACPI_INIT_PARSE_METHODS - /* - * Note 11/2005: Removed this code to parse all methods during table - * load because it causes problems if there are any errors during the - * parse. Also, it seems like overkill and we probably don't want to - * abort a table load because of an issue with a single method. - */ - -/******************************************************************************* - * - * FUNCTION: acpi_ds_parse_method - * - * PARAMETERS: Node - Method node - * - * RETURN: Status - * - * DESCRIPTION: Parse the AML that is associated with the method. - * - * MUTEX: Assumes parser is locked - * - ******************************************************************************/ - -acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) -{ - acpi_status status; - union acpi_operand_object *obj_desc; - union acpi_parse_object *op; - struct acpi_walk_state *walk_state; - - ACPI_FUNCTION_TRACE_PTR(ds_parse_method, node); - - /* Parameter Validation */ - - if (!node) { - return_ACPI_STATUS(AE_NULL_ENTRY); - } - - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "**** Parsing [%4.4s] **** NamedObj=%p\n", - acpi_ut_get_node_name(node), node)); - - /* Extract the method object from the method Node */ - - obj_desc = acpi_ns_get_attached_object(node); - if (!obj_desc) { - return_ACPI_STATUS(AE_NULL_OBJECT); - } - - /* Create a mutex for the method if there is a concurrency limit */ - - if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && - (!obj_desc->method.semaphore)) { - status = acpi_os_create_semaphore(obj_desc->method.concurrency, - obj_desc->method.concurrency, - &obj_desc->method.semaphore); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - } - - /* - * Allocate a new parser op to be the root of the parsed - * method tree - */ - op = acpi_ps_alloc_op(AML_METHOD_OP); - if (!op) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - /* Init new op with the method name and pointer back to the Node */ - - acpi_ps_set_name(op, node->name.integer); - op->common.node = node; - - /* - * Get a new owner_id for objects created by this method. Namespace - * objects (such as Operation Regions) can be created during the - * first pass parse. - */ - status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); - if (ACPI_FAILURE(status)) { - goto cleanup; - } - - /* Create and initialize a new walk state */ - - walk_state = - acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL, - NULL); - if (!walk_state) { - status = AE_NO_MEMORY; - goto cleanup2; - } - - status = acpi_ds_init_aml_walk(walk_state, op, node, - obj_desc->method.aml_start, - obj_desc->method.aml_length, NULL, 1); - if (ACPI_FAILURE(status)) { - acpi_ds_delete_walk_state(walk_state); - goto cleanup2; - } - - /* - * Parse the method, first pass - * - * The first pass load is where newly declared named objects are added into - * the namespace. Actual evaluation of the named objects (what would be - * called a "second pass") happens during the actual execution of the - * method so that operands to the named objects can take on dynamic - * run-time values. - */ - status = acpi_ps_parse_aml(walk_state); - if (ACPI_FAILURE(status)) { - goto cleanup2; - } - - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", - acpi_ut_get_node_name(node), node, op)); - - /* - * Delete the parse tree. We simply re-parse the method for every - * execution since there isn't much overhead (compared to keeping lots - * of parse trees around) - */ - acpi_ns_delete_namespace_subtree(node); - acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id); - - cleanup2: - acpi_ut_release_owner_id(&obj_desc->method.owner_id); - - cleanup: - acpi_ps_delete_parse_tree(op); - return_ACPI_STATUS(status); -} -#endif diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 3acbd91..b1ded62 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -472,7 +472,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) acpi_ds_result_push(walk_state->result_obj, walk_state); } - break; default: @@ -510,6 +509,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", op)); + op->common.node = (struct acpi_namespace_node *)op->asl.value. arg->asl.node->object; @@ -670,7 +670,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) status = acpi_ds_result_stack_pop(walk_state); } - break; case AML_TYPE_UNDEFINED: @@ -708,7 +707,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) * Check if we just completed the evaluation of a * conditional predicate */ - if ((ACPI_SUCCESS(status)) && (walk_state->control_state) && (walk_state->control_state->common.state == diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 3507439..e3ca7f6 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -175,7 +175,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, if (status == AE_NOT_FOUND) { /* * Table disassembly: - * Target of Scope() not found. Generate an External for it, and + * Target of Scope() not found. Generate an External for it, and * insert the name into the namespace. */ acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0); @@ -210,16 +210,15 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, case ACPI_TYPE_BUFFER: /* - * These types we will allow, but we will change the type. This + * These types we will allow, but we will change the type. This * enables some existing code of the form: * * Name (DEB, 0) * Scope (DEB) { ... } * - * Note: silently change the type here. On the second pass, we will report + * Note: silently change the type here. On the second pass, we will report * a warning */ - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", path, @@ -242,7 +241,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, break; default: - /* * For all other named opcodes, we will enter the name into * the namespace. @@ -259,7 +257,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, * buffer_field, or Package), the name of the object is already * in the namespace. */ - if (walk_state->deferred_node) { /* This name is already in the namespace, get the node */ @@ -293,8 +290,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, } /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that + * Enter the named type into the internal namespace. We enter the name + * as we go downward in the parse tree. Any necessary subobjects that * involve arguments to the opcode must be created as we go back up the * parse tree later. */ @@ -327,12 +324,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, (status); } } + status = AE_OK; } } if (ACPI_FAILURE(status)) { - ACPI_ERROR_NAMESPACE(path, status); return_ACPI_STATUS(status); } @@ -434,9 +431,13 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) status = acpi_ex_create_region(op->named.data, op->named.length, - (acpi_adr_space_type) - ((op->common.value.arg)-> - common.value.integer), + (acpi_adr_space_type) ((op-> + common. + value. + arg)-> + common. + value. + integer), walk_state); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -474,7 +475,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) * method_op pkg_length name_string method_flags term_list * * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing + * see the method declaration. This allows later pass1 parsing * of invocations of the method (need to know the number of * arguments.) */ @@ -499,6 +500,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) length, walk_state); } + walk_state->operands[0] = NULL; walk_state->num_operands = 0; @@ -570,7 +572,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || (walk_state->op_info->class == AML_CLASS_CONTROL)) { - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name, @@ -602,7 +603,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, } else { /* Get name from the op */ - buffer_ptr = (char *)&op->named.name; + buffer_ptr = ACPI_CAST_PTR(char, &op->named.name); } } else { /* Get the namestring from the raw AML */ @@ -629,7 +630,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, break; case AML_INT_NAMEPATH_OP: - /* * The name_path is an object reference to an existing object. * Don't enter the name into the namespace, but look it up @@ -642,7 +642,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, break; case AML_SCOPE_OP: - /* * The Path is an object reference to an existing object. * Don't enter the name into the namespace, but look it up @@ -664,6 +663,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, #endif return_ACPI_STATUS(status); } + /* * We must check to make sure that the target is * one of the opcodes that actually opens a scope @@ -683,13 +683,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, case ACPI_TYPE_BUFFER: /* - * These types we will allow, but we will change the type. This + * These types we will allow, but we will change the type. This * enables some existing code of the form: * * Name (DEB, 0) * Scope (DEB) { ... } */ - ACPI_WARNING((AE_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)", buffer_ptr, @@ -729,14 +728,14 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - } + return_ACPI_STATUS(AE_OK); } /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that + * Enter the named type into the internal namespace. We enter the name + * as we go downward in the parse tree. Any necessary subobjects that * involve arguments to the opcode must be created as we go back up the * parse tree later. * @@ -787,7 +786,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, * can get it again quickly when this scope is closed */ op->common.node = node; - return_ACPI_STATUS(status); } @@ -922,7 +920,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) #ifndef ACPI_NO_METHOD_EXECUTION case AML_TYPE_CREATE_FIELD: - /* * Create the field object, but the field buffer and index must * be evaluated later during the execution phase @@ -931,7 +928,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) break; case AML_TYPE_NAMED_FIELD: - /* * If we are executing a method, initialize the field */ @@ -1051,6 +1047,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) * argument is the space_id. (We must save the address of the * AML of the address and length operands) */ + /* * If we have a valid region, initialize it * Namespace is NOT locked at this point. @@ -1080,7 +1077,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) * method_op pkg_length name_string method_flags term_list * * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing + * see the method declaration. This allows later pass1 parsing * of invocations of the method (need to know the number of * arguments.) */ diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index f01d339..c76c058 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -382,7 +382,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) u32 status_reg; u32 enable_reg; acpi_cpu_flags flags; - acpi_cpu_flags hw_flags; acpi_native_uint i; acpi_native_uint j; @@ -394,8 +393,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) return (int_status); } - /* We need to hold the GPE lock now, hardware lock in the loop */ - + /* + * We need to obtain the GPE lock for both the data structs and registers + * Note: Not necessary to obtain the hardware lock, since the GPE registers + * are owned by the gpe_lock. + */ flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); /* Examine all GPE blocks attached to this interrupt level */ @@ -413,8 +415,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) gpe_register_info = &gpe_block->register_info[i]; - hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); - /* Read the Status Register */ status = @@ -423,8 +423,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) &gpe_register_info-> status_address); if (ACPI_FAILURE(status)) { - acpi_os_release_lock(acpi_gbl_hardware_lock, - hw_flags); goto unlock_and_exit; } @@ -435,8 +433,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) &enable_reg, &gpe_register_info-> enable_address); - acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags); - if (ACPI_FAILURE(status)) { goto unlock_and_exit; } diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 8233524..83fed07 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c @@ -266,6 +266,10 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, } } + ACPI_INFO((AE_INFO, + "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]", + table->signature, table->oem_id, table->oem_table_id)); + *return_desc = ddb_handle; return_ACPI_STATUS(status); } @@ -446,6 +450,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, return_ACPI_STATUS(status); } + ACPI_INFO((AE_INFO, + "Dynamic SSDT Load - OemId [%6.6s] OemTableId [%8.8s]", + table_ptr->oem_id, table_ptr->oem_table_id)); + cleanup: if (ACPI_FAILURE(status)) { ACPI_FREE(table_ptr); diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 106dc72..34eec82 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c @@ -177,7 +177,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) * that the event is created in an unsignalled state */ status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, - &obj_desc->event.semaphore); + &obj_desc->event.os_semaphore); if (ACPI_FAILURE(status)) { goto cleanup; } @@ -226,12 +226,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) goto cleanup; } - /* - * Create the actual OS semaphore. - * One unit max to make it a mutex, with one initial unit to allow - * the mutex to be acquired. - */ - status = acpi_os_create_semaphore(1, 1, &obj_desc->mutex.semaphore); + /* Create the actual OS Mutex */ + + status = acpi_os_create_mutex(&obj_desc->mutex.os_mutex); if (ACPI_FAILURE(status)) { goto cleanup; } @@ -565,7 +562,7 @@ acpi_ex_create_method(u8 * aml_start, obj_desc->method.aml_length = aml_length; /* - * Disassemble the method flags. Split off the Arg Count + * Disassemble the method flags. Split off the Arg Count * for efficiency */ method_flags = (u8) operand[1]->integer.value; @@ -576,21 +573,19 @@ acpi_ex_create_method(u8 * aml_start, (u8) (method_flags & AML_METHOD_ARG_COUNT); /* - * Get the concurrency count. If required, a semaphore will be + * Get the sync_level. If method is serialized, a mutex will be * created for this method when it is parsed. */ if (acpi_gbl_all_methods_serialized) { - obj_desc->method.concurrency = 1; + obj_desc->method.sync_level = 0; obj_desc->method.method_flags |= AML_METHOD_SERIALIZED; } else if (method_flags & AML_METHOD_SERIALIZED) { /* - * ACPI 1.0: Concurrency = 1 - * ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1) + * ACPI 1.0: sync_level = 0 + * ACPI 2.0: sync_level = sync_level in method declaration */ - obj_desc->method.concurrency = (u8) - (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1); - } else { - obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY; + obj_desc->method.sync_level = (u8) + ((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4); } /* Attach the new object to the method Node */ diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 7b9718e..2450943 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -118,14 +118,14 @@ static struct acpi_exdump_info acpi_ex_dump_device[4] = { static struct acpi_exdump_info acpi_ex_dump_event[2] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"} + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.os_semaphore), "OsSemaphore"} }; static struct acpi_exdump_info acpi_ex_dump_method[8] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "ParamCount"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.sync_level), "Sync Level"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.mutex), "Mutex"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"}, @@ -138,7 +138,7 @@ static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"}, {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), "Acquire Depth"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.semaphore), "Semaphore"} + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.os_mutex), "OsMutex"} }; static struct acpi_exdump_info acpi_ex_dump_region[7] = { diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index 051053f..40f0bee 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c @@ -727,11 +727,23 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, return_ACPI_STATUS(status); } - /* Merge with previous datum if necessary */ - - merged_datum |= raw_datum << - (obj_desc->common_field.access_bit_width - - obj_desc->common_field.start_field_bit_offset); + /* + * Merge with previous datum if necessary. + * + * Note: Before the shift, check if the shift value will be larger than + * the integer size. If so, there is no need to perform the operation. + * This avoids the differences in behavior between different compilers + * concerning shift values larger than the target data width. + */ + if ((obj_desc->common_field.access_bit_width - + obj_desc->common_field.start_field_bit_offset) < + ACPI_INTEGER_BIT_SIZE) { + merged_datum |= + raw_datum << (obj_desc->common_field. + access_bit_width - + obj_desc->common_field. + start_field_bit_offset); + } if (i == datum_count) { break; @@ -808,13 +820,23 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } - /* Compute the number of datums (access width data items) */ + /* + * Create the bitmasks used for bit insertion. + * Note: This if/else is used to bypass compiler differences with the + * shift operator + */ + if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) { + width_mask = ACPI_INTEGER_MAX; + } else { + width_mask = + ACPI_MASK_BITS_ABOVE(obj_desc->common_field. + access_bit_width); + } - width_mask = - ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width); - mask = - width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field. - start_field_bit_offset); + mask = width_mask & + ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); + + /* Compute the number of datums (access width data items) */ datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, obj_desc->common_field.access_bit_width); @@ -848,12 +870,29 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, return_ACPI_STATUS(status); } - /* Start new output datum by merging with previous input datum */ - field_offset += obj_desc->common_field.access_byte_width; - merged_datum = raw_datum >> - (obj_desc->common_field.access_bit_width - - obj_desc->common_field.start_field_bit_offset); + + /* + * Start new output datum by merging with previous input datum + * if necessary. + * + * Note: Before the shift, check if the shift value will be larger than + * the integer size. If so, there is no need to perform the operation. + * This avoids the differences in behavior between different compilers + * concerning shift values larger than the target data width. + */ + if ((obj_desc->common_field.access_bit_width - + obj_desc->common_field.start_field_bit_offset) < + ACPI_INTEGER_BIT_SIZE) { + merged_datum = + raw_datum >> (obj_desc->common_field. + access_bit_width - + obj_desc->common_field. + start_field_bit_offset); + } else { + merged_datum = 0; + } + mask = width_mask; if (i == datum_count) { diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 93098d6..d8ac287 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c @@ -161,12 +161,13 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, /* * Current Sync must be less than or equal to the sync level of the - * mutex. This mechanism provides some deadlock prevention + * mutex. This mechanism provides some deadlock prevention */ if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { ACPI_ERROR((AE_INFO, - "Cannot acquire Mutex [%4.4s], incorrect SyncLevel", - acpi_ut_get_node_name(obj_desc->mutex.node))); + "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%d)", + acpi_ut_get_node_name(obj_desc->mutex.node), + walk_state->thread->current_sync_level)); return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } @@ -178,8 +179,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, if ((obj_desc->mutex.owner_thread->thread_id == walk_state->thread->thread_id) || - (obj_desc->mutex.semaphore == - acpi_gbl_global_lock_semaphore)) { + (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK)) { /* * The mutex is already owned by this thread, * just increment the acquisition depth @@ -264,7 +264,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, */ if ((obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) - && (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) { + && (obj_desc->mutex.os_mutex != ACPI_GLOBAL_LOCK)) { ACPI_ERROR((AE_INFO, "Thread %X cannot release Mutex [%4.4s] acquired by thread %X", walk_state->thread->thread_id, diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 52beee3..6b5d1e6 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c @@ -63,14 +63,14 @@ ACPI_MODULE_NAME("exsystem") * interpreter is released. * ******************************************************************************/ -acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) +acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) { acpi_status status; acpi_status status2; ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); - status = acpi_os_wait_semaphore(semaphore, 1, 0); + status = acpi_os_wait_semaphore(semaphore, 1, ACPI_DO_NOT_WAIT); if (ACPI_SUCCESS(status)) { return_ACPI_STATUS(status); } @@ -103,6 +103,59 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) /******************************************************************************* * + * FUNCTION: acpi_ex_system_wait_mutex + * + * PARAMETERS: Mutex - Mutex to wait on + * Timeout - Max time to wait + * + * RETURN: Status + * + * DESCRIPTION: Implements a semaphore wait with a check to see if the + * semaphore is available immediately. If it is not, the + * interpreter is released. + * + ******************************************************************************/ + +acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) +{ + acpi_status status; + acpi_status status2; + + ACPI_FUNCTION_TRACE(ex_system_wait_mutex); + + status = acpi_os_acquire_mutex(mutex, ACPI_DO_NOT_WAIT); + if (ACPI_SUCCESS(status)) { + return_ACPI_STATUS(status); + } + + if (status == AE_TIME) { + + /* We must wait, so unlock the interpreter */ + + acpi_ex_exit_interpreter(); + + status = acpi_os_acquire_mutex(mutex, timeout); + + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "*** Thread awake after blocking, %s\n", + acpi_format_exception(status))); + + /* Reacquire the interpreter */ + + status2 = acpi_ex_enter_interpreter(); + if (ACPI_FAILURE(status2)) { + + /* Report fatal error, could not acquire interpreter */ + + return_ACPI_STATUS(status2); + } + } + + return_ACPI_STATUS(status); +} + +/******************************************************************************* + * * FUNCTION: acpi_ex_system_do_stall * * PARAMETERS: how_long - The amount of time to stall, @@ -176,7 +229,7 @@ acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) * * FUNCTION: acpi_ex_system_acquire_mutex * - * PARAMETERS: time_desc - The 'time to delay' object descriptor + * PARAMETERS: time_desc - Maximum time to wait for the mutex * obj_desc - The object descriptor for this op * * RETURN: Status @@ -201,14 +254,14 @@ acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc, /* Support for the _GL_ Mutex object -- go get the global lock */ - if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { + if (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK) { status = acpi_ev_acquire_global_lock((u16) time_desc->integer.value); return_ACPI_STATUS(status); } - status = acpi_ex_system_wait_semaphore(obj_desc->mutex.semaphore, - (u16) time_desc->integer.value); + status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, + (u16) time_desc->integer.value); return_ACPI_STATUS(status); } @@ -239,13 +292,13 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc) /* Support for the _GL_ Mutex object -- release the global lock */ - if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { + if (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK) { status = acpi_ev_release_global_lock(); return_ACPI_STATUS(status); } - status = acpi_os_signal_semaphore(obj_desc->mutex.semaphore, 1); - return_ACPI_STATUS(status); + acpi_os_release_mutex(obj_desc->mutex.os_mutex); + return_ACPI_STATUS(AE_OK); } /******************************************************************************* @@ -268,7 +321,8 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc) ACPI_FUNCTION_TRACE(ex_system_signal_event); if (obj_desc) { - status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); + status = + acpi_os_signal_semaphore(obj_desc->event.os_semaphore, 1); } return_ACPI_STATUS(status); @@ -299,7 +353,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, if (obj_desc) { status = - acpi_ex_system_wait_semaphore(obj_desc->event.semaphore, + acpi_ex_system_wait_semaphore(obj_desc->event.os_semaphore, (u16) time_desc->integer. value); } @@ -322,7 +376,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) { acpi_status status = AE_OK; - void *temp_semaphore; + acpi_semaphore temp_semaphore; ACPI_FUNCTION_ENTRY(); @@ -333,8 +387,8 @@ acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore); if (ACPI_SUCCESS(status)) { - (void)acpi_os_delete_semaphore(obj_desc->event.semaphore); - obj_desc->event.semaphore = temp_semaphore; + (void)acpi_os_delete_semaphore(obj_desc->event.os_semaphore); + obj_desc->event.os_semaphore = temp_semaphore; } return (status); diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index ae142de..3143f36 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -172,9 +172,9 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) } /* - * The package must have at least two elements. NOTE (March 2005): This + * The package must have at least two elements. NOTE (March 2005): This * goes against the current ACPI spec which defines this object as a - * package with one encoded DWORD element. However, existing practice + * package with one encoded DWORD element. However, existing practice * by BIOS vendors seems to be to have 2 or more elements, at least * one per sleep type (A/B). */ @@ -255,7 +255,7 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) * return_value - Value that was read from the register * Flags - Lock the hardware or not * - * RETURN: Status and the value read from specified Register. Value + * RETURN: Status and the value read from specified Register. Value * returned is normalized to bit0 (is shifted all the way right) * * DESCRIPTION: ACPI bit_register read function. @@ -361,8 +361,8 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) case ACPI_REGISTER_PM1_STATUS: /* - * Status Registers are different from the rest. Clear by - * writing 1, and writing 0 has no effect. So, the only relevant + * Status Registers are different from the rest. Clear by + * writing 1, and writing 0 has no effect. So, the only relevant * information is the single bit we're interested in, all others should * be written as 0 so they will be left unchanged. */ @@ -467,14 +467,13 @@ ACPI_EXPORT_SYMBOL(acpi_set_register) * * FUNCTION: acpi_hw_register_read * - * PARAMETERS: use_lock - Mutex hw access - * register_id - register_iD + Offset + * PARAMETERS: use_lock - Lock hardware? True/False + * register_id - ACPI Register ID * return_value - Where the register value is returned * * RETURN: Status and the value read. * - * DESCRIPTION: Acpi register read function. Registers are read at the - * given offset. + * DESCRIPTION: Read from the specified ACPI register * ******************************************************************************/ acpi_status @@ -580,14 +579,26 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) * * FUNCTION: acpi_hw_register_write * - * PARAMETERS: use_lock - Mutex hw access - * register_id - register_iD + Offset + * PARAMETERS: use_lock - Lock hardware? True/False + * register_id - ACPI Register ID * Value - The value to write * * RETURN: Status * - * DESCRIPTION: Acpi register Write function. Registers are written at the - * given offset. + * DESCRIPTION: Write to the specified ACPI register + * + * NOTE: In accordance with the ACPI specification, this function automatically + * preserves the value of the following bits, meaning that these bits cannot be + * changed via this interface: + * + * PM1_CONTROL[0] = SCI_EN + * PM1_CONTROL[9] + * PM1_STATUS[11] + * + * ACPI References: + * 1) Hardware Ignored Bits: When software writes to a register with ignored + * bit fields, it preserves the ignored bit fields + * 2) SCI_EN: OSPM always preserves this bit position * ******************************************************************************/ @@ -595,6 +606,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) { acpi_status status; acpi_cpu_flags lock_flags = 0; + u32 read_value; ACPI_FUNCTION_TRACE(hw_register_write); @@ -605,6 +617,22 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) switch (register_id) { case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ + /* Perform a read first to preserve certain bits (per ACPI spec) */ + + status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_STATUS, + &read_value); + if (ACPI_FAILURE(status)) { + goto unlock_and_exit; + } + + /* Insert the bits to be preserved */ + + ACPI_INSERT_BITS(value, ACPI_PM1_STATUS_PRESERVED_BITS, + read_value); + + /* Now we can write the data */ + status = acpi_hw_low_level_write(16, value, &acpi_gbl_FADT->xpm1a_evt_blk); @@ -635,6 +663,25 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ + /* + * Perform a read first to preserve certain bits (per ACPI spec) + * + * Note: This includes SCI_EN, we never want to change this bit + */ + status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_CONTROL, + &read_value); + if (ACPI_FAILURE(status)) { + goto unlock_and_exit; + } + + /* Insert the bits to be preserved */ + + ACPI_INSERT_BITS(value, ACPI_PM1_CONTROL_PRESERVED_BITS, + read_value); + + /* Now we can write the data */ + status = acpi_hw_low_level_write(16, value, &acpi_gbl_FADT->xpm1a_cnt_blk); @@ -726,7 +773,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) return (AE_OK); } - /* Get a local copy of the address. Handles possible alignment issues */ + /* Get a local copy of the address. Handles possible alignment issues */ ACPI_MOVE_64_TO_64(&address, ®->address); if (!address) { @@ -798,7 +845,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) return (AE_OK); } - /* Get a local copy of the address. Handles possible alignment issues */ + /* Get a local copy of the address. Handles possible alignment issues */ ACPI_MOVE_64_TO_64(&address, ®->address); if (!address) { diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 48fadad..c1c6c23 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -196,33 +196,30 @@ acpi_status acpi_ns_root_initialize(void) (u8) (ACPI_TO_INTEGER(val) - 1); if (ACPI_STRCMP(init_val->name, "_GL_") == 0) { - /* - * Create a counting semaphore for the - * global lock - */ + + /* Create a counting semaphore for the global lock */ + status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 1, - &obj_desc->mutex.semaphore); + &acpi_gbl_global_lock_semaphore); if (ACPI_FAILURE(status)) { acpi_ut_remove_reference (obj_desc); goto unlock_and_exit; } - /* - * We just created the mutex for the - * global lock, save it - */ - acpi_gbl_global_lock_semaphore = - obj_desc->mutex.semaphore; + /* Mark this mutex as very special */ + + obj_desc->mutex.os_mutex = + ACPI_GLOBAL_LOCK; } else { /* Create a mutex */ - status = acpi_os_create_semaphore(1, 1, - &obj_desc-> - mutex. - semaphore); + status = + acpi_os_create_mutex(&obj_desc-> + mutex. + os_mutex); if (ACPI_FAILURE(status)) { acpi_ut_remove_reference (obj_desc); diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 8e46d1b..afd937b 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -688,18 +688,9 @@ EXPORT_SYMBOL(acpi_os_wait_events_complete); /* * Allocate the memory for a spinlock and initialize it. */ -acpi_status acpi_os_create_lock(acpi_handle * out_handle) +acpi_status acpi_os_create_lock(acpi_spinlock * handle) { - spinlock_t *lock_ptr; - - - lock_ptr = acpi_os_allocate(sizeof(spinlock_t)); - - spin_lock_init(lock_ptr); - - ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating spinlock[%p].\n", lock_ptr)); - - *out_handle = lock_ptr; + spin_lock_init(*handle); return AE_OK; } @@ -707,13 +698,8 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle) /* * Deallocate the memory for a spinlock. */ -void acpi_os_delete_lock(acpi_handle handle) +void acpi_os_delete_lock(acpi_spinlock handle) { - - ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle)); - - acpi_os_free(handle); - return; } @@ -1037,10 +1023,10 @@ EXPORT_SYMBOL(max_cstate); * handle is a pointer to the spinlock_t. */ -acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle) +acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp) { acpi_cpu_flags flags; - spin_lock_irqsave((spinlock_t *) handle, flags); + spin_lock_irqsave(lockp, flags); return flags; } @@ -1048,9 +1034,9 @@ acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle) * Release a spinlock. See above. */ -void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags) +void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags) { - spin_unlock_irqrestore((spinlock_t *) handle, flags); + spin_unlock_irqrestore(lockp, flags); } #ifndef ACPI_USE_LOCAL_CACHE diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 7ee2f2e..a02aa62 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -469,6 +469,16 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } walk_state->thread = thread; + + /* + * If executing a method, the starting sync_level is this method's + * sync_level + */ + if (walk_state->method_desc) { + walk_state->thread->current_sync_level = + walk_state->method_desc->method.sync_level; + } + acpi_ds_push_walk_state(walk_state, thread); /* @@ -505,6 +515,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) status = acpi_ds_call_control_method(thread, walk_state, NULL); + if (ACPI_FAILURE(status)) { + status = + acpi_ds_method_error(status, walk_state); + } /* * If the transfer to the new method method call worked, a new walk @@ -525,7 +539,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) /* Check for possible multi-thread reentrancy problem */ if ((status == AE_ALREADY_EXISTS) && - (!walk_state->method_desc->method.semaphore)) { + (!walk_state->method_desc->method.mutex)) { /* * Method tried to create an object twice. The probable cause is * that the method cannot handle reentrancy. @@ -537,7 +551,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) */ walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED; - walk_state->method_desc->method.concurrency = 1; + walk_state->method_desc->method.sync_level = 0; } } diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 67b9f32..38ebe1c 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -155,21 +155,30 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) case ACPI_TYPE_MUTEX: ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, - "***** Mutex %p, Semaphore %p\n", - object, object->mutex.semaphore)); + "***** Mutex %p, OS Mutex %p\n", + object, object->mutex.os_mutex)); - acpi_ex_unlink_mutex(object); - (void)acpi_os_delete_semaphore(object->mutex.semaphore); + if (object->mutex.os_mutex != ACPI_GLOBAL_LOCK) { + acpi_ex_unlink_mutex(object); + acpi_os_delete_mutex(object->mutex.os_mutex); + } else { + /* Global Lock "mutex" is actually a counting semaphore */ + + (void) + acpi_os_delete_semaphore + (acpi_gbl_global_lock_semaphore); + acpi_gbl_global_lock_semaphore = NULL; + } break; case ACPI_TYPE_EVENT: ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, - "***** Event %p, Semaphore %p\n", - object, object->event.semaphore)); + "***** Event %p, OS Semaphore %p\n", + object, object->event.os_semaphore)); - (void)acpi_os_delete_semaphore(object->event.semaphore); - object->event.semaphore = NULL; + (void)acpi_os_delete_semaphore(object->event.os_semaphore); + object->event.os_semaphore = NULL; break; case ACPI_TYPE_METHOD: @@ -177,12 +186,13 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "***** Method %p\n", object)); - /* Delete the method semaphore if it exists */ + /* Delete the method mutex if it exists */ - if (object->method.semaphore) { - (void)acpi_os_delete_semaphore(object->method. - semaphore); - object->method.semaphore = NULL; + if (object->method.mutex) { + acpi_os_delete_mutex(object->method.mutex->mutex. + os_mutex); + acpi_ut_delete_object_desc(object->method.mutex); + object->method.mutex = NULL; } break; diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index e5999c6..014030a 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -794,6 +794,7 @@ void acpi_ut_init_globals(void) /* Global Lock support */ + acpi_gbl_global_lock_semaphore = NULL; acpi_gbl_global_lock_acquired = FALSE; acpi_gbl_global_lock_thread_count = 0; acpi_gbl_global_lock_handle = 0; diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 25eb343..dfc8f30 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -82,12 +82,9 @@ acpi_status acpi_ut_mutex_initialize(void) /* Create the spinlocks for use at interrupt level */ - status = acpi_os_create_lock(&acpi_gbl_gpe_lock); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + spin_lock_init(acpi_gbl_gpe_lock); + spin_lock_init(acpi_gbl_hardware_lock); - status = acpi_os_create_lock(&acpi_gbl_hardware_lock); return_ACPI_STATUS(status); } @@ -146,9 +143,8 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) } if (!acpi_gbl_mutex_info[mutex_id].mutex) { - status = acpi_os_create_semaphore(1, 1, - &acpi_gbl_mutex_info - [mutex_id].mutex); + status = + acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex); acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[mutex_id].use_count = 0; @@ -171,7 +167,6 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) { - acpi_status status; ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); @@ -179,12 +174,12 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_os_delete_semaphore(acpi_gbl_mutex_info[mutex_id].mutex); + acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex); acpi_gbl_mutex_info[mutex_id].mutex = NULL; acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; - return_ACPI_STATUS(status); + return_ACPI_STATUS(AE_OK); } /******************************************************************************* @@ -251,8 +246,8 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) "Thread %X attempting to acquire Mutex [%s]\n", this_thread_id, acpi_ut_get_mutex_name(mutex_id))); - status = acpi_os_wait_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, - 1, ACPI_WAIT_FOREVER); + status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, + ACPI_WAIT_FOREVER); if (ACPI_SUCCESS(status)) { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", @@ -284,7 +279,6 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) { - acpi_status status; acpi_thread_id this_thread_id; ACPI_FUNCTION_NAME(ut_release_mutex); @@ -340,19 +334,6 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; - status = - acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1); - - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "Thread %X could not release Mutex [%X]", - this_thread_id, mutex_id)); - } else { - ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, - "Thread %X released Mutex [%s]\n", - this_thread_id, - acpi_ut_get_mutex_name(mutex_id))); - } - - return (status); + acpi_os_release_mutex(acpi_gbl_mutex_info[mutex_id].mutex); + return (AE_OK); } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index b9beceb..b492857 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060608 +#define ACPI_CA_VERSION 0x20060623 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 288f849..a22fe9c 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -201,7 +201,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, acpi_status acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, union acpi_operand_object *obj_desc, - struct acpi_namespace_node *calling_method_node); + struct acpi_walk_state *walk_state); acpi_status acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state); diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 14531d4..06972e6 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -181,6 +181,12 @@ ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; extern struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1]; +/***************************************************************************** + * + * Mutual exlusion within ACPICA subsystem + * + ****************************************************************************/ + /* * Predefined mutex objects. This array contains the * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. @@ -188,6 +194,20 @@ extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1]; */ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX]; +/* + * Global lock semaphore works in conjunction with the actual HW global lock + */ +ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore; + +/* + * Spinlocks are used for interfaces that can be possibly called at + * interrupt level + */ +ACPI_EXTERN spinlock_t _acpi_gbl_gpe_lock; /* For GPE data structs and registers */ +ACPI_EXTERN spinlock_t _acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */ +#define acpi_gbl_gpe_lock &_acpi_gbl_gpe_lock +#define acpi_gbl_hardware_lock &_acpi_gbl_hardware_lock + /***************************************************************************** * * Miscellaneous globals @@ -217,7 +237,6 @@ ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; -ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; /* Misc */ @@ -315,11 +334,6 @@ ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; -/* Spinlocks */ - -ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; -ACPI_EXTERN acpi_handle acpi_gbl_hardware_lock; - /***************************************************************************** * * Debugger globals diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 9f22cfc..216339a 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -287,7 +287,10 @@ acpi_ex_system_wait_event(union acpi_operand_object *time, acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc); -acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout); +acpi_status +acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout); + +acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout); /* * exoparg1 - ACPI AML execution, 1 operand diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 1eeca7a..56b8024 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -47,10 +47,11 @@ /* acpisrc:struct_defs -- for acpisrc conversion */ #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ -#define ACPI_INFINITE_CONCURRENCY 0xFF +#define ACPI_DO_NOT_WAIT 0 +#define ACPI_SERIALIZED 0xFF -typedef void *acpi_mutex; typedef u32 acpi_mutex_handle; +#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1) /* Total number of aml opcodes defined */ @@ -79,16 +80,15 @@ union acpi_parse_object; * table below also! */ #define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ -#define ACPI_MTX_CONTROL_METHOD 1 /* Control method termination [TBD: may no longer be necessary] */ -#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */ -#define ACPI_MTX_NAMESPACE 3 /* ACPI Namespace */ -#define ACPI_MTX_EVENTS 4 /* Data for ACPI events */ -#define ACPI_MTX_CACHES 5 /* Internal caches, general purposes */ -#define ACPI_MTX_MEMORY 6 /* Debug memory tracking lists */ -#define ACPI_MTX_DEBUG_CMD_COMPLETE 7 /* AML debugger */ -#define ACPI_MTX_DEBUG_CMD_READY 8 /* AML debugger */ - -#define ACPI_MAX_MUTEX 8 +#define ACPI_MTX_TABLES 1 /* Data for ACPI tables */ +#define ACPI_MTX_NAMESPACE 2 /* ACPI Namespace */ +#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */ +#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */ +#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */ +#define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */ +#define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */ + +#define ACPI_MAX_MUTEX 7 #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) @@ -98,14 +98,13 @@ union acpi_parse_object; static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { "ACPI_MTX_Interpreter", - "ACPI_MTX_Method", "ACPI_MTX_Tables", "ACPI_MTX_Namespace", "ACPI_MTX_Events", "ACPI_MTX_Caches", "ACPI_MTX_Memory", - "ACPI_MTX_DebugCmdComplete", - "ACPI_MTX_DebugCmdReady" + "ACPI_MTX_CommandComplete", + "ACPI_MTX_CommandReady" }; #endif @@ -705,6 +704,13 @@ struct acpi_bit_register_info { }; /* + * Some ACPI registers have bits that must be ignored -- meaning that they + * must be preserved. + */ +#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */ +#define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0201 /* Bit 9, Bit 0 (SCI_EN) */ + +/* * Register IDs * These are the full ACPI registers */ diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 38f9aa4..4bb3806 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -394,6 +394,8 @@ #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) +#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) + /* Generate a UUID */ #define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index 1747d94..8fdee31 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h @@ -140,14 +140,14 @@ struct acpi_object_package { *****************************************************************************/ struct acpi_object_event { - ACPI_OBJECT_COMMON_HEADER void *semaphore; + ACPI_OBJECT_COMMON_HEADER acpi_semaphore os_semaphore; /* Actual OS synchronization object */ }; struct acpi_object_mutex { ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ u16 acquisition_depth; /* Allow multiple Acquires, same thread */ struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ - void *semaphore; /* Actual OS synchronization object */ + acpi_mutex os_mutex; /* Actual OS synchronization object */ union acpi_operand_object *prev; /* Link for list of acquired mutexes */ union acpi_operand_object *next; /* Link for list of acquired mutexes */ struct acpi_namespace_node *node; /* Containing namespace node */ @@ -166,8 +166,8 @@ struct acpi_object_region { struct acpi_object_method { ACPI_OBJECT_COMMON_HEADER u8 method_flags; u8 param_count; - u8 concurrency; - void *semaphore; + u8 sync_level; + union acpi_operand_object *mutex; u8 *aml_start; ACPI_INTERNAL_METHOD implementation; u32 aml_length; diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 8f473c8..89bc4a1 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -96,25 +96,47 @@ acpi_os_table_override(struct acpi_table_header *existing_table, struct acpi_table_header **new_table); /* - * Synchronization primitives + * Spinlock primitives + */ +acpi_status acpi_os_create_lock(acpi_spinlock * out_handle); + +void acpi_os_delete_lock(acpi_spinlock handle); + +acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock handle); + +void acpi_os_release_lock(acpi_spinlock handle, acpi_cpu_flags flags); + +/* + * Semaphore primitives */ acpi_status acpi_os_create_semaphore(u32 max_units, - u32 initial_units, acpi_handle * out_handle); + u32 initial_units, acpi_semaphore * out_handle); -acpi_status acpi_os_delete_semaphore(acpi_handle handle); +acpi_status acpi_os_delete_semaphore(acpi_semaphore handle); -acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout); +acpi_status +acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout); + +acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units); + +/* + * Mutex primitives + */ +acpi_status acpi_os_create_mutex(acpi_mutex * out_handle); -acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units); +void acpi_os_delete_mutex(acpi_mutex handle); -acpi_status acpi_os_create_lock(acpi_handle * out_handle); +acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout); -void acpi_os_delete_lock(acpi_handle handle); +void acpi_os_release_mutex(acpi_mutex handle); -acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle); +/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */ -void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags); +#define acpi_os_create_mutex(out_handle) acpi_os_create_semaphore (1, 1, out_handle) +#define acpi_os_delete_mutex(handle) (void) acpi_os_delete_semaphore (handle) +#define acpi_os_acquire_mutex(handle,time) acpi_os_wait_semaphore (handle, 1, time) +#define acpi_os_release_mutex(handle) (void) acpi_os_signal_semaphore (handle, 1) /* * Memory allocation and mapping diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 77cf123..64b603c 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -241,7 +241,7 @@ typedef acpi_native_uint acpi_size; /******************************************************************************* * - * OS- or compiler-dependent types + * OS-dependent and compiler-dependent types * * If the defaults below are not appropriate for the host system, they can * be defined in the compiler-specific or OS-specific header, and this will @@ -249,29 +249,36 @@ typedef acpi_native_uint acpi_size; * ******************************************************************************/ -/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ +/* Value returned by acpi_os_get_thread_id */ -#ifndef acpi_uintptr_t -#define acpi_uintptr_t void * +#ifndef acpi_thread_id +#define acpi_thread_id acpi_native_uint #endif -/* - * If acpi_cache_t was not defined in the OS-dependent header, - * define it now. This is typically the case where the local cache - * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) - */ -#ifndef acpi_cache_t -#define acpi_cache_t struct acpi_memory_list +/* Object returned from acpi_os_create_lock */ + +#ifndef acpi_spinlock +#define acpi_spinlock void * #endif -/* - * Allow the CPU flags word to be defined per-OS to simplify the use of the - * lock and unlock OSL interfaces. - */ +/* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ + #ifndef acpi_cpu_flags #define acpi_cpu_flags acpi_native_uint #endif +/* Object returned from acpi_os_create_cache */ + +#ifndef acpi_cache_t +#define acpi_cache_t struct acpi_memory_list +#endif + +/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ + +#ifndef acpi_uintptr_t +#define acpi_uintptr_t void * +#endif + /* * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because * some compilers can catch printf format string problems @@ -298,13 +305,6 @@ typedef acpi_native_uint acpi_size; #define ACPI_EXPORT_SYMBOL(symbol) #endif -/* - * thread_id is returned by acpi_os_get_thread_id. - */ -#ifndef acpi_thread_id -#define acpi_thread_id acpi_native_uint -#endif - /******************************************************************************* * * Independent types @@ -380,6 +380,11 @@ struct uint32_struct { u32 hi; }; +/* Synchronization objects */ + +#define acpi_mutex void * +#define acpi_semaphore void * + /* * Acpi integer width. In ACPI version 1, integers are * 32 bits. In ACPI version 2, integers are 64 bits. diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 277d35b..3f853ca 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -58,11 +58,13 @@ #include #include #include +#include /* Host-dependent types and defines */ #define ACPI_MACHINE_WIDTH BITS_PER_LONG #define acpi_cache_t kmem_cache_t +#define acpi_spinlock spinlock_t * #define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); #define strtoul simple_strtoul -- cgit v0.10.2 From a3c6598f92cf27d3d201a2a5b052563148156837 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 24 Jun 2006 19:37:00 -0400 Subject: ACPI: C-States: accounting of sleep states Track the actual time spent in C-States (C2 upwards, we can't determine this for C1), not only the number of invocations. This is especially useful for dynamic ticks / "tickless systems", but is also of interest on normal systems, as any interrupt activity leads to C-States being exited, not only the timer interrupt. The time is being measured in PM timer ticks, so an increase by one equals 279 nanoseconds. Signed-off-by: Dominik Brodowski Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 89d3fd4..6d1e238 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -322,8 +322,6 @@ static void acpi_processor_idle(void) cx = &pr->power.states[ACPI_STATE_C1]; #endif - cx->usage++; - /* * Sleep: * ------ @@ -430,6 +428,9 @@ static void acpi_processor_idle(void) local_irq_enable(); return; } + cx->usage++; + if ((cx->type != ACPI_STATE_C1) && (sleep_ticks > 0)) + cx->time += sleep_ticks; next_state = pr->power.state; @@ -1053,9 +1054,10 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) else seq_puts(seq, "demotion[--] "); - seq_printf(seq, "latency[%03d] usage[%08d]\n", + seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n", pr->power.states[i].latency, - pr->power.states[i].usage); + pr->power.states[i].usage, + pr->power.states[i].time); } end: diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 77371b3..9dd5b75 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -62,6 +62,7 @@ struct acpi_processor_cx { u32 latency_ticks; u32 power; u32 usage; + u64 time; struct acpi_processor_cx_policy promotion; struct acpi_processor_cx_policy demotion; }; -- cgit v0.10.2 From c5ab81ca01ad4a8870b456f93dd2fb3d815f91d9 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 24 Jun 2006 19:37:00 -0400 Subject: ACPI: C-States: bm_activity improvements Do not assume there was bus mastering activity if the idle handler didn't get called, as there's only reason to not enter C3-type sleep if there is bus master activity going on. Only for the "promotion" into C3-type sleep bus mastering activity is taken into account, and there only current bus mastering activity, and not pure guessing should lead to the decision on whether to enter C3-type sleep or not. Also, as bm_activity is a jiffy-based bitmask (bit 0: bus mastering activity during this juffy, bit 31: bus mastering activity 31 jiffies ago), fix the setting of bit 0, as it might be called multiple times within one jiffy. Signed-off-by: Dominik Brodowski Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 6d1e238..af9f2af 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -3,7 +3,7 @@ * * Copyright (C) 2001, 2002 Andy Grover * Copyright (C) 2001, 2002 Paul Diefenbaugh - * Copyright (C) 2004 Dominik Brodowski + * Copyright (C) 2004, 2005 Dominik Brodowski * Copyright (C) 2004 Anil S Keshavamurthy * - Added processor hotplug support * Copyright (C) 2005 Venkatesh Pallipadi @@ -261,21 +261,15 @@ static void acpi_processor_idle(void) u32 bm_status = 0; unsigned long diff = jiffies - pr->power.bm_check_timestamp; - if (diff > 32) - diff = 32; + if (diff > 31) + diff = 31; - while (diff) { - /* if we didn't get called, assume there was busmaster activity */ - diff--; - if (diff) - pr->power.bm_activity |= 0x1; - pr->power.bm_activity <<= 1; - } + pr->power.bm_activity <<= diff; acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status, ACPI_MTX_DO_NOT_LOCK); if (bm_status) { - pr->power.bm_activity++; + pr->power.bm_activity |= 0x1; acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); } @@ -287,7 +281,7 @@ static void acpi_processor_idle(void) else if (errata.piix4.bmisx) { if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) - pr->power.bm_activity++; + pr->power.bm_activity |= 0x1; } pr->power.bm_check_timestamp = jiffies; -- cgit v0.10.2 From c4a001b1ea32e09f7556178249b8885418858b5c Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 24 Jun 2006 19:37:00 -0400 Subject: ACPI: C-States: only demote on current bus mastering activity Only if bus master activity is going on at the present, we should avoid entering C3-type sleep, as it might be a faulty transition. As long as the bm_activity bitmask was based on the number of calls to the ACPI idle function, looking at previous moments made sense. Now, with it being based on what happened this jiffy, looking at this jiffy should be sufficient. Signed-off-by: Dominik Brodowski Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index af9f2af..f8d2b2f 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -287,10 +287,10 @@ static void acpi_processor_idle(void) pr->power.bm_check_timestamp = jiffies; /* - * Apply bus mastering demotion policy. Automatically demote + * If bus mastering is or was active this jiffy, demote * to avoid a faulty transition. Note that the processor * won't enter a low-power state during this call (to this - * funciton) but should upon the next. + * function) but should upon the next. * * TBD: A better policy might be to fallback to the demotion * state (use it for this quantum only) istead of @@ -298,7 +298,8 @@ static void acpi_processor_idle(void) * qualification. This may, however, introduce DMA * issues (e.g. floppy DMA transfer overrun/underrun). */ - if (pr->power.bm_activity & cx->demotion.threshold.bm) { + if ((pr->power.bm_activity & 0x1) && + cx->demotion.threshold.bm) { local_irq_enable(); next_state = cx->demotion.state; goto end; -- cgit v0.10.2 From b488f02156d3deb08f5ad7816d565c370a8cc6f1 Mon Sep 17 00:00:00 2001 From: Andreas Mohr <[andi@rhlx01.fht-esslingen.de]> Date: Mon, 26 Jun 2006 15:58:00 -0400 Subject: ACPI: restore comment justifying 'extra' P_LVLx access While trying to look for superfluous I/O accesses that can be optimized away, I stumbled upon this ACPI sleep I/O access and couldn't figure out why the hell this dummy op was necessary. After more than one hour of internet research, I had collected a sufficient number of documents (among those very old kernel versions) that finally told me what this dummy read was about: STPCLK# doesn't get asserted in time on (some) chipsets, which is why we need to have a dummy I/O read to delay further instruction processing until the CPU is fully stopped. Signed-off-by: Andreas Mohr Signed-off-by: Len Brown diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 89d3fd4..5551bfb 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -365,7 +365,9 @@ static void acpi_processor_idle(void) t1 = inl(acpi_fadt.xpm_tmr_blk.address); /* Invoke C2 */ inb(cx->address); - /* Dummy op - must do something useless after P_LVL2 read */ + /* Dummy wait op - must do something useless after P_LVL2 read + because chipsets cannot guarantee that STPCLK# signal + gets asserted in time to freeze execution properly. */ t2 = inl(acpi_fadt.xpm_tmr_blk.address); /* Get end time (ticks) */ t2 = inl(acpi_fadt.xpm_tmr_blk.address); @@ -403,7 +405,7 @@ static void acpi_processor_idle(void) t1 = inl(acpi_fadt.xpm_tmr_blk.address); /* Invoke C3 */ inb(cx->address); - /* Dummy op - must do something useless after P_LVL3 read */ + /* Dummy wait op (see above) */ t2 = inl(acpi_fadt.xpm_tmr_blk.address); /* Get end time (ticks) */ t2 = inl(acpi_fadt.xpm_tmr_blk.address); -- cgit v0.10.2 From f831335d42a9aed26449a264266763fb542dbbe3 Mon Sep 17 00:00:00 2001 From: Bartlomiej Swiercz Date: Mon, 29 May 2006 07:16:00 -0400 Subject: ACPI: additional blacklist entry for ThinkPad R40e Signed-off-by: Len Brown diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 5551bfb..2278b21 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -99,6 +99,9 @@ static int set_max_cstate(struct dmi_system_id *id) static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = { { set_max_cstate, "IBM ThinkPad R40e", { DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET70WW")}, (void *)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW")}, (void *)1}, { set_max_cstate, "IBM ThinkPad R40e", { DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), -- cgit v0.10.2 From 49fee981fa98f3c0a21f3d6c8193eddcc15e84e9 Mon Sep 17 00:00:00 2001 From: Vladimir Lebedev Date: Tue, 20 Jun 2006 16:46:00 -0400 Subject: ACPI: fix battery on HP NX6125 EC problem was cause of both battery and AC issues. http://bugzilla.kernel.org/show_bug.cgi?id=6455 Signed-off-by: Len Brown diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 874f912..8c5d7df 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -213,7 +213,7 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) switch (event) { case ACPI_EC_EVENT_IBE: - if (~acpi_ec_read_status(ec) & event) { + if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) { ec->intr.expect_event = 0; return 0; } @@ -782,12 +782,15 @@ static u32 acpi_ec_gpe_intr_handler(void *data) case ACPI_EC_EVENT_OBF: if (!(value & ACPI_EC_FLAG_OBF)) break; + ec->intr.expect_event = 0; + wake_up(&ec->intr.wait); + break; case ACPI_EC_EVENT_IBE: if ((value & ACPI_EC_FLAG_IBF)) break; ec->intr.expect_event = 0; wake_up(&ec->intr.wait); - return ACPI_INTERRUPT_HANDLED; + break; default: break; } -- cgit v0.10.2 From 0a1f1ab8de815cb63a48d24450f6b5fbb1b1f89c Mon Sep 17 00:00:00 2001 From: "akpm@osdl.org" Date: Fri, 30 Jun 2006 03:15:00 -0400 Subject: ACPI: fixup memhotplug debug message Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 6f5e395..cd57372 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -248,7 +248,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) num_enabled++; } if (!num_enabled) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); + printk(KERN_ERR PREFIX "add_memory failed\n"); mem_device->state = MEMORY_INVALID_STATE; return -EINVAL; } -- cgit v0.10.2 From 9e5289f4dd2326fb8c0a3af23a954158ca99c354 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 30 Jun 2006 05:15:00 -0400 Subject: ACPI: drivers/acpi/scan.c: make acpi_bus_type static Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 401e723..861ac37 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1433,7 +1433,7 @@ static int acpi_device_resume(struct device * dev) } -struct bus_type acpi_bus_type = { +static struct bus_type acpi_bus_type = { .name = "acpi", .suspend = acpi_device_suspend, .resume = acpi_device_resume, -- cgit v0.10.2 From 55910b28f7ca80af8fdfac84ddd6ece201a5928b Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 30 Jun 2006 05:15:00 -0400 Subject: ACPI: Kconfig: ACPI_SRAT depends on ACPI arch/i386/kernel/srat.c won't compile without CONFIG_ACPI. Signed-off-by: Andrew Morton Signed-off-by: Len Brown diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 1718429..27d8ddd 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig @@ -176,7 +176,7 @@ endchoice config ACPI_SRAT bool default y - depends on NUMA && (X86_SUMMIT || X86_GENERICARCH) + depends on ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH) select ACPI_NUMA config HAVE_ARCH_PARSE_SRAT -- cgit v0.10.2