Commit c92f56cb authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'acpi-cleanup'

* acpi-cleanup: (21 commits)
  ACPI / dock: fix error return code in dock_add()
  ACPI / dock: Drop unnecessary local variable from dock_add()
  ACPI / dock / PCI: Drop ACPI dock notifier chain
  ACPI / dock: Do not check CONFIG_ACPI_DOCK_MODULE
  ACPI / dock: Do not leak memory on falilures to add a dock station
  ACPI: Drop ACPI bus notifier call chain
  ACPI / dock: Rework the handling of notifications
  ACPI / dock: Simplify dock_init_hotplug() and dock_release_hotplug()
  ACPI / dock: Walk list in reverse order during removal of devices
  ACPI / dock: Rework and simplify find_dock_devices()
  ACPI / dock: Drop the hp_lock mutex from struct dock_station
  ACPI: simplify acpiphp driver with new helper functions
  ACPI: simplify dock driver with new helper functions
  ACPI: Export acpi_(bay)|(dock)_match() from scan.c
  ACPI: introduce two helper functions for _EJ0 and _LCK
  ACPI: introduce helper function acpi_execute_simple_method()
  ACPI: introduce helper function acpi_has_method()
  ACPI / dock: simplify dock_create_acpi_device()
  ACPI / dock: mark initialization functions with __init
  ACPI / dock: drop redundant spin lock in dock station object
  ...
parents d8dfad38 0177f29f
......@@ -527,18 +527,14 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
static int acpi_battery_set_alarm(struct acpi_battery *battery)
{
acpi_status status = 0;
union acpi_object arg0 = { .type = ACPI_TYPE_INTEGER };
struct acpi_object_list arg_list = { 1, &arg0 };
if (!acpi_battery_present(battery) ||
!test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags))
return -ENODEV;
arg0.integer.value = battery->alarm;
mutex_lock(&battery->lock);
status = acpi_evaluate_object(battery->device->handle, "_BTP",
&arg_list, NULL);
status = acpi_execute_simple_method(battery->device->handle, "_BTP",
battery->alarm);
mutex_unlock(&battery->lock);
if (ACPI_FAILURE(status))
......@@ -550,12 +546,8 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery)
static int acpi_battery_init_alarm(struct acpi_battery *battery)
{
acpi_status status = AE_OK;
acpi_handle handle = NULL;
/* See if alarms are supported, and if so, set default */
status = acpi_get_handle(battery->device->handle, "_BTP", &handle);
if (ACPI_FAILURE(status)) {
if (!acpi_has_method(battery->device->handle, "_BTP")) {
clear_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags);
return 0;
}
......@@ -1068,7 +1060,7 @@ static int acpi_battery_add(struct acpi_device *device)
{
int result = 0;
struct acpi_battery *battery = NULL;
acpi_handle handle;
if (!device)
return -EINVAL;
battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL);
......@@ -1080,8 +1072,7 @@ static int acpi_battery_add(struct acpi_device *device)
device->driver_data = battery;
mutex_init(&battery->lock);
mutex_init(&battery->sysfs_lock);
if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle,
"_BIX", &handle)))
if (acpi_has_method(battery->device->handle, "_BIX"))
set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);
result = acpi_battery_update(battery);
if (result)
......
......@@ -499,19 +499,6 @@ static void acpi_bus_check_scope(acpi_handle handle)
*/
}
static BLOCKING_NOTIFIER_HEAD(acpi_bus_notify_list);
int register_acpi_bus_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&acpi_bus_notify_list, nb);
}
EXPORT_SYMBOL_GPL(register_acpi_bus_notifier);
void unregister_acpi_bus_notifier(struct notifier_block *nb)
{
blocking_notifier_chain_unregister(&acpi_bus_notify_list, nb);
}
EXPORT_SYMBOL_GPL(unregister_acpi_bus_notifier);
/**
* acpi_bus_notify
* ---------------
......@@ -525,9 +512,6 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notification %#02x to handle %p\n",
type, handle));
blocking_notifier_call_chain(&acpi_bus_notify_list,
type, (void *)handle);
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
......@@ -593,8 +577,6 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
static int __init acpi_bus_init_irq(void)
{
acpi_status status;
union acpi_object arg = { ACPI_TYPE_INTEGER };
struct acpi_object_list arg_list = { 1, &arg };
char *message = NULL;
......@@ -623,9 +605,7 @@ static int __init acpi_bus_init_irq(void)
printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message);
arg.integer.value = acpi_irq_model;
status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL);
status = acpi_execute_simple_method(NULL, "\\_PIC", acpi_irq_model);
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC"));
return -ENODEV;
......
This diff is collapsed.
......@@ -1049,10 +1049,8 @@ int __init acpi_ec_ecdt_probe(void)
* which needs it, has fake EC._INI method, so use it as flag.
* Keep boot_ec struct as it will be needed soon.
*/
acpi_handle dummy;
if (!dmi_name_in_vendors("ASUS") ||
ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI",
&dummy)))
!acpi_has_method(boot_ec->handle, "_INI"))
return -ENODEV;
}
install:
......
......@@ -637,9 +637,7 @@ int acpi_device_sleep_wake(struct acpi_device *dev,
}
/* Execute _PSW */
arg_list.count = 1;
in_arg[0].integer.value = enable;
status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL);
status = acpi_execute_simple_method(dev->handle, "_PSW", enable);
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
printk(KERN_ERR PREFIX "_PSW execution failed\n");
dev->wakeup.flags.valid = 0;
......
......@@ -164,17 +164,12 @@ static void acpi_processor_ppc_ost(acpi_handle handle, int status)
{.type = ACPI_TYPE_INTEGER,},
};
struct acpi_object_list arg_list = {2, params};
acpi_handle temp;
if (acpi_has_method(handle, "_OST")) {
params[0].integer.value = ACPI_PROCESSOR_NOTIFY_PERFORMANCE;
params[1].integer.value = status;
/* when there is no _OST , skip it */
if (ACPI_FAILURE(acpi_get_handle(handle, "_OST", &temp)))
return;
acpi_evaluate_object(handle, "_OST", &arg_list, NULL);
return;
}
}
int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag)
......@@ -468,14 +463,11 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
int acpi_processor_get_performance_info(struct acpi_processor *pr)
{
int result = 0;
acpi_status status = AE_OK;
acpi_handle handle = NULL;
if (!pr || !pr->performance || !pr->handle)
return -EINVAL;
status = acpi_get_handle(pr->handle, "_PCT", &handle);
if (ACPI_FAILURE(status)) {
if (!acpi_has_method(pr->handle, "_PCT")) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"ACPI-based processor performance control unavailable\n"));
return -ENODEV;
......@@ -501,7 +493,7 @@ int acpi_processor_get_performance_info(struct acpi_processor *pr)
*/
update_bios:
#ifdef CONFIG_X86
if (ACPI_SUCCESS(acpi_get_handle(pr->handle, "_PPC", &handle))){
if (acpi_has_method(pr->handle, "_PPC")) {
if(boot_cpu_has(X86_FEATURE_EST))
printk(KERN_WARNING FW_BUG "BIOS needs update for CPU "
"frequency support\n");
......
......@@ -505,14 +505,12 @@ int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list,
void *preproc_data)
{
struct res_proc_context c;
acpi_handle not_used;
acpi_status status;
if (!adev || !adev->handle || !list_empty(list))
return -EINVAL;
status = acpi_get_handle(adev->handle, METHOD_NAME__CRS, &not_used);
if (ACPI_FAILURE(status))
if (!acpi_has_method(adev->handle, METHOD_NAME__CRS))
return 0;
c.list = list;
......
This diff is collapsed.
......@@ -31,12 +31,9 @@ static u8 sleep_states[ACPI_S_STATE_COUNT];
static void acpi_sleep_tts_switch(u32 acpi_state)
{
union acpi_object in_arg = { ACPI_TYPE_INTEGER };
struct acpi_object_list arg_list = { 1, &in_arg };
acpi_status status = AE_OK;
acpi_status status;
in_arg.integer.value = acpi_state;
status = acpi_evaluate_object(NULL, "\\_TTS", &arg_list, NULL);
status = acpi_execute_simple_method(NULL, "\\_TTS", acpi_state);
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
/*
* OS can't evaluate the _TTS object correctly. Some warning
......
......@@ -239,26 +239,16 @@ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
{
acpi_status status = AE_OK;
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list arg_list = { 1, &arg0 };
acpi_handle handle = NULL;
if (!tz)
return -EINVAL;
status = acpi_get_handle(tz->device->handle, "_SCP", &handle);
if (ACPI_FAILURE(status)) {
if (!acpi_has_method(tz->device->handle, "_SCP")) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n"));
return -ENODEV;
}
arg0.integer.value = mode;
status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
if (ACPI_FAILURE(status))
} else if (ACPI_FAILURE(acpi_execute_simple_method(tz->device->handle,
"_SCP", mode))) {
return -ENODEV;
}
return 0;
}
......
......@@ -495,3 +495,73 @@ acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...)
kfree(buffer.pointer);
}
EXPORT_SYMBOL(acpi_handle_printk);
/**
* acpi_has_method: Check whether @handle has a method named @name
* @handle: ACPI device handle
* @name: name of object or method
*
* Check whether @handle has a method named @name.
*/
bool acpi_has_method(acpi_handle handle, char *name)
{
acpi_handle tmp;
return ACPI_SUCCESS(acpi_get_handle(handle, name, &tmp));
}
EXPORT_SYMBOL(acpi_has_method);
acpi_status acpi_execute_simple_method(acpi_handle handle, char *method,
u64 arg)
{
union acpi_object obj = { .type = ACPI_TYPE_INTEGER };
struct acpi_object_list arg_list = { .count = 1, .pointer = &obj, };
obj.integer.value = arg;
return acpi_evaluate_object(handle, method, &arg_list, NULL);
}
EXPORT_SYMBOL(acpi_execute_simple_method);
/**
* acpi_evaluate_ej0: Evaluate _EJ0 method for hotplug operations
* @handle: ACPI device handle
*
* Evaluate device's _EJ0 method for hotplug operations.
*/
acpi_status acpi_evaluate_ej0(acpi_handle handle)
{
acpi_status status;
status = acpi_execute_simple_method(handle, "_EJ0", 1);
if (status == AE_NOT_FOUND)
acpi_handle_warn(handle, "No _EJ0 support for device\n");
else if (ACPI_FAILURE(status))
acpi_handle_warn(handle, "Eject failed (0x%x)\n", status);
return status;
}
/**
* acpi_evaluate_lck: Evaluate _LCK method to lock/unlock device
* @handle: ACPI device handle
* @lock: lock device if non-zero, otherwise unlock device
*
* Evaluate device's _LCK method if present to lock/unlock device
*/
acpi_status acpi_evaluate_lck(acpi_handle handle, int lock)
{
acpi_status status;
status = acpi_execute_simple_method(handle, "_LCK", !!lock);
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
if (lock)
acpi_handle_warn(handle,
"Locking device failed (0x%x)\n", status);
else
acpi_handle_warn(handle,
"Unlocking device failed (0x%x)\n", status);
}
return status;
}
......@@ -355,14 +355,10 @@ static int
acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
{
int status;
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list args = { 1, &arg0 };
int state;
arg0.integer.value = level;
status = acpi_evaluate_object(device->dev->handle, "_BCM",
&args, NULL);
status = acpi_execute_simple_method(device->dev->handle,
"_BCM", level);
if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "Evaluating _BCM failed"));
return -EIO;
......@@ -638,18 +634,15 @@ static int
acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
{
acpi_status status;
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list args = { 1, &arg0 };
if (!video->cap._DOS)
return 0;
if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1)
return -EINVAL;
arg0.integer.value = (lcd_flag << 2) | bios_flag;
video->dos_setting = arg0.integer.value;
status = acpi_evaluate_object(video->device->handle, "_DOS",
&args, NULL);
video->dos_setting = (lcd_flag << 2) | bios_flag;
status = acpi_execute_simple_method(video->device->handle, "_DOS",
(lcd_flag << 2) | bios_flag);
if (ACPI_FAILURE(status))
return -EIO;
......@@ -885,28 +878,21 @@ acpi_video_init_brightness(struct acpi_video_device *device)
static void acpi_video_device_find_cap(struct acpi_video_device *device)
{
acpi_handle h_dummy1;
if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) {
if (acpi_has_method(device->dev->handle, "_ADR"))
device->cap._ADR = 1;
}
if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) {
if (acpi_has_method(device->dev->handle, "_BCL"))
device->cap._BCL = 1;
}
if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) {
if (acpi_has_method(device->dev->handle, "_BCM"))
device->cap._BCM = 1;
}
if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle,"_BQC",&h_dummy1)))
if (acpi_has_method(device->dev->handle, "_BQC")) {
device->cap._BQC = 1;
else if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCQ",
&h_dummy1))) {
} else if (acpi_has_method(device->dev->handle, "_BCQ")) {
printk(KERN_WARNING FW_BUG "_BCQ is used instead of _BQC\n");
device->cap._BCQ = 1;
}
if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) {
if (acpi_has_method(device->dev->handle, "_DDC"))
device->cap._DDC = 1;
}
if (acpi_video_backlight_support()) {
struct backlight_properties props;
......@@ -994,26 +980,18 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
{
acpi_handle h_dummy1;
if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) {
if (acpi_has_method(video->device->handle, "_DOS"))
video->cap._DOS = 1;
}
if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) {
if (acpi_has_method(video->device->handle, "_DOD"))
video->cap._DOD = 1;
}
if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) {
if (acpi_has_method(video->device->handle, "_ROM"))
video->cap._ROM = 1;
}
if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) {
if (acpi_has_method(video->device->handle, "_GPD"))
video->cap._GPD = 1;
}
if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) {
if (acpi_has_method(video->device->handle, "_SPD"))
video->cap._SPD = 1;
}
if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) {
if (acpi_has_method(video->device->handle, "_VPO"))
video->cap._VPO = 1;
}
}
/*
......
......@@ -53,14 +53,13 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
void **retyurn_value)
{
long *cap = context;
acpi_handle h_dummy;
if (ACPI_SUCCESS(acpi_get_handle(handle, "_BCM", &h_dummy)) &&
ACPI_SUCCESS(acpi_get_handle(handle, "_BCL", &h_dummy))) {
if (acpi_has_method(handle, "_BCM") &&
acpi_has_method(handle, "_BCL")) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight "
"support\n"));
*cap |= ACPI_VIDEO_BACKLIGHT;
if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy)))
if (!acpi_has_method(handle, "_BQC"))
printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, "
"cannot determine initial brightness\n");
/* We have backlight support, no need to scan further */
......@@ -79,22 +78,20 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
*/
long acpi_is_video_device(acpi_handle handle)
{
acpi_handle h_dummy;
long video_caps = 0;
/* Is this device able to support video switching ? */
if (ACPI_SUCCESS(acpi_get_handle(handle, "_DOD", &h_dummy)) ||
ACPI_SUCCESS(acpi_get_handle(handle, "_DOS", &h_dummy)))
if (acpi_has_method(handle, "_DOD") || acpi_has_method(handle, "_DOS"))
video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
/* Is this device able to retrieve a video ROM ? */
if (ACPI_SUCCESS(acpi_get_handle(handle, "_ROM", &h_dummy)))
if (acpi_has_method(handle, "_ROM"))
video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
/* Is this device able to configure which video head to be POSTed ? */
if (ACPI_SUCCESS(acpi_get_handle(handle, "_VPO", &h_dummy)) &&
ACPI_SUCCESS(acpi_get_handle(handle, "_GPD", &h_dummy)) &&
ACPI_SUCCESS(acpi_get_handle(handle, "_SPD", &h_dummy)))
if (acpi_has_method(handle, "_VPO") &&
acpi_has_method(handle, "_GPD") &&
acpi_has_method(handle, "_SPD"))
video_caps |= ACPI_VIDEO_DEVICE_POSTING;
/* Only check for backlight functionality if one of the above hit. */
......
......@@ -122,7 +122,6 @@ struct acpiphp_func {
struct acpiphp_slot *slot; /* parent */
struct list_head sibling;
struct notifier_block nb;
acpi_handle handle;
u8 function; /* pci function# */
......
......@@ -119,15 +119,14 @@ static void free_bridge(struct kref *kref)
* TBD - figure out a way to only call fixups for
* systems that require them.
*/
static int post_dock_fixups(struct notifier_block *nb, unsigned long val,
void *v)
static void post_dock_fixups(acpi_handle not_used, u32 event, void *data)
{
struct acpiphp_func *func = container_of(nb, struct acpiphp_func, nb);
struct acpiphp_func *func = data;
struct pci_bus *bus = func->slot->bridge->pci_bus;
u32 buses;
if (!bus->self)
return NOTIFY_OK;
return;
/* fixup bad _DCK function that rewrites
* secondary bridge on slot
......@@ -143,11 +142,11 @@ static int post_dock_fixups(struct notifier_block *nb, unsigned long val,
| ((unsigned int)(bus->busn_res.end) << 16);
pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses);
}
return NOTIFY_OK;
}
static const struct acpi_dock_ops acpiphp_dock_ops = {
.fixup = post_dock_fixups,
.handler = hotplug_event_func,
};
......@@ -201,7 +200,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
struct acpiphp_bridge *bridge = (struct acpiphp_bridge *)context;
struct acpiphp_slot *slot;
struct acpiphp_func *newfunc;
acpi_handle tmp;
acpi_status status = AE_OK;
unsigned long long adr, sun;
int device, function, retval, found = 0;
......@@ -232,19 +230,19 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
newfunc->handle = handle;
newfunc->function = function;
if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp)))
if (acpi_has_method(handle, "_EJ0"))
newfunc->flags = FUNC_HAS_EJ0;
if (ACPI_SUCCESS(acpi_get_handle(handle, "_STA", &tmp)))
if (acpi_has_method(handle, "_STA"))
newfunc->flags |= FUNC_HAS_STA;
if (ACPI_SUCCESS(acpi_get_handle(handle, "_PS0", &tmp)))
if (acpi_has_method(handle, "_PS0"))
newfunc->flags |= FUNC_HAS_PS0;
if (ACPI_SUCCESS(acpi_get_handle(handle, "_PS3", &tmp)))
if (acpi_has_method(handle, "_PS3"))
newfunc->flags |= FUNC_HAS_PS3;
if (ACPI_SUCCESS(acpi_get_handle(handle, "_DCK", &tmp)))
if (acpi_has_method(handle, "_DCK"))
newfunc->flags |= FUNC_HAS_DCK;
status = acpi_evaluate_integer(handle, "_SUN", NULL, &sun);
......@@ -316,14 +314,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
&acpiphp_dock_ops, newfunc,
acpiphp_dock_init, acpiphp_dock_release))
dbg("failed to register dock device\n");
/* we need to be notified when dock events happen
* outside of the hotplug operation, since we may
* need to do fixups before we can hotplug.
*/
newfunc->nb.notifier_call = post_dock_fixups;
if (register_dock_notifier(&newfunc->nb))
dbg("failed to register a dock notifier");
}
/* install notify handler */
......@@ -473,7 +463,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
list_for_each_entry(func, &slot->funcs, sibling) {
if (is_dock_device(func->handle)) {
unregister_hotplug_dock_device(func->handle);
unregister_dock_notifier(&func->nb);
}
if (!(func->flags & FUNC_HAS_DCK)) {
status = acpi_remove_notify_handler(func->handle,
......@@ -843,25 +832,14 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
*/
int acpiphp_eject_slot(struct acpiphp_slot *slot)
{
acpi_status status;
struct acpiphp_func *func;
struct acpi_object_list arg_list;
union acpi_object arg;
list_for_each_entry(func, &slot->funcs, sibling) {
/* We don't want to call _EJ0 on non-existing functions. */
if ((func->flags & FUNC_HAS_EJ0)) {
/* _EJ0 method take one argument */
arg_list.count = 1;
arg_list.pointer = &arg;
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = 1;
status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL);
if (ACPI_FAILURE(status)) {
warn("%s: _EJ0 failed\n", __func__);
if (ACPI_FAILURE(acpi_evaluate_ej0(func->handle)))
return -1;
} else
else
break;
}
}
......@@ -1171,7 +1149,6 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type,
*/
void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle)
{
acpi_handle dummy_handle;
struct acpiphp_bridge *bridge;
if (acpiphp_disabled)
......@@ -1200,8 +1177,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle)
get_device(&bus->dev);
if (!pci_is_root_bus(bridge->pci_bus) &&
ACPI_SUCCESS(acpi_get_handle(bridge->handle,
"_EJ0", &dummy_handle))) {
acpi_has_method(bridge->handle, "_EJ0")) {
dbg("found ejectable p2p bridge\n");
bridge->flags |= BRIDGE_HAS_EJ0;
bridge->func = acpiphp_bridge_handle_to_function(handle);
......
......@@ -56,6 +56,16 @@ acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
acpi_status
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
bool acpi_has_method(acpi_handle handle, char *name);
acpi_status acpi_execute_simple_method(acpi_handle handle, char *method,
u64 arg);
acpi_status acpi_evaluate_ej0(acpi_handle handle);
acpi_status acpi_evaluate_lck(acpi_handle handle, int lock);
bool acpi_ata_match(acpi_handle handle);
bool acpi_bay_match(acpi_handle handle);
bool acpi_dock_match(acpi_handle handle);
#ifdef CONFIG_ACPI
#include <linux/proc_fs.h>
......@@ -352,8 +362,6 @@ extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
extern int register_acpi_notifier(struct notifier_block *);
extern int unregister_acpi_notifier(struct notifier_block *);
extern int register_acpi_bus_notifier(struct notifier_block *nb);
extern void unregister_acpi_bus_notifier(struct notifier_block *nb);
/*
* External Functions
*/
......
......@@ -113,14 +113,13 @@ void pci_acpi_crs_quirks(void);
Dock Station
-------------------------------------------------------------------------- */
struct acpi_dock_ops {
acpi_notify_handler fixup;
acpi_notify_handler handler;
acpi_notify_handler uevent;
};
#if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE)
#ifdef CONFIG_ACPI_DOCK
extern int is_dock_device(acpi_handle handle);
extern int register_dock_notifier(struct notifier_block *nb);
extern void unregister_dock_notifier(struct notifier_block *nb);
extern int register_hotplug_dock_device(acpi_handle handle,
const struct acpi_dock_ops *ops,
void *context,
......@@ -132,13 +131,6 @@ static inline int is_dock_device(acpi_handle handle)
{
return 0;
}
static inline int register_dock_notifier(struct notifier_block *nb)
{
return -ENODEV;
}
static inline void unregister_dock_notifier(struct notifier_block *nb)
{
}
static inline int register_hotplug_dock_device(acpi_handle handle,
const struct acpi_dock_ops *ops,
void *context,
......@@ -150,6 +142,6 @@ static inline int register_hotplug_dock_device(acpi_handle handle,
static inline void unregister_hotplug_dock_device(acpi_handle handle)
{
}
#endif
#endif /* CONFIG_ACPI_DOCK */
#endif /*__ACPI_DRIVERS_H__*/
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