Commit e82ca043 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: (44 commits)
  ACPI: remove function tracing macros from drivers/acpi/*.c
  ACPI: add support for Smart Battery
  ACPI: handle battery notify event on broken BIOS
  ACPI: handle AC notify event on broken BIOS
  ACPI: asus_acpi: add S1N WLED control
  ACPI: asus_acpi: correct M6N/M6R display nodes
  ACPI: asus_acpi: add S1N WLED control
  ACPI: asus_acpi: rework model detection
  ACPI: asus_acpi: support L5D
  ACPI: asus_acpi: handle internal Bluetooth / support W5A
  ACPI: asus_acpi: support A4G
  ACPI: asus_acpi: support W3400N
  ACPI: asus_acpi: LED display support
  ACPI: asus_acpi: support A3G
  ACPI: asus_acpi: misc cleanups
  ACPI: video: Remove unneeded acpi_handle from driver.
  ACPI: thermal: Remove unneeded acpi_handle from driver.
  ACPI: power: Remove unneeded acpi_handle from driver.
  ACPI: pci_root: Remove unneeded acpi_handle from driver.
  ACPI: pci_link: Remove unneeded acpi_handle from driver.
  ...
parents 075395d2 309b0f12
...@@ -50,7 +50,7 @@ static acpi_status hp_ccsr_locate(acpi_handle obj, u64 *base, u64 *length) ...@@ -50,7 +50,7 @@ static acpi_status hp_ccsr_locate(acpi_handle obj, u64 *base, u64 *length)
memcpy(length, vendor->byte_data + 8, sizeof(*length)); memcpy(length, vendor->byte_data + 8, sizeof(*length));
exit: exit:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return status; return status;
} }
......
...@@ -856,7 +856,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu) ...@@ -856,7 +856,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
obj = buffer.pointer; obj = buffer.pointer;
if (obj->type != ACPI_TYPE_BUFFER || if (obj->type != ACPI_TYPE_BUFFER ||
obj->buffer.length < sizeof(*lsapic)) { obj->buffer.length < sizeof(*lsapic)) {
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return -EINVAL; return -EINVAL;
} }
...@@ -864,13 +864,13 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu) ...@@ -864,13 +864,13 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
if ((lsapic->header.type != ACPI_MADT_LSAPIC) || if ((lsapic->header.type != ACPI_MADT_LSAPIC) ||
(!lsapic->flags.enabled)) { (!lsapic->flags.enabled)) {
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return -EINVAL; return -EINVAL;
} }
physid = ((lsapic->id << 8) | (lsapic->eid)); physid = ((lsapic->id << 8) | (lsapic->eid));
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
buffer.length = ACPI_ALLOCATE_BUFFER; buffer.length = ACPI_ALLOCATE_BUFFER;
buffer.pointer = NULL; buffer.pointer = NULL;
...@@ -934,20 +934,20 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret) ...@@ -934,20 +934,20 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
obj = buffer.pointer; obj = buffer.pointer;
if (obj->type != ACPI_TYPE_BUFFER || if (obj->type != ACPI_TYPE_BUFFER ||
obj->buffer.length < sizeof(*iosapic)) { obj->buffer.length < sizeof(*iosapic)) {
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return AE_OK; return AE_OK;
} }
iosapic = (struct acpi_table_iosapic *)obj->buffer.pointer; iosapic = (struct acpi_table_iosapic *)obj->buffer.pointer;
if (iosapic->header.type != ACPI_MADT_IOSAPIC) { if (iosapic->header.type != ACPI_MADT_IOSAPIC) {
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return AE_OK; return AE_OK;
} }
gsi_base = iosapic->global_irq_base; gsi_base = iosapic->global_irq_base;
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
/* /*
* OK, it's an IOSAPIC MADT entry, look for a _PXM value to tell * OK, it's an IOSAPIC MADT entry, look for a _PXM value to tell
......
...@@ -352,6 +352,18 @@ config ACPI_HOTPLUG_MEMORY ...@@ -352,6 +352,18 @@ config ACPI_HOTPLUG_MEMORY
If one selects "m," this driver can be loaded using the following If one selects "m," this driver can be loaded using the following
command: command:
$>modprobe acpi_memhotplug $>modprobe acpi_memhotplug
config ACPI_SBS
tristate "Smart Battery System (EXPERIMENTAL)"
depends on X86 && I2C
depends on EXPERIMENTAL
default y
help
This driver adds support for the Smart Battery System.
Depends on I2C (Device Drivers ---> I2C support)
A "Smart Battery" is quite old and quite rare compared
to today's ACPI "Control Method" battery.
endif # ACPI endif # ACPI
endmenu endmenu
...@@ -58,3 +58,5 @@ obj-$(CONFIG_ACPI_IBM) += ibm_acpi.o ...@@ -58,3 +58,5 @@ obj-$(CONFIG_ACPI_IBM) += ibm_acpi.o
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
obj-y += scan.o motherboard.o obj-y += scan.o motherboard.o
obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
obj-y += cm_sbs.o
obj-$(CONFIG_ACPI_SBS) += i2c_ec.o sbs.o
...@@ -50,6 +50,9 @@ ACPI_MODULE_NAME("acpi_ac") ...@@ -50,6 +50,9 @@ ACPI_MODULE_NAME("acpi_ac")
MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME); MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
extern struct proc_dir_entry *acpi_lock_ac_dir(void);
extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
static int acpi_ac_add(struct acpi_device *device); static int acpi_ac_add(struct acpi_device *device);
static int acpi_ac_remove(struct acpi_device *device, int type); static int acpi_ac_remove(struct acpi_device *device, int type);
static int acpi_ac_open_fs(struct inode *inode, struct file *file); static int acpi_ac_open_fs(struct inode *inode, struct file *file);
...@@ -65,7 +68,7 @@ static struct acpi_driver acpi_ac_driver = { ...@@ -65,7 +68,7 @@ static struct acpi_driver acpi_ac_driver = {
}; };
struct acpi_ac { struct acpi_ac {
acpi_handle handle; struct acpi_device * device;
unsigned long state; unsigned long state;
}; };
...@@ -88,7 +91,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) ...@@ -88,7 +91,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
if (!ac) if (!ac)
return -EINVAL; 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)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state")); ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state"));
ac->state = ACPI_AC_STATUS_UNKNOWN; ac->state = ACPI_AC_STATUS_UNKNOWN;
...@@ -191,11 +194,11 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) ...@@ -191,11 +194,11 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
if (!ac) if (!ac)
return; return;
if (acpi_bus_get_device(ac->handle, &device)) device = ac->device;
return;
switch (event) { switch (event) {
case ACPI_AC_NOTIFY_STATUS: case ACPI_AC_NOTIFY_STATUS:
case ACPI_NOTIFY_BUS_CHECK:
case ACPI_NOTIFY_DEVICE_CHECK:
acpi_ac_get_state(ac); acpi_ac_get_state(ac);
acpi_bus_generate_event(device, event, (u32) ac->state); acpi_bus_generate_event(device, event, (u32) ac->state);
break; break;
...@@ -223,7 +226,7 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -223,7 +226,7 @@ static int acpi_ac_add(struct acpi_device *device)
return -ENOMEM; return -ENOMEM;
memset(ac, 0, sizeof(struct acpi_ac)); 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_name(device), ACPI_AC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_AC_CLASS); strcpy(acpi_device_class(device), ACPI_AC_CLASS);
acpi_driver_data(device) = ac; acpi_driver_data(device) = ac;
...@@ -236,8 +239,8 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -236,8 +239,8 @@ static int acpi_ac_add(struct acpi_device *device)
if (result) if (result)
goto end; goto end;
status = acpi_install_notify_handler(ac->handle, status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, acpi_ac_notify, ACPI_ALL_NOTIFY, acpi_ac_notify,
ac); ac);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
result = -ENODEV; result = -ENODEV;
...@@ -268,8 +271,8 @@ static int acpi_ac_remove(struct acpi_device *device, int type) ...@@ -268,8 +271,8 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
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(device->handle,
ACPI_DEVICE_NOTIFY, acpi_ac_notify); ACPI_ALL_NOTIFY, acpi_ac_notify);
acpi_ac_remove_fs(device); acpi_ac_remove_fs(device);
...@@ -280,17 +283,16 @@ static int acpi_ac_remove(struct acpi_device *device, int type) ...@@ -280,17 +283,16 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
static int __init acpi_ac_init(void) static int __init acpi_ac_init(void)
{ {
int result = 0; int result;
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); acpi_ac_dir = acpi_lock_ac_dir();
if (!acpi_ac_dir) if (!acpi_ac_dir)
return -ENODEV; return -ENODEV;
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); acpi_unlock_ac_dir(acpi_ac_dir);
return -ENODEV; return -ENODEV;
} }
...@@ -302,7 +304,7 @@ static void __exit acpi_ac_exit(void) ...@@ -302,7 +304,7 @@ static void __exit acpi_ac_exit(void)
acpi_bus_unregister_driver(&acpi_ac_driver); acpi_bus_unregister_driver(&acpi_ac_driver);
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); acpi_unlock_ac_dir(acpi_ac_dir);
return; return;
} }
......
...@@ -80,7 +80,7 @@ struct acpi_memory_info { ...@@ -80,7 +80,7 @@ struct acpi_memory_info {
}; };
struct acpi_memory_device { struct acpi_memory_device {
acpi_handle handle; struct acpi_device * device;
unsigned int state; /* State of the memory device */ unsigned int state; /* State of the memory device */
struct list_head res_list; struct list_head res_list;
}; };
...@@ -129,7 +129,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) ...@@ -129,7 +129,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
struct acpi_memory_info *info, *n; 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); acpi_memory_get_resource, mem_device);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
list_for_each_entry_safe(info, n, &mem_device->res_list, list) 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) ...@@ -192,7 +192,7 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
/* Get device present/absent information from the _STA */ /* Get device present/absent information from the _STA */
if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA", if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->device->handle, "_STA",
NULL, &current_status))) NULL, &current_status)))
return -ENODEV; return -ENODEV;
/* /*
...@@ -222,7 +222,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) ...@@ -222,7 +222,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
return result; 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... * Tell the VM there is more memory here...
* Note: Assume that this function returns zero on success * 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) ...@@ -269,7 +269,7 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
arg_list.pointer = &arg; arg_list.pointer = &arg;
arg.type = ACPI_TYPE_INTEGER; arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = 1; arg.integer.value = 1;
status = acpi_evaluate_object(mem_device->handle, status = acpi_evaluate_object(mem_device->device->handle,
"_EJ0", &arg_list, NULL); "_EJ0", &arg_list, NULL);
/* Return on _EJ0 failure */ /* Return on _EJ0 failure */
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -278,7 +278,7 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) ...@@ -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 */ /* 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); NULL, &current_status);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
...@@ -398,7 +398,7 @@ static int acpi_memory_device_add(struct acpi_device *device) ...@@ -398,7 +398,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
memset(mem_device, 0, sizeof(struct acpi_memory_device)); memset(mem_device, 0, sizeof(struct acpi_memory_device));
INIT_LIST_HEAD(&mem_device->res_list); 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_name(device), "%s", ACPI_MEMORY_DEVICE_NAME);
sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS); sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS);
acpi_driver_data(device) = mem_device; acpi_driver_data(device) = mem_device;
...@@ -466,7 +466,7 @@ static acpi_status is_memory_device(acpi_handle handle) ...@@ -466,7 +466,7 @@ static acpi_status is_memory_device(acpi_handle handle)
info = buffer.pointer; info = buffer.pointer;
if (!(info->valid & ACPI_VALID_HID)) { if (!(info->valid & ACPI_VALID_HID)) {
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return AE_ERROR; return AE_ERROR;
} }
...@@ -475,7 +475,7 @@ static acpi_status is_memory_device(acpi_handle handle) ...@@ -475,7 +475,7 @@ static acpi_status is_memory_device(acpi_handle handle)
(strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
status = AE_ERROR; status = AE_ERROR;
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return status; return status;
} }
......
This diff is collapsed.
...@@ -59,6 +59,9 @@ ACPI_MODULE_NAME("acpi_battery") ...@@ -59,6 +59,9 @@ ACPI_MODULE_NAME("acpi_battery")
MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME); MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
extern struct proc_dir_entry *acpi_lock_battery_dir(void);
extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
static int acpi_battery_add(struct acpi_device *device); static int acpi_battery_add(struct acpi_device *device);
static int acpi_battery_remove(struct acpi_device *device, int type); static int acpi_battery_remove(struct acpi_device *device, int type);
...@@ -108,7 +111,7 @@ struct acpi_battery_trips { ...@@ -108,7 +111,7 @@ struct acpi_battery_trips {
}; };
struct acpi_battery { struct acpi_battery {
acpi_handle handle; struct acpi_device * device;
struct acpi_battery_flags flags; struct acpi_battery_flags flags;
struct acpi_battery_trips trips; struct acpi_battery_trips trips;
unsigned long alarm; unsigned long alarm;
...@@ -138,7 +141,7 @@ acpi_battery_get_info(struct acpi_battery *battery, ...@@ -138,7 +141,7 @@ acpi_battery_get_info(struct acpi_battery *battery,
/* Evalute _BIF */ /* 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)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
return -ENODEV; return -ENODEV;
...@@ -171,7 +174,7 @@ acpi_battery_get_info(struct acpi_battery *battery, ...@@ -171,7 +174,7 @@ acpi_battery_get_info(struct acpi_battery *battery,
} }
end: end:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
if (!result) if (!result)
(*bif) = (struct acpi_battery_info *)data.pointer; (*bif) = (struct acpi_battery_info *)data.pointer;
...@@ -198,7 +201,7 @@ acpi_battery_get_status(struct acpi_battery *battery, ...@@ -198,7 +201,7 @@ acpi_battery_get_status(struct acpi_battery *battery,
/* Evalute _BST */ /* 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)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
return -ENODEV; return -ENODEV;
...@@ -231,7 +234,7 @@ acpi_battery_get_status(struct acpi_battery *battery, ...@@ -231,7 +234,7 @@ acpi_battery_get_status(struct acpi_battery *battery,
} }
end: end:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
if (!result) if (!result)
(*bst) = (struct acpi_battery_status *)data.pointer; (*bst) = (struct acpi_battery_status *)data.pointer;
...@@ -255,7 +258,7 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm) ...@@ -255,7 +258,7 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)
arg0.integer.value = 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)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
...@@ -278,9 +281,7 @@ static int acpi_battery_check(struct acpi_battery *battery) ...@@ -278,9 +281,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
if (!battery) if (!battery)
return -EINVAL; return -EINVAL;
result = acpi_bus_get_device(battery->handle, &device); device = battery->device;
if (result)
return result;
result = acpi_bus_get_status(device); result = acpi_bus_get_status(device);
if (result) if (result)
...@@ -305,7 +306,7 @@ static int acpi_battery_check(struct acpi_battery *battery) ...@@ -305,7 +306,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
/* See if alarms are supported, and if so, set default */ /* 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)) { if (ACPI_SUCCESS(status)) {
battery->flags.alarm = 1; battery->flags.alarm = 1;
acpi_battery_set_alarm(battery, battery->trips.warning); acpi_battery_set_alarm(battery, battery->trips.warning);
...@@ -662,12 +663,13 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) ...@@ -662,12 +663,13 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
if (!battery) if (!battery)
return; return;
if (acpi_bus_get_device(handle, &device)) device = battery->device;
return;
switch (event) { switch (event) {
case ACPI_BATTERY_NOTIFY_STATUS: case ACPI_BATTERY_NOTIFY_STATUS:
case ACPI_BATTERY_NOTIFY_INFO: case ACPI_BATTERY_NOTIFY_INFO:
case ACPI_NOTIFY_BUS_CHECK:
case ACPI_NOTIFY_DEVICE_CHECK:
acpi_battery_check(battery); acpi_battery_check(battery);
acpi_bus_generate_event(device, event, battery->flags.present); acpi_bus_generate_event(device, event, battery->flags.present);
break; break;
...@@ -695,7 +697,7 @@ static int acpi_battery_add(struct acpi_device *device) ...@@ -695,7 +697,7 @@ static int acpi_battery_add(struct acpi_device *device)
return -ENOMEM; return -ENOMEM;
memset(battery, 0, sizeof(struct acpi_battery)); 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_name(device), ACPI_BATTERY_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
acpi_driver_data(device) = battery; acpi_driver_data(device) = battery;
...@@ -708,8 +710,8 @@ static int acpi_battery_add(struct acpi_device *device) ...@@ -708,8 +710,8 @@ static int acpi_battery_add(struct acpi_device *device)
if (result) if (result)
goto end; goto end;
status = acpi_install_notify_handler(battery->handle, status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, ACPI_ALL_NOTIFY,
acpi_battery_notify, battery); acpi_battery_notify, battery);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
result = -ENODEV; result = -ENODEV;
...@@ -740,8 +742,8 @@ static int acpi_battery_remove(struct acpi_device *device, int type) ...@@ -740,8 +742,8 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
battery = (struct acpi_battery *)acpi_driver_data(device); 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_ALL_NOTIFY,
acpi_battery_notify); acpi_battery_notify);
acpi_battery_remove_fs(device); acpi_battery_remove_fs(device);
...@@ -753,17 +755,15 @@ static int acpi_battery_remove(struct acpi_device *device, int type) ...@@ -753,17 +755,15 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
static int __init acpi_battery_init(void) static int __init acpi_battery_init(void)
{ {
int result = 0; int result;
acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); acpi_battery_dir = acpi_lock_battery_dir();
if (!acpi_battery_dir) if (!acpi_battery_dir)
return -ENODEV; return -ENODEV;
acpi_battery_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_battery_driver); result = acpi_bus_register_driver(&acpi_battery_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); acpi_unlock_battery_dir(acpi_battery_dir);
return -ENODEV; return -ENODEV;
} }
...@@ -775,7 +775,7 @@ static void __exit acpi_battery_exit(void) ...@@ -775,7 +775,7 @@ static void __exit acpi_battery_exit(void)
acpi_bus_unregister_driver(&acpi_battery_driver); acpi_bus_unregister_driver(&acpi_battery_driver);
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); acpi_unlock_battery_dir(acpi_battery_dir);
return; return;
} }
......
...@@ -82,7 +82,6 @@ static struct acpi_driver acpi_button_driver = { ...@@ -82,7 +82,6 @@ static struct acpi_driver acpi_button_driver = {
}; };
struct acpi_button { struct acpi_button {
acpi_handle handle;
struct acpi_device *device; /* Fixed button kludge */ struct acpi_device *device; /* Fixed button kludge */
u8 type; u8 type;
unsigned long pushed; unsigned long pushed;
...@@ -137,7 +136,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) ...@@ -137,7 +136,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
if (!button || !button->device) if (!button || !button->device)
return 0; 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)) { if (ACPI_FAILURE(status)) {
seq_printf(seq, "state: unsupported\n"); seq_printf(seq, "state: unsupported\n");
} else { } else {
...@@ -282,7 +281,7 @@ static acpi_status acpi_button_notify_fixed(void *data) ...@@ -282,7 +281,7 @@ static acpi_status acpi_button_notify_fixed(void *data)
if (!button) if (!button)
return AE_BAD_PARAMETER; 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; return AE_OK;
} }
...@@ -303,7 +302,6 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -303,7 +302,6 @@ static int acpi_button_add(struct acpi_device *device)
memset(button, 0, sizeof(struct acpi_button)); memset(button, 0, sizeof(struct acpi_button));
button->device = device; button->device = device;
button->handle = device->handle;
acpi_driver_data(device) = button; acpi_driver_data(device) = button;
/* /*
...@@ -362,7 +360,7 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -362,7 +360,7 @@ static int acpi_button_add(struct acpi_device *device)
button); button);
break; break;
default: default:
status = acpi_install_notify_handler(button->handle, status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
acpi_button_notify, acpi_button_notify,
button); button);
...@@ -420,7 +418,7 @@ static int acpi_button_remove(struct acpi_device *device, int type) ...@@ -420,7 +418,7 @@ static int acpi_button_remove(struct acpi_device *device, int type)
acpi_button_notify_fixed); acpi_button_notify_fixed);
break; break;
default: default:
status = acpi_remove_notify_handler(button->handle, status = acpi_remove_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
acpi_button_notify); acpi_button_notify);
break; break;
......
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#include <acpi/acmacros.h>
#include <acpi/actypes.h>
#include <acpi/acutils.h>
ACPI_MODULE_NAME("cm_sbs")
#define ACPI_AC_CLASS "ac_adapter"
#define ACPI_BATTERY_CLASS "battery"
#define ACPI_SBS_COMPONENT 0x00080000
#define _COMPONENT ACPI_SBS_COMPONENT
static struct proc_dir_entry *acpi_ac_dir;
static struct proc_dir_entry *acpi_battery_dir;
static struct semaphore cm_sbs_sem;
static int lock_ac_dir_cnt = 0;
static int lock_battery_dir_cnt = 0;
struct proc_dir_entry *acpi_lock_ac_dir(void)
{
down(&cm_sbs_sem);
if (!acpi_ac_dir) {
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
}
if (acpi_ac_dir) {
lock_ac_dir_cnt++;
} else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Cannot create %s\n", ACPI_AC_CLASS));
}
up(&cm_sbs_sem);
return acpi_ac_dir;
}
EXPORT_SYMBOL(acpi_lock_ac_dir);
void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param)
{
down(&cm_sbs_sem);
if (acpi_ac_dir_param) {
lock_ac_dir_cnt--;
}
if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) {
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
acpi_ac_dir = 0;
}
up(&cm_sbs_sem);
}
EXPORT_SYMBOL(acpi_unlock_ac_dir);
struct proc_dir_entry *acpi_lock_battery_dir(void)
{
down(&cm_sbs_sem);
if (!acpi_battery_dir) {
acpi_battery_dir =
proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
}
if (acpi_battery_dir) {
lock_battery_dir_cnt++;
} else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Cannot create %s\n", ACPI_BATTERY_CLASS));
}
up(&cm_sbs_sem);
return acpi_battery_dir;
}
EXPORT_SYMBOL(acpi_lock_battery_dir);
void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param)
{
down(&cm_sbs_sem);
if (acpi_battery_dir_param) {
lock_battery_dir_cnt--;
}
if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param
&& acpi_battery_dir) {
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
acpi_battery_dir = 0;
}
up(&cm_sbs_sem);
return;
}
EXPORT_SYMBOL(acpi_unlock_battery_dir);
static int __init acpi_cm_sbs_init(void)
{
if (acpi_disabled)
return 0;
init_MUTEX(&cm_sbs_sem);
return 0;
}
subsys_initcall(acpi_cm_sbs_init);
...@@ -236,7 +236,7 @@ container_walk_namespace_cb(acpi_handle handle, ...@@ -236,7 +236,7 @@ container_walk_namespace_cb(acpi_handle handle,
} }
end: end:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return AE_OK; return AE_OK;
} }
......
...@@ -64,7 +64,7 @@ static struct acpi_driver acpi_fan_driver = { ...@@ -64,7 +64,7 @@ static struct acpi_driver acpi_fan_driver = {
}; };
struct acpi_fan { 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) ...@@ -80,7 +80,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset)
if (fan) { 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"); seq_printf(seq, "status: ERROR\n");
else else
seq_printf(seq, "status: %s\n", seq_printf(seq, "status: %s\n",
...@@ -112,7 +112,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, ...@@ -112,7 +112,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer,
state_string[count] = '\0'; 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)); simple_strtoul(state_string, NULL, 0));
if (result) if (result)
return result; return result;
...@@ -191,12 +191,12 @@ static int acpi_fan_add(struct acpi_device *device) ...@@ -191,12 +191,12 @@ static int acpi_fan_add(struct acpi_device *device)
return -ENOMEM; return -ENOMEM;
memset(fan, 0, sizeof(struct acpi_fan)); memset(fan, 0, sizeof(struct acpi_fan));
fan->handle = device->handle; fan->device = device;
strcpy(acpi_device_name(device), "Fan"); strcpy(acpi_device_name(device), "Fan");
strcpy(acpi_device_class(device), ACPI_FAN_CLASS); strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
acpi_driver_data(device) = fan; acpi_driver_data(device) = fan;
result = acpi_bus_get_power(fan->handle, &state); result = acpi_bus_get_power(device->handle, &state);
if (result) { if (result) {
printk(KERN_ERR PREFIX "Reading power state\n"); printk(KERN_ERR PREFIX "Reading power state\n");
goto end; goto end;
......
...@@ -152,7 +152,7 @@ static int get_root_bridge_busnr(acpi_handle handle) ...@@ -152,7 +152,7 @@ static int get_root_bridge_busnr(acpi_handle handle)
bbn = bus; bbn = bus;
} }
exit: exit:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return (int)bbn; return (int)bbn;
} }
...@@ -192,7 +192,7 @@ find_pci_rootbridge(acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -192,7 +192,7 @@ find_pci_rootbridge(acpi_handle handle, u32 lvl, void *context, void **rv)
find->handle = handle; find->handle = handle;
status = AE_OK; status = AE_OK;
exit: exit:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return status; return status;
} }
...@@ -224,7 +224,7 @@ do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -224,7 +224,7 @@ do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv)
info = buffer.pointer; info = buffer.pointer;
if (info->address == find->address) if (info->address == find->address)
find->handle = handle; find->handle = handle;
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
} }
return AE_OK; return AE_OK;
} }
...@@ -330,7 +330,7 @@ static int acpi_platform_notify(struct device *dev) ...@@ -330,7 +330,7 @@ static int acpi_platform_notify(struct device *dev)
acpi_get_name(dev->firmware_data, ACPI_FULL_PATHNAME, &buffer); acpi_get_name(dev->firmware_data, ACPI_FULL_PATHNAME, &buffer);
DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer); DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer);
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
} else } else
DBG("Device %s -> No ACPI support\n", dev->bus_id); DBG("Device %s -> No ACPI support\n", dev->bus_id);
#endif #endif
......
This diff is collapsed.
/*
* SMBus driver for ACPI Embedded Controller ($Revision: 1.2 $)
*
* Copyright (c) 2002, 2005 Ducrot Bruno
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 2.
*/
struct acpi_ec_smbus {
struct i2c_adapter adapter;
union acpi_ec *ec;
int base;
int alert;
};
struct acpi_ec_hc {
acpi_handle handle;
struct acpi_ec_smbus *smbus;
};
struct acpi_ec_hc *acpi_get_ec_hc(struct acpi_device *device);
...@@ -133,7 +133,7 @@ acpi_evaluate_object_typed(acpi_handle handle, ...@@ -133,7 +133,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
acpi_os_free(return_buffer->pointer); ACPI_FREE(return_buffer->pointer);
return_buffer->pointer = NULL; return_buffer->pointer = NULL;
} }
......
...@@ -259,12 +259,10 @@ int acpi_get_node(acpi_handle *handle) ...@@ -259,12 +259,10 @@ int acpi_get_node(acpi_handle *handle)
{ {
int pxm, node = -1; int pxm, node = -1;
ACPI_FUNCTION_TRACE("acpi_get_node");
pxm = acpi_get_pxm(handle); pxm = acpi_get_pxm(handle);
if (pxm >= 0) if (pxm >= 0)
node = acpi_map_pxm_to_node(pxm); node = acpi_map_pxm_to_node(pxm);
return_VALUE(node); return node;
} }
EXPORT_SYMBOL(acpi_get_node); EXPORT_SYMBOL(acpi_get_node);
...@@ -146,13 +146,6 @@ void *acpi_os_allocate(acpi_size size) ...@@ -146,13 +146,6 @@ void *acpi_os_allocate(acpi_size size)
return kmalloc(size, GFP_KERNEL); return kmalloc(size, GFP_KERNEL);
} }
void acpi_os_free(void *ptr)
{
kfree(ptr);
}
EXPORT_SYMBOL(acpi_os_free);
acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr) acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
{ {
if (efi_enabled) { if (efi_enabled) {
...@@ -742,7 +735,7 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle) ...@@ -742,7 +735,7 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle)
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
acpi_os_free(sem); kfree(sem);
sem = NULL; sem = NULL;
return AE_OK; return AE_OK;
......
...@@ -83,7 +83,6 @@ struct acpi_pci_link_irq { ...@@ -83,7 +83,6 @@ struct acpi_pci_link_irq {
struct acpi_pci_link { struct acpi_pci_link {
struct list_head node; struct list_head node;
struct acpi_device *device; struct acpi_device *device;
acpi_handle handle;
struct acpi_pci_link_irq irq; struct acpi_pci_link_irq irq;
int refcnt; int refcnt;
}; };
...@@ -175,7 +174,7 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link) ...@@ -175,7 +174,7 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link)
if (!link) if (!link)
return -EINVAL; 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); acpi_pci_link_check_possible, link);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS"));
...@@ -249,8 +248,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) ...@@ -249,8 +248,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
acpi_status status = AE_OK; acpi_status status = AE_OK;
int irq = 0; int irq = 0;
if (!link)
if (!link || !link->handle)
return -EINVAL; return -EINVAL;
link->irq.active = 0; link->irq.active = 0;
...@@ -274,7 +272,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) ...@@ -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. * 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); acpi_pci_link_check_current, &irq);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS"));
...@@ -360,7 +358,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) ...@@ -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; resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
/* Attempt to set the resource */ /* 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 */ /* check for total failure */
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -699,7 +697,7 @@ int acpi_pci_link_free_irq(acpi_handle handle) ...@@ -699,7 +697,7 @@ int acpi_pci_link_free_irq(acpi_handle handle)
acpi_device_bid(link->device))); acpi_device_bid(link->device)));
if (link->refcnt == 0) { 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); mutex_unlock(&acpi_link_lock);
return (link->irq.active); return (link->irq.active);
...@@ -726,7 +724,6 @@ static int acpi_pci_link_add(struct acpi_device *device) ...@@ -726,7 +724,6 @@ static int acpi_pci_link_add(struct acpi_device *device)
memset(link, 0, sizeof(struct acpi_pci_link)); memset(link, 0, sizeof(struct acpi_pci_link));
link->device = device; link->device = device;
link->handle = device->handle;
strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME); strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS);
acpi_driver_data(device) = link; acpi_driver_data(device) = link;
...@@ -765,7 +762,7 @@ static int acpi_pci_link_add(struct acpi_device *device) ...@@ -765,7 +762,7 @@ static int acpi_pci_link_add(struct acpi_device *device)
end: end:
/* disable all links -- to be activated on use */ /* 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); mutex_unlock(&acpi_link_lock);
if (result) if (result)
......
...@@ -58,7 +58,7 @@ static struct acpi_driver acpi_pci_root_driver = { ...@@ -58,7 +58,7 @@ static struct acpi_driver acpi_pci_root_driver = {
struct acpi_pci_root { struct acpi_pci_root {
struct list_head node; struct list_head node;
acpi_handle handle; struct acpi_device * device;
struct acpi_pci_id id; struct acpi_pci_id id;
struct pci_bus *bus; struct pci_bus *bus;
}; };
...@@ -83,7 +83,7 @@ int acpi_pci_register_driver(struct acpi_pci_driver *driver) ...@@ -83,7 +83,7 @@ int acpi_pci_register_driver(struct acpi_pci_driver *driver)
list_for_each(entry, &acpi_pci_roots) { list_for_each(entry, &acpi_pci_roots) {
struct acpi_pci_root *root; struct acpi_pci_root *root;
root = list_entry(entry, struct acpi_pci_root, node); root = list_entry(entry, struct acpi_pci_root, node);
driver->add(root->handle); driver->add(root->device->handle);
n++; n++;
} }
...@@ -110,7 +110,7 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver) ...@@ -110,7 +110,7 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
list_for_each(entry, &acpi_pci_roots) { list_for_each(entry, &acpi_pci_roots) {
struct acpi_pci_root *root; struct acpi_pci_root *root;
root = list_entry(entry, struct acpi_pci_root, node); 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) ...@@ -170,7 +170,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
memset(root, 0, sizeof(struct acpi_pci_root)); memset(root, 0, sizeof(struct acpi_pci_root));
INIT_LIST_HEAD(&root->node); INIT_LIST_HEAD(&root->node);
root->handle = device->handle; root->device = device;
strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
acpi_driver_data(device) = root; acpi_driver_data(device) = root;
...@@ -185,7 +185,7 @@ static int acpi_pci_root_add(struct acpi_device *device) ...@@ -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). * 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); &value);
switch (status) { switch (status) {
case AE_OK: case AE_OK:
...@@ -207,7 +207,7 @@ static int acpi_pci_root_add(struct acpi_device *device) ...@@ -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). * 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); &value);
switch (status) { switch (status) {
case AE_OK: case AE_OK:
...@@ -234,7 +234,7 @@ static int acpi_pci_root_add(struct acpi_device *device) ...@@ -234,7 +234,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
"Wrong _BBN value, reboot" "Wrong _BBN value, reboot"
" and use option 'pci=noacpi'\n"); " 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)) if (ACPI_FAILURE(status))
break; break;
if (bus != root->id.bus) { if (bus != root->id.bus) {
...@@ -294,9 +294,9 @@ static int acpi_pci_root_add(struct acpi_device *device) ...@@ -294,9 +294,9 @@ static int acpi_pci_root_add(struct acpi_device *device)
* ----------------- * -----------------
* Evaluate and parse _PRT, if exists. * 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)) 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); root->id.bus);
end: end:
...@@ -315,7 +315,7 @@ static int acpi_pci_root_start(struct acpi_device *device) ...@@ -315,7 +315,7 @@ static int acpi_pci_root_start(struct acpi_device *device)
list_for_each_entry(root, &acpi_pci_roots, node) { list_for_each_entry(root, &acpi_pci_roots, node) {
if (root->handle == device->handle) { if (root->device == device) {
pci_bus_add_devices(root->bus); pci_bus_add_devices(root->bus);
return 0; return 0;
} }
......
...@@ -70,7 +70,7 @@ static struct acpi_driver acpi_power_driver = { ...@@ -70,7 +70,7 @@ static struct acpi_driver acpi_power_driver = {
}; };
struct acpi_power_resource { struct acpi_power_resource {
acpi_handle handle; struct acpi_device * device;
acpi_bus_id name; acpi_bus_id name;
u32 system_level; u32 system_level;
u32 order; u32 order;
...@@ -124,7 +124,7 @@ static int acpi_power_get_state(struct acpi_power_resource *resource) ...@@ -124,7 +124,7 @@ static int acpi_power_get_state(struct acpi_power_resource *resource)
if (!resource) if (!resource)
return -EINVAL; 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)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
...@@ -192,7 +192,7 @@ static int acpi_power_on(acpi_handle handle) ...@@ -192,7 +192,7 @@ static int acpi_power_on(acpi_handle handle)
return 0; 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)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
...@@ -203,10 +203,8 @@ static int acpi_power_on(acpi_handle handle) ...@@ -203,10 +203,8 @@ static int acpi_power_on(acpi_handle handle)
return -ENOEXEC; return -ENOEXEC;
/* Update the power resource's _device_ power state */ /* Update the power resource's _device_ power state */
result = acpi_bus_get_device(resource->handle, &device); device = resource->device;
if (result) resource->device->power.state = ACPI_STATE_D0;
return result;
device->power.state = ACPI_STATE_D0;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n",
resource->name)); resource->name));
...@@ -242,7 +240,7 @@ static int acpi_power_off_device(acpi_handle handle) ...@@ -242,7 +240,7 @@ static int acpi_power_off_device(acpi_handle handle)
return 0; 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)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
...@@ -253,9 +251,7 @@ static int acpi_power_off_device(acpi_handle handle) ...@@ -253,9 +251,7 @@ static int acpi_power_off_device(acpi_handle handle)
return -ENOEXEC; return -ENOEXEC;
/* Update the power resource's _device_ power state */ /* Update the power resource's _device_ power state */
result = acpi_bus_get_device(resource->handle, &device); device = resource->device;
if (result)
return result;
device->power.state = ACPI_STATE_D3; device->power.state = ACPI_STATE_D3;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n",
...@@ -544,14 +540,14 @@ static int acpi_power_add(struct acpi_device *device) ...@@ -544,14 +540,14 @@ static int acpi_power_add(struct acpi_device *device)
return -ENOMEM; return -ENOMEM;
memset(resource, 0, sizeof(struct acpi_power_resource)); memset(resource, 0, sizeof(struct acpi_power_resource));
resource->handle = device->handle; resource->device = device;
strcpy(resource->name, device->pnp.bus_id); strcpy(resource->name, device->pnp.bus_id);
strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_POWER_CLASS); strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
acpi_driver_data(device) = resource; acpi_driver_data(device) = resource;
/* Evalute the object to get the system level and resource order. */ /* 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)) { if (ACPI_FAILURE(status)) {
result = -ENODEV; result = -ENODEV;
goto end; goto end;
......
...@@ -768,7 +768,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) ...@@ -768,7 +768,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
status = -EFAULT; status = -EFAULT;
end: end:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return status; return status;
} }
......
...@@ -216,7 +216,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) ...@@ -216,7 +216,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
sizeof(struct acpi_pct_register)); sizeof(struct acpi_pct_register));
end: end:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return result; return result;
} }
...@@ -294,7 +294,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) ...@@ -294,7 +294,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
} }
end: end:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return result; return result;
} }
...@@ -592,7 +592,7 @@ static int acpi_processor_get_psd(struct acpi_processor *pr) ...@@ -592,7 +592,7 @@ static int acpi_processor_get_psd(struct acpi_processor *pr)
} }
end: end:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return result; return result;
} }
......
This diff is collapsed.
...@@ -319,7 +319,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) ...@@ -319,7 +319,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
goto end; goto end;
} }
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
device->wakeup.flags.valid = 1; device->wakeup.flags.valid = 1;
/* Power button, Lid switch always enable wakeup */ /* Power button, Lid switch always enable wakeup */
...@@ -854,7 +854,7 @@ static void acpi_device_set_id(struct acpi_device *device, ...@@ -854,7 +854,7 @@ static void acpi_device_set_id(struct acpi_device *device,
printk(KERN_ERR "Memory allocation error\n"); printk(KERN_ERR "Memory allocation error\n");
} }
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
} }
static int acpi_device_set_context(struct acpi_device *device, int type) static int acpi_device_set_context(struct acpi_device *device, int type)
......
...@@ -86,7 +86,7 @@ acpi_system_read_dsdt(struct file *file, ...@@ -86,7 +86,7 @@ acpi_system_read_dsdt(struct file *file,
res = simple_read_from_buffer(buffer, count, ppos, res = simple_read_from_buffer(buffer, count, ppos,
dsdt.pointer, dsdt.length); dsdt.pointer, dsdt.length);
acpi_os_free(dsdt.pointer); kfree(dsdt.pointer);
return res; return res;
} }
...@@ -113,7 +113,7 @@ acpi_system_read_fadt(struct file *file, ...@@ -113,7 +113,7 @@ acpi_system_read_fadt(struct file *file,
res = simple_read_from_buffer(buffer, count, ppos, res = simple_read_from_buffer(buffer, count, ppos,
fadt.pointer, fadt.length); fadt.pointer, fadt.length);
acpi_os_free(fadt.pointer); kfree(fadt.pointer);
return res; return res;
} }
......
...@@ -162,7 +162,7 @@ struct acpi_thermal_flags { ...@@ -162,7 +162,7 @@ struct acpi_thermal_flags {
}; };
struct acpi_thermal { struct acpi_thermal {
acpi_handle handle; struct acpi_device * device;
acpi_bus_id name; acpi_bus_id name;
unsigned long temperature; unsigned long temperature;
unsigned long last_temperature; unsigned long last_temperature;
...@@ -229,7 +229,7 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz) ...@@ -229,7 +229,7 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz)
tz->last_temperature = tz->temperature; tz->last_temperature = tz->temperature;
status = status =
acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature); acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tz->temperature);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
...@@ -248,7 +248,7 @@ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) ...@@ -248,7 +248,7 @@ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
return -EINVAL; return -EINVAL;
status = status =
acpi_evaluate_integer(tz->handle, "_TZP", NULL, acpi_evaluate_integer(tz->device->handle, "_TZP", NULL,
&tz->polling_frequency); &tz->polling_frequency);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
...@@ -285,7 +285,7 @@ static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) ...@@ -285,7 +285,7 @@ static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
if (!tz) if (!tz)
return -EINVAL; return -EINVAL;
status = acpi_get_handle(tz->handle, "_SCP", &handle); status = acpi_get_handle(tz->device->handle, "_SCP", &handle);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n"));
return -ENODEV; return -ENODEV;
...@@ -316,7 +316,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) ...@@ -316,7 +316,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
/* Critical Shutdown (required) */ /* Critical Shutdown (required) */
status = acpi_evaluate_integer(tz->handle, "_CRT", NULL, status = acpi_evaluate_integer(tz->device->handle, "_CRT", NULL,
&tz->trips.critical.temperature); &tz->trips.critical.temperature);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
tz->trips.critical.flags.valid = 0; tz->trips.critical.flags.valid = 0;
...@@ -332,7 +332,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) ...@@ -332,7 +332,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
/* Critical Sleep (optional) */ /* Critical Sleep (optional) */
status = status =
acpi_evaluate_integer(tz->handle, "_HOT", NULL, acpi_evaluate_integer(tz->device->handle, "_HOT", NULL,
&tz->trips.hot.temperature); &tz->trips.hot.temperature);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
tz->trips.hot.flags.valid = 0; tz->trips.hot.flags.valid = 0;
...@@ -346,7 +346,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) ...@@ -346,7 +346,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
/* Passive: Processors (optional) */ /* Passive: Processors (optional) */
status = status =
acpi_evaluate_integer(tz->handle, "_PSV", NULL, acpi_evaluate_integer(tz->device->handle, "_PSV", NULL,
&tz->trips.passive.temperature); &tz->trips.passive.temperature);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
tz->trips.passive.flags.valid = 0; tz->trips.passive.flags.valid = 0;
...@@ -355,25 +355,25 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) ...@@ -355,25 +355,25 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
tz->trips.passive.flags.valid = 1; tz->trips.passive.flags.valid = 1;
status = status =
acpi_evaluate_integer(tz->handle, "_TC1", NULL, acpi_evaluate_integer(tz->device->handle, "_TC1", NULL,
&tz->trips.passive.tc1); &tz->trips.passive.tc1);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
tz->trips.passive.flags.valid = 0; tz->trips.passive.flags.valid = 0;
status = status =
acpi_evaluate_integer(tz->handle, "_TC2", NULL, acpi_evaluate_integer(tz->device->handle, "_TC2", NULL,
&tz->trips.passive.tc2); &tz->trips.passive.tc2);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
tz->trips.passive.flags.valid = 0; tz->trips.passive.flags.valid = 0;
status = status =
acpi_evaluate_integer(tz->handle, "_TSP", NULL, acpi_evaluate_integer(tz->device->handle, "_TSP", NULL,
&tz->trips.passive.tsp); &tz->trips.passive.tsp);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
tz->trips.passive.flags.valid = 0; tz->trips.passive.flags.valid = 0;
status = status =
acpi_evaluate_reference(tz->handle, "_PSL", NULL, acpi_evaluate_reference(tz->device->handle, "_PSL", NULL,
&tz->trips.passive.devices); &tz->trips.passive.devices);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
tz->trips.passive.flags.valid = 0; tz->trips.passive.flags.valid = 0;
...@@ -393,14 +393,14 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) ...@@ -393,14 +393,14 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
char name[5] = { '_', 'A', 'C', ('0' + i), '\0' }; char name[5] = { '_', 'A', 'C', ('0' + i), '\0' };
status = status =
acpi_evaluate_integer(tz->handle, name, NULL, acpi_evaluate_integer(tz->device->handle, name, NULL,
&tz->trips.active[i].temperature); &tz->trips.active[i].temperature);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
break; break;
name[2] = 'L'; name[2] = 'L';
status = status =
acpi_evaluate_reference(tz->handle, name, NULL, acpi_evaluate_reference(tz->device->handle, name, NULL,
&tz->trips.active[i].devices); &tz->trips.active[i].devices);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
tz->trips.active[i].flags.valid = 1; tz->trips.active[i].flags.valid = 1;
...@@ -424,7 +424,7 @@ static int acpi_thermal_get_devices(struct acpi_thermal *tz) ...@@ -424,7 +424,7 @@ static int acpi_thermal_get_devices(struct acpi_thermal *tz)
return -EINVAL; return -EINVAL;
status = status =
acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); acpi_evaluate_reference(tz->device->handle, "_TZD", NULL, &tz->devices);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
...@@ -453,10 +453,6 @@ static int acpi_thermal_call_usermode(char *path) ...@@ -453,10 +453,6 @@ static int acpi_thermal_call_usermode(char *path)
static int acpi_thermal_critical(struct acpi_thermal *tz) static int acpi_thermal_critical(struct acpi_thermal *tz)
{ {
int result = 0;
struct acpi_device *device = NULL;
if (!tz || !tz->trips.critical.flags.valid) if (!tz || !tz->trips.critical.flags.valid)
return -EINVAL; return -EINVAL;
...@@ -466,14 +462,10 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) ...@@ -466,14 +462,10 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
} else if (tz->trips.critical.flags.enabled) } else if (tz->trips.critical.flags.enabled)
tz->trips.critical.flags.enabled = 0; tz->trips.critical.flags.enabled = 0;
result = acpi_bus_get_device(tz->handle, &device);
if (result)
return result;
printk(KERN_EMERG printk(KERN_EMERG
"Critical temperature reached (%ld C), shutting down.\n", "Critical temperature reached (%ld C), shutting down.\n",
KELVIN_TO_CELSIUS(tz->temperature)); 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); tz->trips.critical.flags.enabled);
acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF);
...@@ -483,10 +475,6 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) ...@@ -483,10 +475,6 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
static int acpi_thermal_hot(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) if (!tz || !tz->trips.hot.flags.valid)
return -EINVAL; return -EINVAL;
...@@ -496,11 +484,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) ...@@ -496,11 +484,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
} else if (tz->trips.hot.flags.enabled) } else if (tz->trips.hot.flags.enabled)
tz->trips.hot.flags.enabled = 0; tz->trips.hot.flags.enabled = 0;
result = acpi_bus_get_device(tz->handle, &device); acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT,
if (result)
return result;
acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT,
tz->trips.hot.flags.enabled); tz->trips.hot.flags.enabled);
/* TBD: Call user-mode "sleep(S4)" function */ /* TBD: Call user-mode "sleep(S4)" function */
...@@ -1193,8 +1177,7 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) ...@@ -1193,8 +1177,7 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
if (!tz) if (!tz)
return; return;
if (acpi_bus_get_device(tz->handle, &device)) device = tz->device;
return;
switch (event) { switch (event) {
case ACPI_THERMAL_NOTIFY_TEMPERATURE: case ACPI_THERMAL_NOTIFY_TEMPERATURE:
...@@ -1293,7 +1276,7 @@ static int acpi_thermal_add(struct acpi_device *device) ...@@ -1293,7 +1276,7 @@ static int acpi_thermal_add(struct acpi_device *device)
return -ENOMEM; return -ENOMEM;
memset(tz, 0, sizeof(struct acpi_thermal)); memset(tz, 0, sizeof(struct acpi_thermal));
tz->handle = device->handle; tz->device = device;
strcpy(tz->name, device->pnp.bus_id); strcpy(tz->name, device->pnp.bus_id);
strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
...@@ -1311,7 +1294,7 @@ static int acpi_thermal_add(struct acpi_device *device) ...@@ -1311,7 +1294,7 @@ static int acpi_thermal_add(struct acpi_device *device)
acpi_thermal_check(tz); acpi_thermal_check(tz);
status = acpi_install_notify_handler(tz->handle, status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
acpi_thermal_notify, tz); acpi_thermal_notify, tz);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -1352,7 +1335,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) ...@@ -1352,7 +1335,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
/* deferred task may reinsert timer */ /* deferred task may reinsert timer */
del_timer_sync(&(tz->timer)); del_timer_sync(&(tz->timer));
status = acpi_remove_notify_handler(tz->handle, status = acpi_remove_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
acpi_thermal_notify); acpi_thermal_notify);
......
...@@ -166,10 +166,10 @@ acpi_status acpi_ut_delete_caches(void) ...@@ -166,10 +166,10 @@ acpi_status acpi_ut_delete_caches(void)
/* Free memory lists */ /* Free memory lists */
acpi_os_free(acpi_gbl_global_list); ACPI_FREE(acpi_gbl_global_list);
acpi_gbl_global_list = NULL; acpi_gbl_global_list = NULL;
acpi_os_free(acpi_gbl_ns_node_list); ACPI_FREE(acpi_gbl_ns_node_list);
acpi_gbl_ns_node_list = NULL; acpi_gbl_ns_node_list = NULL;
#endif #endif
......
...@@ -162,7 +162,7 @@ acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache) ...@@ -162,7 +162,7 @@ acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache)
/* Now we can delete the cache object */ /* Now we can delete the cache object */
acpi_os_free(cache); ACPI_FREE(cache);
return (AE_OK); return (AE_OK);
} }
......
...@@ -332,7 +332,7 @@ acpi_evaluate_string(acpi_handle handle, ...@@ -332,7 +332,7 @@ acpi_evaluate_string(acpi_handle handle,
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%s]\n", *data)); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%s]\n", *data));
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return AE_OK; return AE_OK;
} }
...@@ -418,7 +418,7 @@ acpi_evaluate_reference(acpi_handle handle, ...@@ -418,7 +418,7 @@ acpi_evaluate_reference(acpi_handle handle,
//kfree(list->handles); //kfree(list->handles);
} }
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return status; return status;
} }
......
...@@ -117,7 +117,7 @@ struct acpi_video_enumerated_device { ...@@ -117,7 +117,7 @@ struct acpi_video_enumerated_device {
}; };
struct acpi_video_bus { struct acpi_video_bus {
acpi_handle handle; struct acpi_device *device;
u8 dos_setting; u8 dos_setting;
struct acpi_video_enumerated_device *attached_array; struct acpi_video_enumerated_device *attached_array;
u8 attached_count; u8 attached_count;
...@@ -155,7 +155,6 @@ struct acpi_video_device_brightness { ...@@ -155,7 +155,6 @@ struct acpi_video_device_brightness {
}; };
struct acpi_video_device { struct acpi_video_device {
acpi_handle handle;
unsigned long device_id; unsigned long device_id;
struct acpi_video_device_flags flags; struct acpi_video_device_flags flags;
struct acpi_video_device_cap cap; struct acpi_video_device_cap cap;
...@@ -272,7 +271,8 @@ static int ...@@ -272,7 +271,8 @@ static int
acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
{ {
int status; int status;
status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state);
status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state);
return status; return status;
} }
...@@ -283,8 +283,7 @@ acpi_video_device_get_state(struct acpi_video_device *device, ...@@ -283,8 +283,7 @@ acpi_video_device_get_state(struct acpi_video_device *device,
{ {
int status; int status;
status = acpi_evaluate_integer(device->dev->handle, "_DCS", NULL, state);
status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state);
return status; return status;
} }
...@@ -299,7 +298,7 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state) ...@@ -299,7 +298,7 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state)
arg0.integer.value = 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; return status;
} }
...@@ -315,7 +314,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, ...@@ -315,7 +314,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
*levels = NULL; *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)) if (!ACPI_SUCCESS(status))
return status; return status;
obj = (union acpi_object *)buffer.pointer; obj = (union acpi_object *)buffer.pointer;
...@@ -344,7 +343,7 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) ...@@ -344,7 +343,7 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
arg0.integer.value = 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); printk(KERN_DEBUG "set_level status: %x\n", status);
return status; return status;
...@@ -356,7 +355,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, ...@@ -356,7 +355,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
{ {
int status; int status;
status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level);
return status; return status;
} }
...@@ -383,7 +382,7 @@ acpi_video_device_EDID(struct acpi_video_device *device, ...@@ -383,7 +382,7 @@ acpi_video_device_EDID(struct acpi_video_device *device,
else else
return -EINVAL; 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)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
...@@ -413,7 +412,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) ...@@ -413,7 +412,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
arg0.integer.value = 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)) if (ACPI_SUCCESS(status))
status = tmp ? (-EINVAL) : (AE_OK); status = tmp ? (-EINVAL) : (AE_OK);
...@@ -425,8 +424,7 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id) ...@@ -425,8 +424,7 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
{ {
int status; int status;
status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id);
status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id);
return status; return status;
} }
...@@ -437,7 +435,7 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video, ...@@ -437,7 +435,7 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video,
{ {
int status; int status;
status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options);
*options &= 3; *options &= 3;
return status; return status;
...@@ -478,7 +476,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) ...@@ -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; arg0.integer.value = (lcd_flag << 2) | bios_flag;
video->dos_setting = arg0.integer.value; video->dos_setting = arg0.integer.value;
acpi_evaluate_object(video->handle, "_DOS", &args, NULL); acpi_evaluate_object(video->device->handle, "_DOS", &args, NULL);
Failed: Failed:
return status; return status;
...@@ -506,25 +504,25 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) ...@@ -506,25 +504,25 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
memset(&device->cap, 0, 4); 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; 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; 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; 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; 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; 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; 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; device->cap._DSS = 1;
} }
...@@ -588,22 +586,22 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video) ...@@ -588,22 +586,22 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
acpi_handle h_dummy1; acpi_handle h_dummy1;
memset(&video->cap, 0, 4); 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; 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; 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; 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; 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; 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; video->cap._VPO = 1;
} }
} }
...@@ -1271,7 +1269,6 @@ acpi_video_bus_get_one_device(struct acpi_device *device, ...@@ -1271,7 +1269,6 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
memset(data, 0, sizeof(struct acpi_video_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_name(device), ACPI_VIDEO_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
acpi_driver_data(device) = data; acpi_driver_data(device) = data;
...@@ -1298,7 +1295,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, ...@@ -1298,7 +1295,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
acpi_video_device_bind(video, data); acpi_video_device_bind(video, data);
acpi_video_device_find_cap(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_DEVICE_NOTIFY,
acpi_video_device_notify, acpi_video_device_notify,
data); data);
...@@ -1400,8 +1397,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) ...@@ -1400,8 +1397,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
union acpi_object *dod = NULL; union acpi_object *dod = NULL;
union acpi_object *obj; union acpi_object *obj;
status = acpi_evaluate_object(video->device->handle, "_DOD", NULL, &buffer);
status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer);
if (!ACPI_SUCCESS(status)) { if (!ACPI_SUCCESS(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD")); ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD"));
return status; return status;
...@@ -1450,7 +1446,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) ...@@ -1450,7 +1446,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
video->attached_array = active_device_list; video->attached_array = active_device_list;
video->attached_count = count; video->attached_count = count;
out: out:
acpi_os_free(buffer.pointer); kfree(buffer.pointer);
return status; return status;
} }
...@@ -1569,7 +1565,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) ...@@ -1569,7 +1565,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
up(&video->sem); up(&video->sem);
acpi_video_device_remove_fs(device->dev); 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_DEVICE_NOTIFY,
acpi_video_device_notify); acpi_video_device_notify);
...@@ -1624,8 +1620,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) ...@@ -1624,8 +1620,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
if (!video) if (!video)
return; return;
if (acpi_bus_get_device(handle, &device)) device = video->device;
return;
switch (event) { switch (event) {
case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur,
...@@ -1668,8 +1663,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) ...@@ -1668,8 +1663,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
if (!video_device) if (!video_device)
return; return;
if (acpi_bus_get_device(handle, &device)) device = video_device->dev;
return;
switch (event) { switch (event) {
case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */
...@@ -1707,7 +1701,7 @@ static int acpi_video_bus_add(struct acpi_device *device) ...@@ -1707,7 +1701,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
return -ENOMEM; return -ENOMEM;
memset(video, 0, sizeof(struct acpi_video_bus)); 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_name(device), ACPI_VIDEO_BUS_NAME);
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
acpi_driver_data(device) = video; acpi_driver_data(device) = video;
...@@ -1727,7 +1721,7 @@ static int acpi_video_bus_add(struct acpi_device *device) ...@@ -1727,7 +1721,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
acpi_video_bus_get_devices(video, device); acpi_video_bus_get_devices(video, device);
acpi_video_bus_start_devices(video); acpi_video_bus_start_devices(video);
status = acpi_install_notify_handler(video->handle, status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
acpi_video_bus_notify, video); acpi_video_bus_notify, video);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -1767,7 +1761,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) ...@@ -1767,7 +1761,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
acpi_video_bus_stop_devices(video); 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_DEVICE_NOTIFY,
acpi_video_bus_notify); acpi_video_bus_notify);
......
...@@ -726,7 +726,7 @@ ...@@ -726,7 +726,7 @@
#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) #define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_FREE(a) acpi_os_free(a) #define ACPI_FREE(a) kfree(a)
#define ACPI_MEM_TRACKING(a) #define ACPI_MEM_TRACKING(a)
#else #else
......
...@@ -143,8 +143,6 @@ void acpi_os_release_mutex(acpi_mutex handle); ...@@ -143,8 +143,6 @@ void acpi_os_release_mutex(acpi_mutex handle);
*/ */
void *acpi_os_allocate(acpi_size size); void *acpi_os_allocate(acpi_size size);
void acpi_os_free(void *memory);
acpi_status acpi_status
acpi_os_map_memory(acpi_physical_address physical_address, acpi_os_map_memory(acpi_physical_address physical_address,
acpi_size size, void __iomem ** logical_address); acpi_size size, void __iomem ** logical_address);
......
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