Commit 3e8d6ad9 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (25 commits)
  ACPI: Kconfig: ACPI_SRAT depends on ACPI
  ACPI: drivers/acpi/scan.c: make acpi_bus_type static
  ACPI: fixup memhotplug debug message
  ACPI: ACPICA 20060623
  ACPI: C-States: only demote on current bus mastering activity
  ACPI: C-States: bm_activity improvements
  ACPI: C-States: accounting of sleep states
  ACPI: additional blacklist entry for ThinkPad R40e
  ACPI: restore comment justifying 'extra' P_LVLx access
  ACPI: fix battery on HP NX6125
  ACPIPHP: prevent duplicate slot numbers when no _SUN
  ACPI: static-ize handle_hotplug_event_func()
  ACPIPHP: use ACPI dock driver
  ACPI: dock driver
  KEVENT: add new uevent for dock
  ACPI: asus_acpi_init: propagate correct return value
  [ACPI] Print error message if remove/install notify handler fails
  ACPI: delete tracing macros from drivers/acpi/*.c
  ACPI: HW P-state coordination support
  ACPI: un-export ACPI_ERROR() -- use printk(KERN_ERR...)
  ...
parents 598736c5 55910b28
...@@ -176,7 +176,7 @@ endchoice ...@@ -176,7 +176,7 @@ endchoice
config ACPI_SRAT config ACPI_SRAT
bool bool
default y default y
depends on NUMA && (X86_SUMMIT || X86_GENERICARCH) depends on ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH)
select ACPI_NUMA select ACPI_NUMA
config HAVE_ARCH_PARSE_SRAT config HAVE_ARCH_PARSE_SRAT
......
...@@ -418,8 +418,14 @@ acpi_cpufreq_cpu_init ( ...@@ -418,8 +418,14 @@ acpi_cpufreq_cpu_init (
goto err_free; goto err_free;
perf = data->acpi_data; perf = data->acpi_data;
policy->cpus = perf->shared_cpu_map;
policy->shared_type = perf->shared_type; 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)) { if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;
......
...@@ -399,8 +399,14 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) ...@@ -399,8 +399,14 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
dprintk(PFX "obtaining ACPI data failed\n"); dprintk(PFX "obtaining ACPI data failed\n");
return -EIO; return -EIO;
} }
policy->cpus = p->shared_cpu_map;
policy->shared_type = p->shared_type; 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 */ /* verify the acpi_data */
if (p->state_count <= 1) { if (p->state_count <= 1) {
......
...@@ -133,6 +133,13 @@ config ACPI_FAN ...@@ -133,6 +133,13 @@ config ACPI_FAN
This driver adds support for ACPI fan devices, allowing user-mode This driver adds support for ACPI fan devices, allowing user-mode
applications to perform basic fan control (on, off, status). 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 config ACPI_PROCESSOR
tristate "Processor" tristate "Processor"
default y default y
......
...@@ -42,6 +42,7 @@ obj-$(CONFIG_ACPI_BATTERY) += battery.o ...@@ -42,6 +42,7 @@ obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_BUTTON) += button.o obj-$(CONFIG_ACPI_BUTTON) += button.o
obj-$(CONFIG_ACPI_EC) += ec.o obj-$(CONFIG_ACPI_EC) += ec.o
obj-$(CONFIG_ACPI_FAN) += fan.o obj-$(CONFIG_ACPI_FAN) += fan.o
obj-$(CONFIG_ACPI_DOCK) += dock.o
obj-$(CONFIG_ACPI_VIDEO) += video.o obj-$(CONFIG_ACPI_VIDEO) += video.o
obj-$(CONFIG_ACPI_HOTKEY) += hotkey.o obj-$(CONFIG_ACPI_HOTKEY) += hotkey.o
obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
......
...@@ -84,20 +84,18 @@ static int acpi_ac_get_state(struct acpi_ac *ac) ...@@ -84,20 +84,18 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_ac_get_state");
if (!ac) if (!ac)
return_VALUE(-EINVAL); return -EINVAL;
status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state); status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state"));
"Error reading AC Adapter state\n"));
ac->state = ACPI_AC_STATUS_UNKNOWN; ac->state = ACPI_AC_STATUS_UNKNOWN;
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -110,14 +108,13 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset) ...@@ -110,14 +108,13 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_ac *ac = (struct acpi_ac *)seq->private; struct acpi_ac *ac = (struct acpi_ac *)seq->private;
ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
if (!ac) if (!ac)
return_VALUE(0); return 0;
if (acpi_ac_get_state(ac)) { if (acpi_ac_get_state(ac)) {
seq_puts(seq, "ERROR: Unable to read AC Adapter state\n"); seq_puts(seq, "ERROR: Unable to read AC Adapter state\n");
return_VALUE(0); return 0;
} }
seq_puts(seq, "state: "); seq_puts(seq, "state: ");
...@@ -133,7 +130,7 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset) ...@@ -133,7 +130,7 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
break; break;
} }
return_VALUE(0); return 0;
} }
static int acpi_ac_open_fs(struct inode *inode, struct file *file) static int acpi_ac_open_fs(struct inode *inode, struct file *file)
...@@ -145,13 +142,12 @@ static int acpi_ac_add_fs(struct acpi_device *device) ...@@ -145,13 +142,12 @@ static int acpi_ac_add_fs(struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_ac_dir); acpi_ac_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
} }
...@@ -159,21 +155,18 @@ static int acpi_ac_add_fs(struct acpi_device *device) ...@@ -159,21 +155,18 @@ static int acpi_ac_add_fs(struct acpi_device *device)
entry = create_proc_entry(ACPI_AC_FILE_STATE, entry = create_proc_entry(ACPI_AC_FILE_STATE,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, return -ENODEV;
"Unable to create '%s' fs entry\n",
ACPI_AC_FILE_STATE));
else { else {
entry->proc_fops = &acpi_ac_fops; entry->proc_fops = &acpi_ac_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VALUE(0); return 0;
} }
static int acpi_ac_remove_fs(struct acpi_device *device) static int acpi_ac_remove_fs(struct acpi_device *device)
{ {
ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device)); remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device));
...@@ -182,7 +175,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device) ...@@ -182,7 +175,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -194,13 +187,12 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) ...@@ -194,13 +187,12 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
struct acpi_ac *ac = (struct acpi_ac *)data; struct acpi_ac *ac = (struct acpi_ac *)data;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_notify");
if (!ac) if (!ac)
return_VOID; return;
if (acpi_bus_get_device(ac->handle, &device)) if (acpi_bus_get_device(ac->handle, &device))
return_VOID; return;
switch (event) { switch (event) {
case ACPI_AC_NOTIFY_STATUS: case ACPI_AC_NOTIFY_STATUS:
...@@ -213,7 +205,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) ...@@ -213,7 +205,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
break; break;
} }
return_VOID; return;
} }
static int acpi_ac_add(struct acpi_device *device) static int acpi_ac_add(struct acpi_device *device)
...@@ -222,14 +214,13 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -222,14 +214,13 @@ static int acpi_ac_add(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_ac *ac = NULL; struct acpi_ac *ac = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL); ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL);
if (!ac) if (!ac)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(ac, 0, sizeof(struct acpi_ac)); memset(ac, 0, sizeof(struct acpi_ac));
ac->handle = device->handle; ac->handle = device->handle;
...@@ -249,8 +240,6 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -249,8 +240,6 @@ static int acpi_ac_add(struct acpi_device *device)
ACPI_DEVICE_NOTIFY, acpi_ac_notify, ACPI_DEVICE_NOTIFY, acpi_ac_notify,
ac); ac);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error installing notify handler\n"));
result = -ENODEV; result = -ENODEV;
goto end; goto end;
} }
...@@ -265,7 +254,7 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -265,7 +254,7 @@ static int acpi_ac_add(struct acpi_device *device)
kfree(ac); kfree(ac);
} }
return_VALUE(result); return result;
} }
static int acpi_ac_remove(struct acpi_device *device, int type) static int acpi_ac_remove(struct acpi_device *device, int type)
...@@ -273,55 +262,49 @@ static int acpi_ac_remove(struct acpi_device *device, int type) ...@@ -273,55 +262,49 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_ac *ac = NULL; struct acpi_ac *ac = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
ac = (struct acpi_ac *)acpi_driver_data(device); ac = (struct acpi_ac *)acpi_driver_data(device);
status = acpi_remove_notify_handler(ac->handle, status = acpi_remove_notify_handler(ac->handle,
ACPI_DEVICE_NOTIFY, acpi_ac_notify); 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); acpi_ac_remove_fs(device);
kfree(ac); kfree(ac);
return_VALUE(0); return 0;
} }
static int __init acpi_ac_init(void) static int __init acpi_ac_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_ac_init");
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
if (!acpi_ac_dir) if (!acpi_ac_dir)
return_VALUE(-ENODEV); return -ENODEV;
acpi_ac_dir->owner = THIS_MODULE; acpi_ac_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_ac_driver); result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
static void __exit acpi_ac_exit(void) static void __exit acpi_ac_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_ac_exit");
acpi_bus_unregister_driver(&acpi_ac_driver); acpi_bus_unregister_driver(&acpi_ac_driver);
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
return_VOID; return;
} }
module_init(acpi_ac_init); module_init(acpi_ac_init);
......
This diff is collapsed.
...@@ -1232,7 +1232,7 @@ static int __init asus_acpi_init(void) ...@@ -1232,7 +1232,7 @@ static int __init asus_acpi_init(void)
result = acpi_bus_register_driver(&asus_hotk_driver); result = acpi_bus_register_driver(&asus_hotk_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(PROC_ASUS, acpi_root_dir); remove_proc_entry(PROC_ASUS, acpi_root_dir);
return -ENODEV; return result;
} }
/* /*
......
This diff is collapsed.
This diff is collapsed.
...@@ -112,15 +112,14 @@ static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) ...@@ -112,15 +112,14 @@ static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_button *button = (struct acpi_button *)seq->private; struct acpi_button *button = (struct acpi_button *)seq->private;
ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
if (!button || !button->device) if (!button || !button->device)
return_VALUE(0); return 0;
seq_printf(seq, "type: %s\n", seq_printf(seq, "type: %s\n",
acpi_device_name(button->device)); acpi_device_name(button->device));
return_VALUE(0); return 0;
} }
static int acpi_button_info_open_fs(struct inode *inode, struct file *file) static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
...@@ -134,10 +133,9 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) ...@@ -134,10 +133,9 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
acpi_status status; acpi_status status;
unsigned long state; unsigned long state;
ACPI_FUNCTION_TRACE("acpi_button_state_seq_show");
if (!button || !button->device) if (!button || !button->device)
return_VALUE(0); return 0;
status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state); status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -147,7 +145,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) ...@@ -147,7 +145,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
(state ? "open" : "closed")); (state ? "open" : "closed"));
} }
return_VALUE(0); return 0;
} }
static int acpi_button_state_open_fs(struct inode *inode, struct file *file) static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
...@@ -164,10 +162,9 @@ static int acpi_button_add_fs(struct acpi_device *device) ...@@ -164,10 +162,9 @@ static int acpi_button_add_fs(struct acpi_device *device)
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
struct acpi_button *button = NULL; struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_add_fs");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
button = acpi_driver_data(device); button = acpi_driver_data(device);
...@@ -195,21 +192,19 @@ static int acpi_button_add_fs(struct acpi_device *device) ...@@ -195,21 +192,19 @@ static int acpi_button_add_fs(struct acpi_device *device)
} }
if (!entry) if (!entry)
return_VALUE(-ENODEV); return -ENODEV;
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
/* 'info' [R] */ /* 'info' [R] */
entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, return -ENODEV;
"Unable to create '%s' fs entry\n",
ACPI_BUTTON_FILE_INFO));
else { else {
entry->proc_fops = &acpi_button_info_fops; entry->proc_fops = &acpi_button_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -221,9 +216,7 @@ static int acpi_button_add_fs(struct acpi_device *device) ...@@ -221,9 +216,7 @@ static int acpi_button_add_fs(struct acpi_device *device)
entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, entry = create_proc_entry(ACPI_BUTTON_FILE_STATE,
S_IRUGO, acpi_device_dir(device)); S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, return -ENODEV;
"Unable to create '%s' fs entry\n",
ACPI_BUTTON_FILE_INFO));
else { else {
entry->proc_fops = &acpi_button_state_fops; entry->proc_fops = &acpi_button_state_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
...@@ -231,14 +224,13 @@ static int acpi_button_add_fs(struct acpi_device *device) ...@@ -231,14 +224,13 @@ static int acpi_button_add_fs(struct acpi_device *device)
} }
} }
return_VALUE(0); return 0;
} }
static int acpi_button_remove_fs(struct acpi_device *device) static int acpi_button_remove_fs(struct acpi_device *device)
{ {
struct acpi_button *button = NULL; struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
button = acpi_driver_data(device); button = acpi_driver_data(device);
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
...@@ -253,7 +245,7 @@ static int acpi_button_remove_fs(struct acpi_device *device) ...@@ -253,7 +245,7 @@ static int acpi_button_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -264,10 +256,9 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) ...@@ -264,10 +256,9 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
{ {
struct acpi_button *button = (struct acpi_button *)data; struct acpi_button *button = (struct acpi_button *)data;
ACPI_FUNCTION_TRACE("acpi_button_notify");
if (!button || !button->device) if (!button || !button->device)
return_VOID; return;
switch (event) { switch (event) {
case ACPI_BUTTON_NOTIFY_STATUS: case ACPI_BUTTON_NOTIFY_STATUS:
...@@ -280,21 +271,20 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) ...@@ -280,21 +271,20 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
break; break;
} }
return_VOID; return;
} }
static acpi_status acpi_button_notify_fixed(void *data) static acpi_status acpi_button_notify_fixed(void *data)
{ {
struct acpi_button *button = (struct acpi_button *)data; struct acpi_button *button = (struct acpi_button *)data;
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
if (!button) if (!button)
return_ACPI_STATUS(AE_BAD_PARAMETER); return AE_BAD_PARAMETER;
acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
static int acpi_button_add(struct acpi_device *device) static int acpi_button_add(struct acpi_device *device)
...@@ -303,14 +293,13 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -303,14 +293,13 @@ static int acpi_button_add(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_button *button = NULL; struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL); button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL);
if (!button) if (!button)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(button, 0, sizeof(struct acpi_button)); memset(button, 0, sizeof(struct acpi_button));
button->device = device; button->device = device;
...@@ -349,8 +338,8 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -349,8 +338,8 @@ static int acpi_button_add(struct acpi_device *device)
sprintf(acpi_device_class(device), "%s/%s", sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
} else { } else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n", printk(KERN_ERR PREFIX "Unsupported hid [%s]\n",
acpi_device_hid(device))); acpi_device_hid(device));
result = -ENODEV; result = -ENODEV;
goto end; goto end;
} }
...@@ -381,8 +370,6 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -381,8 +370,6 @@ static int acpi_button_add(struct acpi_device *device)
} }
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error installing notify handler\n"));
result = -ENODEV; result = -ENODEV;
goto end; goto end;
} }
...@@ -406,7 +393,7 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -406,7 +393,7 @@ static int acpi_button_add(struct acpi_device *device)
kfree(button); kfree(button);
} }
return_VALUE(result); return result;
} }
static int acpi_button_remove(struct acpi_device *device, int type) static int acpi_button_remove(struct acpi_device *device, int type)
...@@ -414,10 +401,9 @@ static int acpi_button_remove(struct acpi_device *device, int type) ...@@ -414,10 +401,9 @@ static int acpi_button_remove(struct acpi_device *device, int type)
acpi_status status = 0; acpi_status status = 0;
struct acpi_button *button = NULL; struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
button = acpi_driver_data(device); button = acpi_driver_data(device);
...@@ -440,39 +426,33 @@ static int acpi_button_remove(struct acpi_device *device, int type) ...@@ -440,39 +426,33 @@ static int acpi_button_remove(struct acpi_device *device, int type)
break; break;
} }
if (ACPI_FAILURE(status))
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error removing notify handler\n"));
acpi_button_remove_fs(device); acpi_button_remove_fs(device);
kfree(button); kfree(button);
return_VALUE(0); return 0;
} }
static int __init acpi_button_init(void) static int __init acpi_button_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_button_init");
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
if (!acpi_button_dir) if (!acpi_button_dir)
return_VALUE(-ENODEV); return -ENODEV;
acpi_button_dir->owner = THIS_MODULE; acpi_button_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_button_driver); result = acpi_bus_register_driver(&acpi_button_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
static void __exit acpi_button_exit(void) static void __exit acpi_button_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_button_exit");
acpi_bus_unregister_driver(&acpi_button_driver); acpi_bus_unregister_driver(&acpi_button_driver);
...@@ -484,7 +464,7 @@ static void __exit acpi_button_exit(void) ...@@ -484,7 +464,7 @@ static void __exit acpi_button_exit(void)
remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VOID; return;
} }
module_init(acpi_button_init); module_init(acpi_button_init);
......
...@@ -73,17 +73,16 @@ static int is_device_present(acpi_handle handle) ...@@ -73,17 +73,16 @@ static int is_device_present(acpi_handle handle)
acpi_status status; acpi_status status;
unsigned long sta; unsigned long sta;
ACPI_FUNCTION_TRACE("is_device_present");
status = acpi_get_handle(handle, "_STA", &temp); status = acpi_get_handle(handle, "_STA", &temp);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(1); /* _STA not found, assmue device present */ return 1; /* _STA not found, assmue device present */
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(0); /* Firmware error */ return 0; /* Firmware error */
return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT); return ((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
} }
/*******************************************************************/ /*******************************************************************/
...@@ -91,16 +90,15 @@ static int acpi_container_add(struct acpi_device *device) ...@@ -91,16 +90,15 @@ static int acpi_container_add(struct acpi_device *device)
{ {
struct acpi_container *container; struct acpi_container *container;
ACPI_FUNCTION_TRACE("acpi_container_add");
if (!device) { if (!device) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "device is NULL\n")); printk(KERN_ERR PREFIX "device is NULL\n");
return_VALUE(-EINVAL); return -EINVAL;
} }
container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL); container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
if (!container) if (!container)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(container, 0, sizeof(struct acpi_container)); memset(container, 0, sizeof(struct acpi_container));
container->handle = device->handle; container->handle = device->handle;
...@@ -111,7 +109,7 @@ static int acpi_container_add(struct acpi_device *device) ...@@ -111,7 +109,7 @@ static int acpi_container_add(struct acpi_device *device)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",
acpi_device_name(device), acpi_device_bid(device))); acpi_device_name(device), acpi_device_bid(device)));
return_VALUE(0); return 0;
} }
static int acpi_container_remove(struct acpi_device *device, int type) static int acpi_container_remove(struct acpi_device *device, int type)
...@@ -130,23 +128,22 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle) ...@@ -130,23 +128,22 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle)
struct acpi_device *pdev; struct acpi_device *pdev;
int result; int result;
ACPI_FUNCTION_TRACE("container_device_add");
if (acpi_get_parent(handle, &phandle)) { if (acpi_get_parent(handle, &phandle)) {
return_VALUE(-ENODEV); return -ENODEV;
} }
if (acpi_bus_get_device(phandle, &pdev)) { if (acpi_bus_get_device(phandle, &pdev)) {
return_VALUE(-ENODEV); return -ENODEV;
} }
if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) { if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) {
return_VALUE(-ENODEV); return -ENODEV;
} }
result = acpi_bus_start(*device); result = acpi_bus_start(*device);
return_VALUE(result); return result;
} }
static void container_notify_cb(acpi_handle handle, u32 type, void *context) static void container_notify_cb(acpi_handle handle, u32 type, void *context)
...@@ -156,7 +153,6 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) ...@@ -156,7 +153,6 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
int present; int present;
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE("container_notify_cb");
present = is_device_present(handle); present = is_device_present(handle);
...@@ -192,7 +188,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) ...@@ -192,7 +188,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
default: default:
break; break;
} }
return_VOID; return;
} }
static acpi_status static acpi_status
...@@ -205,11 +201,10 @@ container_walk_namespace_cb(acpi_handle handle, ...@@ -205,11 +201,10 @@ container_walk_namespace_cb(acpi_handle handle,
acpi_status status; acpi_status status;
int *action = context; int *action = context;
ACPI_FUNCTION_TRACE("container_walk_namespace_cb");
status = acpi_get_object_info(handle, &buffer); status = acpi_get_object_info(handle, &buffer);
if (ACPI_FAILURE(status) || !buffer.pointer) { if (ACPI_FAILURE(status) || !buffer.pointer) {
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
info = buffer.pointer; info = buffer.pointer;
...@@ -243,7 +238,7 @@ container_walk_namespace_cb(acpi_handle handle, ...@@ -243,7 +238,7 @@ container_walk_namespace_cb(acpi_handle handle,
end: end:
acpi_os_free(buffer.pointer); acpi_os_free(buffer.pointer);
return_ACPI_STATUS(AE_OK); return AE_OK;
} }
static int __init acpi_container_init(void) static int __init acpi_container_init(void)
...@@ -269,7 +264,6 @@ static void __exit acpi_container_exit(void) ...@@ -269,7 +264,6 @@ static void __exit acpi_container_exit(void)
{ {
int action = UNINSTALL_NOTIFY_HANDLER; int action = UNINSTALL_NOTIFY_HANDLER;
ACPI_FUNCTION_TRACE("acpi_container_exit");
acpi_walk_namespace(ACPI_TYPE_DEVICE, acpi_walk_namespace(ACPI_TYPE_DEVICE,
ACPI_ROOT_OBJECT, ACPI_ROOT_OBJECT,
...@@ -278,7 +272,7 @@ static void __exit acpi_container_exit(void) ...@@ -278,7 +272,7 @@ static void __exit acpi_container_exit(void)
acpi_bus_unregister_driver(&acpi_container_driver); acpi_bus_unregister_driver(&acpi_container_driver);
return_VOID; return;
} }
module_init(acpi_container_init); module_init(acpi_container_init);
......
...@@ -155,13 +155,12 @@ acpi_system_write_debug(struct file *file, ...@@ -155,13 +155,12 @@ acpi_system_write_debug(struct file *file,
{ {
char debug_string[12] = { '\0' }; char debug_string[12] = { '\0' };
ACPI_FUNCTION_TRACE("acpi_system_write_debug");
if (count > sizeof(debug_string) - 1) if (count > sizeof(debug_string) - 1)
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(debug_string, buffer, count)) if (copy_from_user(debug_string, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
debug_string[count] = '\0'; debug_string[count] = '\0';
...@@ -173,10 +172,10 @@ acpi_system_write_debug(struct file *file, ...@@ -173,10 +172,10 @@ acpi_system_write_debug(struct file *file,
acpi_dbg_level = simple_strtoul(debug_string, NULL, 0); acpi_dbg_level = simple_strtoul(debug_string, NULL, 0);
break; break;
default: default:
return_VALUE(-EINVAL); return -EINVAL;
} }
return_VALUE(count); return count;
} }
static int __init acpi_debug_init(void) static int __init acpi_debug_init(void)
...@@ -185,10 +184,9 @@ static int __init acpi_debug_init(void) ...@@ -185,10 +184,9 @@ static int __init acpi_debug_init(void)
int error = 0; int error = 0;
char *name; char *name;
ACPI_FUNCTION_TRACE("acpi_debug_init");
if (acpi_disabled) if (acpi_disabled)
return_VALUE(0); return 0;
/* 'debug_layer' [R/W] */ /* 'debug_layer' [R/W] */
name = ACPI_SYSTEM_FILE_DEBUG_LAYER; name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
...@@ -213,15 +211,12 @@ static int __init acpi_debug_init(void) ...@@ -213,15 +211,12 @@ static int __init acpi_debug_init(void)
goto Error; goto Error;
Done: Done:
return_VALUE(error); return error;
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_LEVEL, acpi_root_dir);
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir);
error = -EFAULT; error = -ENODEV;
goto Done; goto Done;
} }
......
...@@ -125,37 +125,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, ...@@ -125,37 +125,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
if (info->table_desc->pointer->revision == 1) { if (info->table_desc->pointer->revision == 1) {
node->flags |= ANOBJ_DATA_WIDTH_32; 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++; info->method_count++;
break; break;
......
This diff is collapsed.
...@@ -472,7 +472,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) ...@@ -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, acpi_ds_result_push(walk_state->result_obj,
walk_state); walk_state);
} }
break; break;
default: default:
...@@ -510,6 +509,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) ...@@ -510,6 +509,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Method Reference in a Package, Op=%p\n", "Method Reference in a Package, Op=%p\n",
op)); op));
op->common.node = op->common.node =
(struct acpi_namespace_node *)op->asl.value. (struct acpi_namespace_node *)op->asl.value.
arg->asl.node->object; arg->asl.node->object;
...@@ -670,7 +670,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) ...@@ -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); status = acpi_ds_result_stack_pop(walk_state);
} }
break; break;
case AML_TYPE_UNDEFINED: case AML_TYPE_UNDEFINED:
...@@ -708,7 +707,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) ...@@ -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 * Check if we just completed the evaluation of a
* conditional predicate * conditional predicate
*/ */
if ((ACPI_SUCCESS(status)) && if ((ACPI_SUCCESS(status)) &&
(walk_state->control_state) && (walk_state->control_state) &&
(walk_state->control_state->common.state == (walk_state->control_state->common.state ==
......
...@@ -175,7 +175,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, ...@@ -175,7 +175,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
/* /*
* Table disassembly: * 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. * insert the name into the namespace.
*/ */
acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0); 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, ...@@ -210,16 +210,15 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
case ACPI_TYPE_BUFFER: 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: * enables some existing code of the form:
* *
* Name (DEB, 0) * Name (DEB, 0)
* Scope (DEB) { ... } * 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 * a warning
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
path, path,
...@@ -242,7 +241,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, ...@@ -242,7 +241,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
break; break;
default: default:
/* /*
* For all other named opcodes, we will enter the name into * For all other named opcodes, we will enter the name into
* the namespace. * the namespace.
...@@ -259,7 +257,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, ...@@ -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 * buffer_field, or Package), the name of the object is already
* in the namespace. * in the namespace.
*/ */
if (walk_state->deferred_node) { if (walk_state->deferred_node) {
/* This name is already in the namespace, get the 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, ...@@ -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 * Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that * 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 * involve arguments to the opcode must be created as we go back up the
* parse tree later. * parse tree later.
*/ */
...@@ -327,12 +324,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, ...@@ -327,12 +324,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
(status); (status);
} }
} }
status = AE_OK; status = AE_OK;
} }
} }
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_ERROR_NAMESPACE(path, status); ACPI_ERROR_NAMESPACE(path, status);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -434,9 +431,13 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) ...@@ -434,9 +431,13 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
status = status =
acpi_ex_create_region(op->named.data, acpi_ex_create_region(op->named.data,
op->named.length, op->named.length,
(acpi_adr_space_type) (acpi_adr_space_type) ((op->
((op->common.value.arg)-> common.
common.value.integer), value.
arg)->
common.
value.
integer),
walk_state); walk_state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
...@@ -474,7 +475,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) ...@@ -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 * method_op pkg_length name_string method_flags term_list
* *
* Note: We must create the method node/object pair as soon as we * 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 * of invocations of the method (need to know the number of
* arguments.) * arguments.)
*/ */
...@@ -499,6 +500,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) ...@@ -499,6 +500,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
length, length,
walk_state); walk_state);
} }
walk_state->operands[0] = NULL; walk_state->operands[0] = NULL;
walk_state->num_operands = 0; walk_state->num_operands = 0;
...@@ -570,7 +572,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -570,7 +572,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) { (walk_state->op_info->class == AML_CLASS_CONTROL)) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Begin/EXEC: %s (fl %8.8X)\n", "Begin/EXEC: %s (fl %8.8X)\n",
walk_state->op_info->name, walk_state->op_info->name,
...@@ -602,7 +603,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -602,7 +603,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
} else { } else {
/* Get name from the op */ /* Get name from the op */
buffer_ptr = (char *)&op->named.name; buffer_ptr = ACPI_CAST_PTR(char, &op->named.name);
} }
} else { } else {
/* Get the namestring from the raw AML */ /* Get the namestring from the raw AML */
...@@ -629,7 +630,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -629,7 +630,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
break; break;
case AML_INT_NAMEPATH_OP: case AML_INT_NAMEPATH_OP:
/* /*
* The name_path is an object reference to an existing object. * The name_path is an object reference to an existing object.
* Don't enter the name into the namespace, but look it up * 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, ...@@ -642,7 +642,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
break; break;
case AML_SCOPE_OP: case AML_SCOPE_OP:
/* /*
* The Path is an object reference to an existing object. * The Path is an object reference to an existing object.
* Don't enter the name into the namespace, but look it up * 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, ...@@ -664,6 +663,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
#endif #endif
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/* /*
* We must check to make sure that the target is * We must check to make sure that the target is
* one of the opcodes that actually opens a scope * one of the opcodes that actually opens a scope
...@@ -683,13 +683,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -683,13 +683,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
case ACPI_TYPE_BUFFER: 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: * enables some existing code of the form:
* *
* Name (DEB, 0) * Name (DEB, 0)
* Scope (DEB) { ... } * Scope (DEB) { ... }
*/ */
ACPI_WARNING((AE_INFO, ACPI_WARNING((AE_INFO,
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)", "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)",
buffer_ptr, buffer_ptr,
...@@ -729,14 +728,14 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -729,14 +728,14 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
} }
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
/* /*
* Enter the named type into the internal namespace. We enter the name * Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that * 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 * involve arguments to the opcode must be created as we go back up the
* parse tree later. * parse tree later.
* *
...@@ -787,7 +786,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -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 * can get it again quickly when this scope is closed
*/ */
op->common.node = node; op->common.node = node;
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -922,7 +920,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) ...@@ -922,7 +920,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
case AML_TYPE_CREATE_FIELD: case AML_TYPE_CREATE_FIELD:
/* /*
* Create the field object, but the field buffer and index must * Create the field object, but the field buffer and index must
* be evaluated later during the execution phase * be evaluated later during the execution phase
...@@ -931,7 +928,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) ...@@ -931,7 +928,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
break; break;
case AML_TYPE_NAMED_FIELD: case AML_TYPE_NAMED_FIELD:
/* /*
* If we are executing a method, initialize the 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) ...@@ -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 * argument is the space_id. (We must save the address of the
* AML of the address and length operands) * AML of the address and length operands)
*/ */
/* /*
* If we have a valid region, initialize it * If we have a valid region, initialize it
* Namespace is NOT locked at this point. * Namespace is NOT locked at this point.
...@@ -1080,7 +1077,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) ...@@ -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 * method_op pkg_length name_string method_flags term_list
* *
* Note: We must create the method node/object pair as soon as we * 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 * of invocations of the method (need to know the number of
* arguments.) * arguments.)
*/ */
......
This diff is collapsed.
This diff is collapsed.
...@@ -48,18 +48,17 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, ...@@ -48,18 +48,17 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
static int chars_remaining = 0; static int chars_remaining = 0;
static char *ptr; static char *ptr;
ACPI_FUNCTION_TRACE("acpi_system_read_event");
if (!chars_remaining) { if (!chars_remaining) {
memset(&event, 0, sizeof(struct acpi_bus_event)); memset(&event, 0, sizeof(struct acpi_bus_event));
if ((file->f_flags & O_NONBLOCK) if ((file->f_flags & O_NONBLOCK)
&& (list_empty(&acpi_bus_event_list))) && (list_empty(&acpi_bus_event_list)))
return_VALUE(-EAGAIN); return -EAGAIN;
result = acpi_bus_receive_event(&event); result = acpi_bus_receive_event(&event);
if (result) if (result)
return_VALUE(result); return result;
chars_remaining = sprintf(str, "%s %s %08x %08x\n", chars_remaining = sprintf(str, "%s %s %08x %08x\n",
event.device_class ? event. event.device_class ? event.
...@@ -75,13 +74,13 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, ...@@ -75,13 +74,13 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
} }
if (copy_to_user(buffer, ptr, count)) if (copy_to_user(buffer, ptr, count))
return_VALUE(-EFAULT); return -EFAULT;
*ppos += count; *ppos += count;
chars_remaining -= count; chars_remaining -= count;
ptr += count; ptr += count;
return_VALUE(count); return count;
} }
static int acpi_system_close_event(struct inode *inode, struct file *file) static int acpi_system_close_event(struct inode *inode, struct file *file)
...@@ -112,22 +111,18 @@ static int __init acpi_event_init(void) ...@@ -112,22 +111,18 @@ static int __init acpi_event_init(void)
struct proc_dir_entry *entry; struct proc_dir_entry *entry;
int error = 0; int error = 0;
ACPI_FUNCTION_TRACE("acpi_event_init");
if (acpi_disabled) if (acpi_disabled)
return_VALUE(0); return 0;
/* 'event' [R] */ /* 'event' [R] */
entry = create_proc_entry("event", S_IRUSR, acpi_root_dir); entry = create_proc_entry("event", S_IRUSR, acpi_root_dir);
if (entry) if (entry)
entry->proc_fops = &acpi_system_event_ops; entry->proc_fops = &acpi_system_event_ops;
else { else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, error = -ENODEV;
"Unable to create '%s' proc fs entry\n",
"event"));
error = -EFAULT;
} }
return_VALUE(error); return error;
} }
subsys_initcall(acpi_event_init); subsys_initcall(acpi_event_init);
...@@ -382,7 +382,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) ...@@ -382,7 +382,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
u32 status_reg; u32 status_reg;
u32 enable_reg; u32 enable_reg;
acpi_cpu_flags flags; acpi_cpu_flags flags;
acpi_cpu_flags hw_flags;
acpi_native_uint i; acpi_native_uint i;
acpi_native_uint j; acpi_native_uint j;
...@@ -394,8 +393,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) ...@@ -394,8 +393,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
return (int_status); 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); flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
/* Examine all GPE blocks attached to this interrupt level */ /* 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) ...@@ -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]; gpe_register_info = &gpe_block->register_info[i];
hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
/* Read the Status Register */ /* Read the Status Register */
status = status =
...@@ -423,8 +423,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) ...@@ -423,8 +423,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
&gpe_register_info-> &gpe_register_info->
status_address); status_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_os_release_lock(acpi_gbl_hardware_lock,
hw_flags);
goto unlock_and_exit; goto unlock_and_exit;
} }
...@@ -435,8 +433,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) ...@@ -435,8 +433,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
&enable_reg, &enable_reg,
&gpe_register_info-> &gpe_register_info->
enable_address); enable_address);
acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }
......
...@@ -414,12 +414,13 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -414,12 +414,13 @@ acpi_remove_notify_handler(acpi_handle device,
if ((!device) || if ((!device) ||
(!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { (!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); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); goto exit;
} }
/* Convert and validate the device handle */ /* Convert and validate the device handle */
...@@ -427,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -427,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device,
node = acpi_ns_map_handle_to_node(device); node = acpi_ns_map_handle_to_node(device);
if (!node) { if (!node) {
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
goto unlock_and_exit; goto unlock;
} }
/* Root Object */ /* Root Object */
...@@ -441,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -441,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device,
((handler_type & ACPI_DEVICE_NOTIFY) && ((handler_type & ACPI_DEVICE_NOTIFY) &&
!acpi_gbl_device_notify.handler)) { !acpi_gbl_device_notify.handler)) {
status = AE_NOT_EXIST; status = AE_NOT_EXIST;
goto unlock_and_exit; goto unlock;
} }
/* Make sure all deferred tasks are completed */ /* Make sure all deferred tasks are completed */
...@@ -450,7 +451,7 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -450,7 +451,7 @@ acpi_remove_notify_handler(acpi_handle device,
acpi_os_wait_events_complete(NULL); acpi_os_wait_events_complete(NULL);
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); goto exit;
} }
if (handler_type & ACPI_SYSTEM_NOTIFY) { if (handler_type & ACPI_SYSTEM_NOTIFY) {
...@@ -473,7 +474,7 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -473,7 +474,7 @@ acpi_remove_notify_handler(acpi_handle device,
if (!acpi_ev_is_notify_object(node)) { if (!acpi_ev_is_notify_object(node)) {
status = AE_TYPE; status = AE_TYPE;
goto unlock_and_exit; goto unlock;
} }
/* Check for an existing internal object */ /* Check for an existing internal object */
...@@ -481,7 +482,7 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -481,7 +482,7 @@ acpi_remove_notify_handler(acpi_handle device,
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) { if (!obj_desc) {
status = AE_NOT_EXIST; status = AE_NOT_EXIST;
goto unlock_and_exit; goto unlock;
} }
/* Object exists - make sure there's an existing handler */ /* Object exists - make sure there's an existing handler */
...@@ -491,7 +492,7 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -491,7 +492,7 @@ acpi_remove_notify_handler(acpi_handle device,
if ((!notify_obj) || if ((!notify_obj) ||
(notify_obj->notify.handler != handler)) { (notify_obj->notify.handler != handler)) {
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
goto unlock_and_exit; goto unlock;
} }
/* Make sure all deferred tasks are completed */ /* Make sure all deferred tasks are completed */
...@@ -499,7 +500,7 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -499,7 +500,7 @@ acpi_remove_notify_handler(acpi_handle device,
acpi_os_wait_events_complete(NULL); acpi_os_wait_events_complete(NULL);
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); goto exit;
} }
/* Remove the handler */ /* Remove the handler */
...@@ -512,7 +513,7 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -512,7 +513,7 @@ acpi_remove_notify_handler(acpi_handle device,
if ((!notify_obj) || if ((!notify_obj) ||
(notify_obj->notify.handler != handler)) { (notify_obj->notify.handler != handler)) {
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
goto unlock_and_exit; goto unlock;
} }
/* Make sure all deferred tasks are completed */ /* Make sure all deferred tasks are completed */
...@@ -520,7 +521,7 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -520,7 +521,7 @@ acpi_remove_notify_handler(acpi_handle device,
acpi_os_wait_events_complete(NULL); acpi_os_wait_events_complete(NULL);
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); goto exit;
} }
/* Remove the handler */ /* Remove the handler */
...@@ -529,8 +530,11 @@ acpi_remove_notify_handler(acpi_handle device, ...@@ -529,8 +530,11 @@ acpi_remove_notify_handler(acpi_handle device,
} }
} }
unlock_and_exit: unlock:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); (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); return_ACPI_STATUS(status);
} }
...@@ -568,12 +572,13 @@ acpi_install_gpe_handler(acpi_handle gpe_device, ...@@ -568,12 +572,13 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
/* Parameter validation */ /* Parameter validation */
if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) { 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); status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); goto exit;
} }
/* Ensure that we have a valid GPE number */ /* Ensure that we have a valid GPE number */
...@@ -581,7 +586,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, ...@@ -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); gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
if (!gpe_event_info) { if (!gpe_event_info) {
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
goto unlock_and_exit; goto unlock;
} }
/* Make sure that there isn't a handler there already */ /* Make sure that there isn't a handler there already */
...@@ -589,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, ...@@ -589,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER) { ACPI_GPE_DISPATCH_HANDLER) {
status = AE_ALREADY_EXISTS; status = AE_ALREADY_EXISTS;
goto unlock_and_exit; goto unlock;
} }
/* Allocate and init handler object */ /* Allocate and init handler object */
...@@ -597,7 +602,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, ...@@ -597,7 +602,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
if (!handler) { if (!handler) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto unlock_and_exit; goto unlock;
} }
handler->address = address; handler->address = address;
...@@ -608,7 +613,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, ...@@ -608,7 +613,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
status = acpi_ev_disable_gpe(gpe_event_info); status = acpi_ev_disable_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto unlock_and_exit; goto unlock;
} }
/* Install the handler */ /* Install the handler */
...@@ -623,8 +628,12 @@ acpi_install_gpe_handler(acpi_handle gpe_device, ...@@ -623,8 +628,12 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
acpi_os_release_lock(acpi_gbl_gpe_lock, flags); acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
unlock_and_exit: unlock:
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); (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); return_ACPI_STATUS(status);
} }
......
...@@ -266,6 +266,10 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, ...@@ -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_desc = ddb_handle;
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -446,6 +450,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, ...@@ -446,6 +450,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(status); 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: cleanup:
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_FREE(table_ptr); ACPI_FREE(table_ptr);
......
...@@ -177,7 +177,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) ...@@ -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 * that the event is created in an unsignalled state
*/ */
status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0,
&obj_desc->event.semaphore); &obj_desc->event.os_semaphore);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto cleanup; goto cleanup;
} }
...@@ -226,12 +226,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) ...@@ -226,12 +226,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
goto cleanup; goto cleanup;
} }
/* /* Create the actual OS Mutex */
* Create the actual OS semaphore.
* One unit max to make it a mutex, with one initial unit to allow status = acpi_os_create_mutex(&obj_desc->mutex.os_mutex);
* the mutex to be acquired.
*/
status = acpi_os_create_semaphore(1, 1, &obj_desc->mutex.semaphore);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto cleanup; goto cleanup;
} }
...@@ -565,7 +562,7 @@ acpi_ex_create_method(u8 * aml_start, ...@@ -565,7 +562,7 @@ acpi_ex_create_method(u8 * aml_start,
obj_desc->method.aml_length = aml_length; 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 * for efficiency
*/ */
method_flags = (u8) operand[1]->integer.value; method_flags = (u8) operand[1]->integer.value;
...@@ -576,21 +573,19 @@ acpi_ex_create_method(u8 * aml_start, ...@@ -576,21 +573,19 @@ acpi_ex_create_method(u8 * aml_start,
(u8) (method_flags & AML_METHOD_ARG_COUNT); (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. * created for this method when it is parsed.
*/ */
if (acpi_gbl_all_methods_serialized) { 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; obj_desc->method.method_flags |= AML_METHOD_SERIALIZED;
} else if (method_flags & AML_METHOD_SERIALIZED) { } else if (method_flags & AML_METHOD_SERIALIZED) {
/* /*
* ACPI 1.0: Concurrency = 1 * ACPI 1.0: sync_level = 0
* ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1) * ACPI 2.0: sync_level = sync_level in method declaration
*/ */
obj_desc->method.concurrency = (u8) obj_desc->method.sync_level = (u8)
(((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1); ((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4);
} else {
obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY;
} }
/* Attach the new object to the method Node */ /* Attach the new object to the method Node */
......
...@@ -118,14 +118,14 @@ static struct acpi_exdump_info acpi_ex_dump_device[4] = { ...@@ -118,14 +118,14 @@ static struct acpi_exdump_info acpi_ex_dump_device[4] = {
static struct acpi_exdump_info acpi_ex_dump_event[2] = { static struct acpi_exdump_info acpi_ex_dump_event[2] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL}, {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] = { static struct acpi_exdump_info acpi_ex_dump_method[8] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, {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.param_count), "ParamCount"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.sync_level), "Sync Level"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, {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.owner_id), "Owner Id"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"}, {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] = { ...@@ -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_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"},
{ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth),
"Acquire 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] = { static struct acpi_exdump_info acpi_ex_dump_region[7] = {
......
...@@ -727,11 +727,23 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, ...@@ -727,11 +727,23 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/* Merge with previous datum if necessary */ /*
* Merge with previous datum if necessary.
merged_datum |= raw_datum << *
(obj_desc->common_field.access_bit_width - * Note: Before the shift, check if the shift value will be larger than
obj_desc->common_field.start_field_bit_offset); * 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) { if (i == datum_count) {
break; break;
...@@ -808,13 +820,23 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, ...@@ -808,13 +820,23 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(AE_BUFFER_OVERFLOW); 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 = mask = width_mask &
ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width); ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
mask =
width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field. /* Compute the number of datums (access width data items) */
start_field_bit_offset);
datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
obj_desc->common_field.access_bit_width); obj_desc->common_field.access_bit_width);
...@@ -848,12 +870,29 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, ...@@ -848,12 +870,29 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/* Start new output datum by merging with previous input datum */
field_offset += obj_desc->common_field.access_byte_width; 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; mask = width_mask;
if (i == datum_count) { if (i == datum_count) {
......
...@@ -161,12 +161,13 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, ...@@ -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 * 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) { if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Cannot acquire Mutex [%4.4s], incorrect SyncLevel", "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%d)",
acpi_ut_get_node_name(obj_desc->mutex.node))); acpi_ut_get_node_name(obj_desc->mutex.node),
walk_state->thread->current_sync_level));
return_ACPI_STATUS(AE_AML_MUTEX_ORDER); return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
} }
...@@ -178,8 +179,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, ...@@ -178,8 +179,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
if ((obj_desc->mutex.owner_thread->thread_id == if ((obj_desc->mutex.owner_thread->thread_id ==
walk_state->thread->thread_id) || walk_state->thread->thread_id) ||
(obj_desc->mutex.semaphore == (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK)) {
acpi_gbl_global_lock_semaphore)) {
/* /*
* The mutex is already owned by this thread, * The mutex is already owned by this thread,
* just increment the acquisition depth * just increment the acquisition depth
...@@ -264,7 +264,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, ...@@ -264,7 +264,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
*/ */
if ((obj_desc->mutex.owner_thread->thread_id != if ((obj_desc->mutex.owner_thread->thread_id !=
walk_state->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, ACPI_ERROR((AE_INFO,
"Thread %X cannot release Mutex [%4.4s] acquired by thread %X", "Thread %X cannot release Mutex [%4.4s] acquired by thread %X",
walk_state->thread->thread_id, walk_state->thread->thread_id,
......
...@@ -63,14 +63,14 @@ ACPI_MODULE_NAME("exsystem") ...@@ -63,14 +63,14 @@ ACPI_MODULE_NAME("exsystem")
* interpreter is released. * 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 status;
acpi_status status2; acpi_status status2;
ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); 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)) { if (ACPI_SUCCESS(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -101,6 +101,59 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) ...@@ -101,6 +101,59 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/*******************************************************************************
*
* 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 * FUNCTION: acpi_ex_system_do_stall
...@@ -176,7 +229,7 @@ acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) ...@@ -176,7 +229,7 @@ acpi_status acpi_ex_system_do_suspend(acpi_integer how_long)
* *
* FUNCTION: acpi_ex_system_acquire_mutex * 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 * obj_desc - The object descriptor for this op
* *
* RETURN: Status * RETURN: Status
...@@ -201,14 +254,14 @@ acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc, ...@@ -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 */ /* 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 = status =
acpi_ev_acquire_global_lock((u16) time_desc->integer.value); acpi_ev_acquire_global_lock((u16) time_desc->integer.value);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
status = acpi_ex_system_wait_semaphore(obj_desc->mutex.semaphore, status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex,
(u16) time_desc->integer.value); (u16) time_desc->integer.value);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -239,13 +292,13 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc) ...@@ -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 */ /* 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(); status = acpi_ev_release_global_lock();
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
status = acpi_os_signal_semaphore(obj_desc->mutex.semaphore, 1); acpi_os_release_mutex(obj_desc->mutex.os_mutex);
return_ACPI_STATUS(status); return_ACPI_STATUS(AE_OK);
} }
/******************************************************************************* /*******************************************************************************
...@@ -268,7 +321,8 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc) ...@@ -268,7 +321,8 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc)
ACPI_FUNCTION_TRACE(ex_system_signal_event); ACPI_FUNCTION_TRACE(ex_system_signal_event);
if (obj_desc) { 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); return_ACPI_STATUS(status);
...@@ -299,7 +353,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, ...@@ -299,7 +353,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc,
if (obj_desc) { if (obj_desc) {
status = status =
acpi_ex_system_wait_semaphore(obj_desc->event.semaphore, acpi_ex_system_wait_semaphore(obj_desc->event.os_semaphore,
(u16) time_desc->integer. (u16) time_desc->integer.
value); value);
} }
...@@ -322,7 +376,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, ...@@ -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 acpi_ex_system_reset_event(union acpi_operand_object *obj_desc)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
void *temp_semaphore; acpi_semaphore temp_semaphore;
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
...@@ -333,8 +387,8 @@ acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) ...@@ -333,8 +387,8 @@ acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc)
status = status =
acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore); acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
(void)acpi_os_delete_semaphore(obj_desc->event.semaphore); (void)acpi_os_delete_semaphore(obj_desc->event.os_semaphore);
obj_desc->event.semaphore = temp_semaphore; obj_desc->event.os_semaphore = temp_semaphore;
} }
return (status); return (status);
......
...@@ -78,7 +78,6 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset) ...@@ -78,7 +78,6 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset)
struct acpi_fan *fan = seq->private; struct acpi_fan *fan = seq->private;
int state = 0; int state = 0;
ACPI_FUNCTION_TRACE("acpi_fan_read_state");
if (fan) { if (fan) {
if (acpi_bus_get_power(fan->handle, &state)) if (acpi_bus_get_power(fan->handle, &state))
...@@ -87,7 +86,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset) ...@@ -87,7 +86,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset)
seq_printf(seq, "status: %s\n", seq_printf(seq, "status: %s\n",
!state ? "on" : "off"); !state ? "on" : "off");
} }
return_VALUE(0); return 0;
} }
static int acpi_fan_state_open_fs(struct inode *inode, struct file *file) static int acpi_fan_state_open_fs(struct inode *inode, struct file *file)
...@@ -104,22 +103,21 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, ...@@ -104,22 +103,21 @@ acpi_fan_write_state(struct file *file, const char __user * buffer,
struct acpi_fan *fan = (struct acpi_fan *)m->private; struct acpi_fan *fan = (struct acpi_fan *)m->private;
char state_string[12] = { '\0' }; char state_string[12] = { '\0' };
ACPI_FUNCTION_TRACE("acpi_fan_write_state");
if (!fan || (count > sizeof(state_string) - 1)) if (!fan || (count > sizeof(state_string) - 1))
return_VALUE(-EINVAL); return -EINVAL;
if (copy_from_user(state_string, buffer, count)) if (copy_from_user(state_string, buffer, count))
return_VALUE(-EFAULT); return -EFAULT;
state_string[count] = '\0'; state_string[count] = '\0';
result = acpi_bus_set_power(fan->handle, result = acpi_bus_set_power(fan->handle,
simple_strtoul(state_string, NULL, 0)); simple_strtoul(state_string, NULL, 0));
if (result) if (result)
return_VALUE(result); return result;
return_VALUE(count); return count;
} }
static struct file_operations acpi_fan_state_ops = { static struct file_operations acpi_fan_state_ops = {
...@@ -135,16 +133,15 @@ static int acpi_fan_add_fs(struct acpi_device *device) ...@@ -135,16 +133,15 @@ static int acpi_fan_add_fs(struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
ACPI_FUNCTION_TRACE("acpi_fan_add_fs");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_fan_dir); acpi_fan_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return -ENODEV;
acpi_device_dir(device)->owner = THIS_MODULE; acpi_device_dir(device)->owner = THIS_MODULE;
} }
...@@ -153,21 +150,18 @@ static int acpi_fan_add_fs(struct acpi_device *device) ...@@ -153,21 +150,18 @@ static int acpi_fan_add_fs(struct acpi_device *device)
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device)); acpi_device_dir(device));
if (!entry) if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, return -ENODEV;
"Unable to create '%s' fs entry\n",
ACPI_FAN_FILE_STATE));
else { else {
entry->proc_fops = &acpi_fan_state_ops; entry->proc_fops = &acpi_fan_state_ops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
return_VALUE(0); return 0;
} }
static int acpi_fan_remove_fs(struct acpi_device *device) static int acpi_fan_remove_fs(struct acpi_device *device)
{ {
ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device)); remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device));
...@@ -175,7 +169,7 @@ static int acpi_fan_remove_fs(struct acpi_device *device) ...@@ -175,7 +169,7 @@ static int acpi_fan_remove_fs(struct acpi_device *device)
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
return_VALUE(0); return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -188,14 +182,13 @@ static int acpi_fan_add(struct acpi_device *device) ...@@ -188,14 +182,13 @@ static int acpi_fan_add(struct acpi_device *device)
struct acpi_fan *fan = NULL; struct acpi_fan *fan = NULL;
int state = 0; int state = 0;
ACPI_FUNCTION_TRACE("acpi_fan_add");
if (!device) if (!device)
return_VALUE(-EINVAL); return -EINVAL;
fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL); fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL);
if (!fan) if (!fan)
return_VALUE(-ENOMEM); return -ENOMEM;
memset(fan, 0, sizeof(struct acpi_fan)); memset(fan, 0, sizeof(struct acpi_fan));
fan->handle = device->handle; fan->handle = device->handle;
...@@ -205,8 +198,7 @@ static int acpi_fan_add(struct acpi_device *device) ...@@ -205,8 +198,7 @@ static int acpi_fan_add(struct acpi_device *device)
result = acpi_bus_get_power(fan->handle, &state); result = acpi_bus_get_power(fan->handle, &state);
if (result) { if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, printk(KERN_ERR PREFIX "Reading power state\n");
"Error reading power state\n"));
goto end; goto end;
} }
...@@ -226,17 +218,16 @@ static int acpi_fan_add(struct acpi_device *device) ...@@ -226,17 +218,16 @@ static int acpi_fan_add(struct acpi_device *device)
if (result) if (result)
kfree(fan); kfree(fan);
return_VALUE(result); return result;
} }
static int acpi_fan_remove(struct acpi_device *device, int type) static int acpi_fan_remove(struct acpi_device *device, int type)
{ {
struct acpi_fan *fan = NULL; struct acpi_fan *fan = NULL;
ACPI_FUNCTION_TRACE("acpi_fan_remove");
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL); return -EINVAL;
fan = (struct acpi_fan *)acpi_driver_data(device); fan = (struct acpi_fan *)acpi_driver_data(device);
...@@ -244,7 +235,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type) ...@@ -244,7 +235,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
kfree(fan); kfree(fan);
return_VALUE(0); return 0;
} }
static int acpi_fan_suspend(struct acpi_device *device, int state) static int acpi_fan_suspend(struct acpi_device *device, int state)
...@@ -283,31 +274,29 @@ static int __init acpi_fan_init(void) ...@@ -283,31 +274,29 @@ static int __init acpi_fan_init(void)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_fan_init");
acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
if (!acpi_fan_dir) if (!acpi_fan_dir)
return_VALUE(-ENODEV); return -ENODEV;
acpi_fan_dir->owner = THIS_MODULE; acpi_fan_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_fan_driver); result = acpi_bus_register_driver(&acpi_fan_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return -ENODEV;
} }
return_VALUE(0); return 0;
} }
static void __exit acpi_fan_exit(void) static void __exit acpi_fan_exit(void)
{ {
ACPI_FUNCTION_TRACE("acpi_fan_exit");
acpi_bus_unregister_driver(&acpi_fan_driver); acpi_bus_unregister_driver(&acpi_fan_driver);
remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
return_VOID; return;
} }
module_init(acpi_fan_init); module_init(acpi_fan_init);
......
...@@ -172,9 +172,9 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) ...@@ -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 * 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 * by BIOS vendors seems to be to have 2 or more elements, at least
* one per sleep type (A/B). * one per sleep type (A/B).
*/ */
...@@ -255,7 +255,7 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) ...@@ -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 * return_value - Value that was read from the register
* Flags - Lock the hardware or not * 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) * returned is normalized to bit0 (is shifted all the way right)
* *
* DESCRIPTION: ACPI bit_register read function. * DESCRIPTION: ACPI bit_register read function.
...@@ -361,8 +361,8 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) ...@@ -361,8 +361,8 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
case ACPI_REGISTER_PM1_STATUS: case ACPI_REGISTER_PM1_STATUS:
/* /*
* Status Registers are different from the rest. Clear by * Status Registers are different from the rest. Clear by
* writing 1, and writing 0 has no effect. So, the only relevant * writing 1, and writing 0 has no effect. So, the only relevant
* information is the single bit we're interested in, all others should * information is the single bit we're interested in, all others should
* be written as 0 so they will be left unchanged. * be written as 0 so they will be left unchanged.
*/ */
...@@ -467,14 +467,13 @@ ACPI_EXPORT_SYMBOL(acpi_set_register) ...@@ -467,14 +467,13 @@ ACPI_EXPORT_SYMBOL(acpi_set_register)
* *
* FUNCTION: acpi_hw_register_read * FUNCTION: acpi_hw_register_read
* *
* PARAMETERS: use_lock - Mutex hw access * PARAMETERS: use_lock - Lock hardware? True/False
* register_id - register_iD + Offset * register_id - ACPI Register ID
* return_value - Where the register value is returned * return_value - Where the register value is returned
* *
* RETURN: Status and the value read. * RETURN: Status and the value read.
* *
* DESCRIPTION: Acpi register read function. Registers are read at the * DESCRIPTION: Read from the specified ACPI register
* given offset.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
...@@ -580,14 +579,26 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) ...@@ -580,14 +579,26 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
* *
* FUNCTION: acpi_hw_register_write * FUNCTION: acpi_hw_register_write
* *
* PARAMETERS: use_lock - Mutex hw access * PARAMETERS: use_lock - Lock hardware? True/False
* register_id - register_iD + Offset * register_id - ACPI Register ID
* Value - The value to write * Value - The value to write
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Acpi register Write function. Registers are written at the * DESCRIPTION: Write to the specified ACPI register
* given offset. *
* 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) ...@@ -595,6 +606,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
{ {
acpi_status status; acpi_status status;
acpi_cpu_flags lock_flags = 0; acpi_cpu_flags lock_flags = 0;
u32 read_value;
ACPI_FUNCTION_TRACE(hw_register_write); ACPI_FUNCTION_TRACE(hw_register_write);
...@@ -605,6 +617,22 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) ...@@ -605,6 +617,22 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
switch (register_id) { switch (register_id) {
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ 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 = status =
acpi_hw_low_level_write(16, value, acpi_hw_low_level_write(16, value,
&acpi_gbl_FADT->xpm1a_evt_blk); &acpi_gbl_FADT->xpm1a_evt_blk);
...@@ -635,6 +663,25 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) ...@@ -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 */ 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 = status =
acpi_hw_low_level_write(16, value, acpi_hw_low_level_write(16, value,
&acpi_gbl_FADT->xpm1a_cnt_blk); &acpi_gbl_FADT->xpm1a_cnt_blk);
...@@ -726,7 +773,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) ...@@ -726,7 +773,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
return (AE_OK); 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, &reg->address); ACPI_MOVE_64_TO_64(&address, &reg->address);
if (!address) { if (!address) {
...@@ -798,7 +845,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) ...@@ -798,7 +845,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
return (AE_OK); 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, &reg->address); ACPI_MOVE_64_TO_64(&address, &reg->address);
if (!address) { if (!address) {
......
This diff is collapsed.
...@@ -52,13 +52,12 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) ...@@ -52,13 +52,12 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
{ {
struct resource *requested_res = NULL; struct resource *requested_res = NULL;
ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges");
if (res->type == ACPI_RESOURCE_TYPE_IO) { if (res->type == ACPI_RESOURCE_TYPE_IO) {
struct acpi_resource_io *io_res = &res->data.io; struct acpi_resource_io *io_res = &res->data.io;
if (io_res->minimum != io_res->maximum) if (io_res->minimum != io_res->maximum)
return_VALUE(AE_OK); return AE_OK;
if (IS_RESERVED_ADDR if (IS_RESERVED_ADDR
(io_res->minimum, io_res->address_length)) { (io_res->minimum, io_res->address_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
...@@ -92,7 +91,7 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) ...@@ -92,7 +91,7 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
if (requested_res) if (requested_res)
requested_res->flags &= ~IORESOURCE_BUSY; requested_res->flags &= ~IORESOURCE_BUSY;
return_VALUE(AE_OK); return AE_OK;
} }
static int acpi_motherboard_add(struct acpi_device *device) static int acpi_motherboard_add(struct acpi_device *device)
......
...@@ -196,33 +196,30 @@ acpi_status acpi_ns_root_initialize(void) ...@@ -196,33 +196,30 @@ acpi_status acpi_ns_root_initialize(void)
(u8) (ACPI_TO_INTEGER(val) - 1); (u8) (ACPI_TO_INTEGER(val) - 1);
if (ACPI_STRCMP(init_val->name, "_GL_") == 0) { if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
/*
* Create a counting semaphore for the /* Create a counting semaphore for the global lock */
* global lock
*/
status = status =
acpi_os_create_semaphore acpi_os_create_semaphore
(ACPI_NO_UNIT_LIMIT, 1, (ACPI_NO_UNIT_LIMIT, 1,
&obj_desc->mutex.semaphore); &acpi_gbl_global_lock_semaphore);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_ut_remove_reference acpi_ut_remove_reference
(obj_desc); (obj_desc);
goto unlock_and_exit; goto unlock_and_exit;
} }
/* /* Mark this mutex as very special */
* We just created the mutex for the
* global lock, save it obj_desc->mutex.os_mutex =
*/ ACPI_GLOBAL_LOCK;
acpi_gbl_global_lock_semaphore =
obj_desc->mutex.semaphore;
} else { } else {
/* Create a mutex */ /* Create a mutex */
status = acpi_os_create_semaphore(1, 1, status =
&obj_desc-> acpi_os_create_mutex(&obj_desc->
mutex. mutex.
semaphore); os_mutex);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_ut_remove_reference acpi_ut_remove_reference
(obj_desc); (obj_desc);
......
This diff is collapsed.
...@@ -469,6 +469,16 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) ...@@ -469,6 +469,16 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
} }
walk_state->thread = thread; 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); acpi_ds_push_walk_state(walk_state, thread);
/* /*
...@@ -505,6 +515,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) ...@@ -505,6 +515,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
status = status =
acpi_ds_call_control_method(thread, walk_state, acpi_ds_call_control_method(thread, walk_state,
NULL); 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 * 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) ...@@ -525,7 +539,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
/* Check for possible multi-thread reentrancy problem */ /* Check for possible multi-thread reentrancy problem */
if ((status == AE_ALREADY_EXISTS) && 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 * Method tried to create an object twice. The probable cause is
* that the method cannot handle reentrancy. * that the method cannot handle reentrancy.
...@@ -537,7 +551,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) ...@@ -537,7 +551,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
*/ */
walk_state->method_desc->method.method_flags |= walk_state->method_desc->method.method_flags |=
AML_METHOD_SERIALIZED; AML_METHOD_SERIALIZED;
walk_state->method_desc->method.concurrency = 1; walk_state->method_desc->method.sync_level = 0;
} }
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment