summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2006-07-02 01:19:34 +0400
committerLen Brown <len.brown@intel.com>2006-07-02 01:19:34 +0400
commit5f765b8d68fe99c8a575265d81c62382893e1e8a (patch)
treeef6ec9815aadfab4b8bcb09aeeb85d8dc29f4919 /drivers/acpi
parentb197ba3c70638a3a2ae39296781912f26ac0f991 (diff)
parentd07a8577f695c807977af003b6e75f996e01a15f (diff)
downloadlinux-5f765b8d68fe99c8a575265d81c62382893e1e8a.tar.xz
Pull acpi_device_handle_cleanup into release branch
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/ac.c14
-rw-r--r--drivers/acpi/acpi_memhotplug.c14
-rw-r--r--drivers/acpi/battery.c23
-rw-r--r--drivers/acpi/button.c10
-rw-r--r--drivers/acpi/fan.c10
-rw-r--r--drivers/acpi/pci_link.c15
-rw-r--r--drivers/acpi/pci_root.c20
-rw-r--r--drivers/acpi/power.c22
-rw-r--r--drivers/acpi/thermal.c57
-rw-r--r--drivers/acpi/video.c74
10 files changed, 111 insertions, 148 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 36ca365bcead..4537ae4838c4 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -65,7 +65,7 @@ static struct acpi_driver acpi_ac_driver = {
};
struct acpi_ac {
- acpi_handle handle;
+ struct acpi_device * device;
unsigned long state;
};
@@ -88,7 +88,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
if (!ac)
return -EINVAL;
- status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
+ status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL, &ac->state);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state"));
ac->state = ACPI_AC_STATUS_UNKNOWN;
@@ -191,9 +191,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
if (!ac)
return;
- if (acpi_bus_get_device(ac->handle, &device))
- return;
-
+ device = ac->device;
switch (event) {
case ACPI_AC_NOTIFY_STATUS:
acpi_ac_get_state(ac);
@@ -223,7 +221,7 @@ static int acpi_ac_add(struct acpi_device *device)
return -ENOMEM;
memset(ac, 0, sizeof(struct acpi_ac));
- ac->handle = device->handle;
+ ac->device = device;
strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_AC_CLASS);
acpi_driver_data(device) = ac;
@@ -236,7 +234,7 @@ static int acpi_ac_add(struct acpi_device *device)
if (result)
goto end;
- status = acpi_install_notify_handler(ac->handle,
+ status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, acpi_ac_notify,
ac);
if (ACPI_FAILURE(status)) {
@@ -268,7 +266,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
ac = (struct acpi_ac *)acpi_driver_data(device);
- status = acpi_remove_notify_handler(ac->handle,
+ status = acpi_remove_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, acpi_ac_notify);
acpi_ac_remove_fs(device);
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 84a68965c11a..81e970adeab3 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -80,7 +80,7 @@ struct acpi_memory_info {
};
struct acpi_memory_device {
- acpi_handle handle;
+ struct acpi_device * device;
unsigned int state; /* State of the memory device */
struct list_head res_list;
};
@@ -129,7 +129,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
struct acpi_memory_info *info, *n;
- status = acpi_walk_resources(mem_device->handle, METHOD_NAME__CRS,
+ status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS,
acpi_memory_get_resource, mem_device);
if (ACPI_FAILURE(status)) {
list_for_each_entry_safe(info, n, &mem_device->res_list, list)
@@ -192,7 +192,7 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
/* Get device present/absent information from the _STA */
- if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
+ if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->device->handle, "_STA",
NULL, &current_status)))
return -ENODEV;
/*
@@ -222,7 +222,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
return result;
}
- node = acpi_get_node(mem_device->handle);
+ node = acpi_get_node(mem_device->device->handle);
/*
* Tell the VM there is more memory here...
* Note: Assume that this function returns zero on success
@@ -269,7 +269,7 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
arg_list.pointer = &arg;
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = 1;
- status = acpi_evaluate_object(mem_device->handle,
+ status = acpi_evaluate_object(mem_device->device->handle,
"_EJ0", &arg_list, NULL);
/* Return on _EJ0 failure */
if (ACPI_FAILURE(status)) {
@@ -278,7 +278,7 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
}
/* Evalute _STA to check if the device is disabled */
- status = acpi_evaluate_integer(mem_device->handle, "_STA",
+ status = acpi_evaluate_integer(mem_device->device->handle, "_STA",
NULL, &current_status);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -398,7 +398,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
memset(mem_device, 0, sizeof(struct acpi_memory_device));
INIT_LIST_HEAD(&mem_device->res_list);
- mem_device->handle = device->handle;
+ mem_device->device = device;
sprintf(acpi_device_name(device), "%s", ACPI_MEMORY_DEVICE_NAME);
sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS);
acpi_driver_data(device) = mem_device;
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 7d92f73b265f..2b8aab560b58 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -108,7 +108,7 @@ struct acpi_battery_trips {
};
struct acpi_battery {
- acpi_handle handle;
+ struct acpi_device * device;
struct acpi_battery_flags flags;
struct acpi_battery_trips trips;
unsigned long alarm;
@@ -138,7 +138,7 @@ acpi_battery_get_info(struct acpi_battery *battery,
/* Evalute _BIF */
- status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer);
+ status = acpi_evaluate_object(battery->device->handle, "_BIF", NULL, &buffer);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
return -ENODEV;
@@ -198,7 +198,7 @@ acpi_battery_get_status(struct acpi_battery *battery,
/* Evalute _BST */
- status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer);
+ status = acpi_evaluate_object(battery->device->handle, "_BST", NULL, &buffer);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
return -ENODEV;
@@ -255,7 +255,7 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)
arg0.integer.value = alarm;
- status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL);
+ status = acpi_evaluate_object(battery->device->handle, "_BTP", &arg_list, NULL);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -278,9 +278,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
if (!battery)
return -EINVAL;
- result = acpi_bus_get_device(battery->handle, &device);
- if (result)
- return result;
+ device = battery->device;
result = acpi_bus_get_status(device);
if (result)
@@ -305,7 +303,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
/* See if alarms are supported, and if so, set default */
- status = acpi_get_handle(battery->handle, "_BTP", &handle);
+ status = acpi_get_handle(battery->device->handle, "_BTP", &handle);
if (ACPI_SUCCESS(status)) {
battery->flags.alarm = 1;
acpi_battery_set_alarm(battery, battery->trips.warning);
@@ -662,8 +660,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
if (!battery)
return;
- if (acpi_bus_get_device(handle, &device))
- return;
+ device = battery->device;
switch (event) {
case ACPI_BATTERY_NOTIFY_STATUS:
@@ -695,7 +692,7 @@ static int acpi_battery_add(struct acpi_device *device)
return -ENOMEM;
memset(battery, 0, sizeof(struct acpi_battery));
- battery->handle = device->handle;
+ battery->device = device;
strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
acpi_driver_data(device) = battery;
@@ -708,7 +705,7 @@ static int acpi_battery_add(struct acpi_device *device)
if (result)
goto end;
- status = acpi_install_notify_handler(battery->handle,
+ status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY,
acpi_battery_notify, battery);
if (ACPI_FAILURE(status)) {
@@ -740,7 +737,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
battery = (struct acpi_battery *)acpi_driver_data(device);
- status = acpi_remove_notify_handler(battery->handle,
+ status = acpi_remove_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY,
acpi_battery_notify);
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 02594639c4d9..fd1ba05eab68 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -82,7 +82,6 @@ static struct acpi_driver acpi_button_driver = {
};
struct acpi_button {
- acpi_handle handle;
struct acpi_device *device; /* Fixed button kludge */
u8 type;
unsigned long pushed;
@@ -137,7 +136,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
if (!button || !button->device)
return 0;
- status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state);
+ status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state);
if (ACPI_FAILURE(status)) {
seq_printf(seq, "state: unsupported\n");
} else {
@@ -282,7 +281,7 @@ static acpi_status acpi_button_notify_fixed(void *data)
if (!button)
return AE_BAD_PARAMETER;
- acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
+ acpi_button_notify(button->device->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
return AE_OK;
}
@@ -303,7 +302,6 @@ static int acpi_button_add(struct acpi_device *device)
memset(button, 0, sizeof(struct acpi_button));
button->device = device;
- button->handle = device->handle;
acpi_driver_data(device) = button;
/*
@@ -362,7 +360,7 @@ static int acpi_button_add(struct acpi_device *device)
button);
break;
default:
- status = acpi_install_notify_handler(button->handle,
+ status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY,
acpi_button_notify,
button);
@@ -420,7 +418,7 @@ static int acpi_button_remove(struct acpi_device *device, int type)
acpi_button_notify_fixed);
break;
default:
- status = acpi_remove_notify_handler(button->handle,
+ status = acpi_remove_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY,
acpi_button_notify);
break;
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 38acc69b21bc..daed2460924d 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -64,7 +64,7 @@ static struct acpi_driver acpi_fan_driver = {
};
struct acpi_fan {
- acpi_handle handle;
+ struct acpi_device * device;
};
/* --------------------------------------------------------------------------
@@ -80,7 +80,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset)
if (fan) {
- if (acpi_bus_get_power(fan->handle, &state))
+ if (acpi_bus_get_power(fan->device->handle, &state))
seq_printf(seq, "status: ERROR\n");
else
seq_printf(seq, "status: %s\n",
@@ -112,7 +112,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer,
state_string[count] = '\0';
- result = acpi_bus_set_power(fan->handle,
+ result = acpi_bus_set_power(fan->device->handle,
simple_strtoul(state_string, NULL, 0));
if (result)
return result;
@@ -191,12 +191,12 @@ static int acpi_fan_add(struct acpi_device *device)
return -ENOMEM;
memset(fan, 0, sizeof(struct acpi_fan));
- fan->handle = device->handle;
+ fan->device = device;
strcpy(acpi_device_name(device), "Fan");
strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
acpi_driver_data(device) = fan;
- result = acpi_bus_get_power(fan->handle, &state);
+ result = acpi_bus_get_power(device->handle, &state);
if (result) {
printk(KERN_ERR PREFIX "Reading power state\n");
goto end;
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 1badce27a83f..8197c0e40769 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -83,7 +83,6 @@ struct acpi_pci_link_irq {
struct acpi_pci_link {
struct list_head node;
struct acpi_device *device;
- acpi_handle handle;
struct acpi_pci_link_irq irq;
int refcnt;
};
@@ -175,7 +174,7 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link)
if (!link)
return -EINVAL;
- status = acpi_walk_resources(link->handle, METHOD_NAME__PRS,
+ status = acpi_walk_resources(link->device->handle, METHOD_NAME__PRS,
acpi_pci_link_check_possible, link);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS"));
@@ -249,8 +248,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
acpi_status status = AE_OK;
int irq = 0;
-
- if (!link || !link->handle)
+ if (!link)
return -EINVAL;
link->irq.active = 0;
@@ -274,7 +272,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
* Query and parse _CRS to get the current IRQ assignment.
*/
- status = acpi_walk_resources(link->handle, METHOD_NAME__CRS,
+ status = acpi_walk_resources(link->device->handle, METHOD_NAME__CRS,
acpi_pci_link_check_current, &irq);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS"));
@@ -360,7 +358,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
/* Attempt to set the resource */
- status = acpi_set_current_resources(link->handle, &buffer);
+ status = acpi_set_current_resources(link->device->handle, &buffer);
/* check for total failure */
if (ACPI_FAILURE(status)) {
@@ -699,7 +697,7 @@ int acpi_pci_link_free_irq(acpi_handle handle)
acpi_device_bid(link->device)));
if (link->refcnt == 0) {
- acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
+ acpi_ut_evaluate_object(link->device->handle, "_DIS", 0, NULL);
}
mutex_unlock(&acpi_link_lock);
return (link->irq.active);
@@ -726,7 +724,6 @@ static int acpi_pci_link_add(struct acpi_device *device)
memset(link, 0, sizeof(struct acpi_pci_link));
link->device = device;
- link->handle = device->handle;
strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS);
acpi_driver_data(device) = link;
@@ -765,7 +762,7 @@ static int acpi_pci_link_add(struct acpi_device *device)
end:
/* disable all links -- to be activated on use */
- acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
+ acpi_ut_evaluate_object(device->handle, "_DIS", 0, NULL);
mutex_unlock(&acpi_link_lock);
if (result)
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 8f10442119f0..0984a1ee24ed 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -58,7 +58,7 @@ static struct acpi_driver acpi_pci_root_driver = {
struct acpi_pci_root {
struct list_head node;
- acpi_handle handle;
+ struct acpi_device * device;
struct acpi_pci_id id;
struct pci_bus *bus;
};
@@ -83,7 +83,7 @@ int acpi_pci_register_driver(struct acpi_pci_driver *driver)
list_for_each(entry, &acpi_pci_roots) {
struct acpi_pci_root *root;
root = list_entry(entry, struct acpi_pci_root, node);
- driver->add(root->handle);
+ driver->add(root->device->handle);
n++;
}
@@ -110,7 +110,7 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
list_for_each(entry, &acpi_pci_roots) {
struct acpi_pci_root *root;
root = list_entry(entry, struct acpi_pci_root, node);
- driver->remove(root->handle);
+ driver->remove(root->device->handle);
}
}
@@ -170,7 +170,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
memset(root, 0, sizeof(struct acpi_pci_root));
INIT_LIST_HEAD(&root->node);
- root->handle = device->handle;
+ root->device = device;
strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
acpi_driver_data(device) = root;
@@ -185,7 +185,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
* -------
* Obtained via _SEG, if exists, otherwise assumed to be zero (0).
*/
- status = acpi_evaluate_integer(root->handle, METHOD_NAME__SEG, NULL,
+ status = acpi_evaluate_integer(device->handle, METHOD_NAME__SEG, NULL,
&value);
switch (status) {
case AE_OK:
@@ -207,7 +207,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
* ---
* Obtained via _BBN, if exists, otherwise assumed to be zero (0).
*/
- status = acpi_evaluate_integer(root->handle, METHOD_NAME__BBN, NULL,
+ status = acpi_evaluate_integer(device->handle, METHOD_NAME__BBN, NULL,
&value);
switch (status) {
case AE_OK:
@@ -234,7 +234,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
"Wrong _BBN value, reboot"
" and use option 'pci=noacpi'\n");
- status = try_get_root_bridge_busnr(root->handle, &bus);
+ status = try_get_root_bridge_busnr(device->handle, &bus);
if (ACPI_FAILURE(status))
break;
if (bus != root->id.bus) {
@@ -294,9 +294,9 @@ static int acpi_pci_root_add(struct acpi_device *device)
* -----------------
* Evaluate and parse _PRT, if exists.
*/
- status = acpi_get_handle(root->handle, METHOD_NAME__PRT, &handle);
+ status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
if (ACPI_SUCCESS(status))
- result = acpi_pci_irq_add_prt(root->handle, root->id.segment,
+ result = acpi_pci_irq_add_prt(device->handle, root->id.segment,
root->id.bus);
end:
@@ -315,7 +315,7 @@ static int acpi_pci_root_start(struct acpi_device *device)
list_for_each_entry(root, &acpi_pci_roots, node) {
- if (root->handle == device->handle) {
+ if (root->device == device) {
pci_bus_add_devices(root->bus);
return 0;
}
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 224f729f700e..5d3447f4582c 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -70,7 +70,7 @@ static struct acpi_driver acpi_power_driver = {
};
struct acpi_power_resource {
- acpi_handle handle;
+ struct acpi_device * device;
acpi_bus_id name;
u32 system_level;
u32 order;
@@ -124,7 +124,7 @@ static int acpi_power_get_state(struct acpi_power_resource *resource)
if (!resource)
return -EINVAL;
- status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta);
+ status = acpi_evaluate_integer(resource->device->handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -192,7 +192,7 @@ static int acpi_power_on(acpi_handle handle)
return 0;
}
- status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL);
+ status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -203,10 +203,8 @@ static int acpi_power_on(acpi_handle handle)
return -ENOEXEC;
/* Update the power resource's _device_ power state */
- result = acpi_bus_get_device(resource->handle, &device);
- if (result)
- return result;
- device->power.state = ACPI_STATE_D0;
+ device = resource->device;
+ resource->device->power.state = ACPI_STATE_D0;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n",
resource->name));
@@ -242,7 +240,7 @@ static int acpi_power_off_device(acpi_handle handle)
return 0;
}
- status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL);
+ status = acpi_evaluate_object(resource->device->handle, "_OFF", NULL, NULL);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -253,9 +251,7 @@ static int acpi_power_off_device(acpi_handle handle)
return -ENOEXEC;
/* Update the power resource's _device_ power state */
- result = acpi_bus_get_device(resource->handle, &device);
- if (result)
- return result;
+ device = resource->device;
device->power.state = ACPI_STATE_D3;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n",
@@ -544,14 +540,14 @@ static int acpi_power_add(struct acpi_device *device)
return -ENOMEM;
memset(resource, 0, sizeof(struct acpi_power_resource));
- resource->handle = device->handle;
+ resource->device = device;
strcpy(resource->name, device->pnp.bus_id);
strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
acpi_driver_data(device) = resource;
/* Evalute the object to get the system level and resource order. */
- status = acpi_evaluate_object(resource->handle, NULL, NULL, &buffer);
+ status = acpi_evaluate_object(device->handle, NULL, NULL, &buffer);
if (ACPI_FAILURE(status)) {
result = -ENODEV;
goto end;
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index c855f4446b5f..503c0b99db12 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -162,7 +162,7 @@ struct acpi_thermal_flags {
};
struct acpi_thermal {
- acpi_handle handle;
+ struct acpi_device * device;
acpi_bus_id name;
unsigned long temperature;
unsigned long last_temperature;
@@ -229,7 +229,7 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz)
tz->last_temperature = tz->temperature;
status =
- acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature);
+ acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tz->temperature);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -248,7 +248,7 @@ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
return -EINVAL;
status =
- acpi_evaluate_integer(tz->handle, "_TZP", NULL,
+ acpi_evaluate_integer(tz->device->handle, "_TZP", NULL,
&tz->polling_frequency);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -285,7 +285,7 @@ static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
if (!tz)
return -EINVAL;
- status = acpi_get_handle(tz->handle, "_SCP", &handle);
+ status = acpi_get_handle(tz->device->handle, "_SCP", &handle);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n"));
return -ENODEV;
@@ -316,7 +316,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
/* Critical Shutdown (required) */
- status = acpi_evaluate_integer(tz->handle, "_CRT", NULL,
+ status = acpi_evaluate_integer(tz->device->handle, "_CRT", NULL,
&tz->trips.critical.temperature);
if (ACPI_FAILURE(status)) {
tz->trips.critical.flags.valid = 0;
@@ -332,7 +332,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
/* Critical Sleep (optional) */
status =
- acpi_evaluate_integer(tz->handle, "_HOT", NULL,
+ acpi_evaluate_integer(tz->device->handle, "_HOT", NULL,
&tz->trips.hot.temperature);
if (ACPI_FAILURE(status)) {
tz->trips.hot.flags.valid = 0;
@@ -346,7 +346,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
/* Passive: Processors (optional) */
status =
- acpi_evaluate_integer(tz->handle, "_PSV", NULL,
+ acpi_evaluate_integer(tz->device->handle, "_PSV", NULL,
&tz->trips.passive.temperature);
if (ACPI_FAILURE(status)) {
tz->trips.passive.flags.valid = 0;
@@ -355,25 +355,25 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
tz->trips.passive.flags.valid = 1;
status =
- acpi_evaluate_integer(tz->handle, "_TC1", NULL,
+ acpi_evaluate_integer(tz->device->handle, "_TC1", NULL,
&tz->trips.passive.tc1);
if (ACPI_FAILURE(status))
tz->trips.passive.flags.valid = 0;
status =
- acpi_evaluate_integer(tz->handle, "_TC2", NULL,
+ acpi_evaluate_integer(tz->device->handle, "_TC2", NULL,
&tz->trips.passive.tc2);
if (ACPI_FAILURE(status))
tz->trips.passive.flags.valid = 0;
status =
- acpi_evaluate_integer(tz->handle, "_TSP", NULL,
+ acpi_evaluate_integer(tz->device->handle, "_TSP", NULL,
&tz->trips.passive.tsp);
if (ACPI_FAILURE(status))
tz->trips.passive.flags.valid = 0;
status =
- acpi_evaluate_reference(tz->handle, "_PSL", NULL,
+ acpi_evaluate_reference(tz->device->handle, "_PSL", NULL,
&tz->trips.passive.devices);
if (ACPI_FAILURE(status))
tz->trips.passive.flags.valid = 0;
@@ -393,14 +393,14 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
char name[5] = { '_', 'A', 'C', ('0' + i), '\0' };
status =
- acpi_evaluate_integer(tz->handle, name, NULL,
+ acpi_evaluate_integer(tz->device->handle, name, NULL,
&tz->trips.active[i].temperature);
if (ACPI_FAILURE(status))
break;
name[2] = 'L';
status =
- acpi_evaluate_reference(tz->handle, name, NULL,
+ acpi_evaluate_reference(tz->device->handle, name, NULL,
&tz->trips.active[i].devices);
if (ACPI_SUCCESS(status)) {
tz->trips.active[i].flags.valid = 1;
@@ -424,7 +424,7 @@ static int acpi_thermal_get_devices(struct acpi_thermal *tz)
return -EINVAL;
status =
- acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices);
+ acpi_evaluate_reference(tz->device->handle, "_TZD", NULL, &tz->devices);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -453,10 +453,6 @@ static int acpi_thermal_call_usermode(char *path)
static int acpi_thermal_critical(struct acpi_thermal *tz)
{
- int result = 0;
- struct acpi_device *device = NULL;
-
-
if (!tz || !tz->trips.critical.flags.valid)
return -EINVAL;
@@ -466,14 +462,10 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
} else if (tz->trips.critical.flags.enabled)
tz->trips.critical.flags.enabled = 0;
- result = acpi_bus_get_device(tz->handle, &device);
- if (result)
- return result;
-
printk(KERN_EMERG
"Critical temperature reached (%ld C), shutting down.\n",
KELVIN_TO_CELSIUS(tz->temperature));
- acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_CRITICAL,
+ acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL,
tz->trips.critical.flags.enabled);
acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF);
@@ -483,10 +475,6 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
static int acpi_thermal_hot(struct acpi_thermal *tz)
{
- int result = 0;
- struct acpi_device *device = NULL;
-
-
if (!tz || !tz->trips.hot.flags.valid)
return -EINVAL;
@@ -496,11 +484,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
} else if (tz->trips.hot.flags.enabled)
tz->trips.hot.flags.enabled = 0;
- result = acpi_bus_get_device(tz->handle, &device);
- if (result)
- return result;
-
- acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT,
+ acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT,
tz->trips.hot.flags.enabled);
/* TBD: Call user-mode "sleep(S4)" function */
@@ -1193,8 +1177,7 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
if (!tz)
return;
- if (acpi_bus_get_device(tz->handle, &device))
- return;
+ device = tz->device;
switch (event) {
case ACPI_THERMAL_NOTIFY_TEMPERATURE:
@@ -1293,7 +1276,7 @@ static int acpi_thermal_add(struct acpi_device *device)
return -ENOMEM;
memset(tz, 0, sizeof(struct acpi_thermal));
- tz->handle = device->handle;
+ tz->device = device;
strcpy(tz->name, device->pnp.bus_id);
strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
@@ -1311,7 +1294,7 @@ static int acpi_thermal_add(struct acpi_device *device)
acpi_thermal_check(tz);
- status = acpi_install_notify_handler(tz->handle,
+ status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY,
acpi_thermal_notify, tz);
if (ACPI_FAILURE(status)) {
@@ -1352,7 +1335,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
/* deferred task may reinsert timer */
del_timer_sync(&(tz->timer));
- status = acpi_remove_notify_handler(tz->handle,
+ status = acpi_remove_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY,
acpi_thermal_notify);
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 1f3ffb353299..56666a982476 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -117,7 +117,7 @@ struct acpi_video_enumerated_device {
};
struct acpi_video_bus {
- acpi_handle handle;
+ struct acpi_device *device;
u8 dos_setting;
struct acpi_video_enumerated_device *attached_array;
u8 attached_count;
@@ -155,7 +155,6 @@ struct acpi_video_device_brightness {
};
struct acpi_video_device {
- acpi_handle handle;
unsigned long device_id;
struct acpi_video_device_flags flags;
struct acpi_video_device_cap cap;
@@ -272,7 +271,8 @@ static int
acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
{
int status;
- status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state);
+
+ status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state);
return status;
}
@@ -283,8 +283,7 @@ acpi_video_device_get_state(struct acpi_video_device *device,
{
int status;
-
- status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state);
+ status = acpi_evaluate_integer(device->dev->handle, "_DCS", NULL, state);
return status;
}
@@ -299,7 +298,7 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state)
arg0.integer.value = state;
- status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret);
+ status = acpi_evaluate_integer(device->dev->handle, "_DSS", &args, &ret);
return status;
}
@@ -315,7 +314,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
*levels = NULL;
- status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer);
+ status = acpi_evaluate_object(device->dev->handle, "_BCL", NULL, &buffer);
if (!ACPI_SUCCESS(status))
return status;
obj = (union acpi_object *)buffer.pointer;
@@ -344,7 +343,7 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
arg0.integer.value = level;
- status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL);
+ status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
printk(KERN_DEBUG "set_level status: %x\n", status);
return status;
@@ -356,7 +355,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
{
int status;
- status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level);
+ status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level);
return status;
}
@@ -383,7 +382,7 @@ acpi_video_device_EDID(struct acpi_video_device *device,
else
return -EINVAL;
- status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer);
+ status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -413,7 +412,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
arg0.integer.value = option;
- status = acpi_evaluate_integer(video->handle, "_SPD", &args, &tmp);
+ status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp);
if (ACPI_SUCCESS(status))
status = tmp ? (-EINVAL) : (AE_OK);
@@ -425,8 +424,7 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
{
int status;
-
- status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id);
+ status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id);
return status;
}
@@ -437,7 +435,7 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video,
{
int status;
- status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options);
+ status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options);
*options &= 3;
return status;
@@ -478,7 +476,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
}
arg0.integer.value = (lcd_flag << 2) | bios_flag;
video->dos_setting = arg0.integer.value;
- acpi_evaluate_object(video->handle, "_DOS", &args, NULL);
+ acpi_evaluate_object(video->device->handle, "_DOS", &args, NULL);
Failed:
return status;
@@ -506,25 +504,25 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
memset(&device->cap, 0, 4);
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) {
device->cap._ADR = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) {
device->cap._BCL = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) {
device->cap._BCM = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) {
device->cap._DDC = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DCS", &h_dummy1))) {
device->cap._DCS = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DGS", &h_dummy1))) {
device->cap._DGS = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DSS", &h_dummy1))) {
device->cap._DSS = 1;
}
@@ -588,22 +586,22 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
acpi_handle h_dummy1;
memset(&video->cap, 0, 4);
- if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) {
video->cap._DOS = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) {
video->cap._DOD = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) {
video->cap._ROM = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) {
video->cap._GPD = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) {
video->cap._SPD = 1;
}
- if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) {
+ if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) {
video->cap._VPO = 1;
}
}
@@ -1271,7 +1269,6 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
memset(data, 0, sizeof(struct acpi_video_device));
- data->handle = device->handle;
strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
acpi_driver_data(device) = data;
@@ -1298,7 +1295,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
acpi_video_device_bind(video, data);
acpi_video_device_find_cap(data);
- status = acpi_install_notify_handler(data->handle,
+ status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY,
acpi_video_device_notify,
data);
@@ -1400,8 +1397,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
union acpi_object *dod = NULL;
union acpi_object *obj;
-
- status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer);
+ status = acpi_evaluate_object(video->device->handle, "_DOD", NULL, &buffer);
if (!ACPI_SUCCESS(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD"));
return status;
@@ -1569,7 +1565,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
up(&video->sem);
acpi_video_device_remove_fs(device->dev);
- status = acpi_remove_notify_handler(device->handle,
+ status = acpi_remove_notify_handler(device->dev->handle,
ACPI_DEVICE_NOTIFY,
acpi_video_device_notify);
@@ -1624,8 +1620,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
if (!video)
return;
- if (acpi_bus_get_device(handle, &device))
- return;
+ device = video->device;
switch (event) {
case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur,
@@ -1668,8 +1663,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
if (!video_device)
return;
- if (acpi_bus_get_device(handle, &device))
- return;
+ device = video_device->dev;
switch (event) {
case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */
@@ -1707,7 +1701,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
return -ENOMEM;
memset(video, 0, sizeof(struct acpi_video_bus));
- video->handle = device->handle;
+ video->device = device;
strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
acpi_driver_data(device) = video;
@@ -1727,7 +1721,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
acpi_video_bus_get_devices(video, device);
acpi_video_bus_start_devices(video);
- status = acpi_install_notify_handler(video->handle,
+ status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY,
acpi_video_bus_notify, video);
if (ACPI_FAILURE(status)) {
@@ -1767,7 +1761,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
acpi_video_bus_stop_devices(video);
- status = acpi_remove_notify_handler(video->handle,
+ status = acpi_remove_notify_handler(video->device->handle,
ACPI_DEVICE_NOTIFY,
acpi_video_bus_notify);