===================================================================
@@ -186,8 +186,7 @@ void acpiphp_unregister_hotplug_slot(str
typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
int acpiphp_enable_slot(struct acpiphp_slot *slot);
-int acpiphp_disable_slot(struct acpiphp_slot *slot);
-int acpiphp_eject_slot(struct acpiphp_slot *slot);
+int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot);
u8 acpiphp_get_power_status(struct acpiphp_slot *slot);
u8 acpiphp_get_attention_status(struct acpiphp_slot *slot);
u8 acpiphp_get_latch_status(struct acpiphp_slot *slot);
===================================================================
@@ -155,15 +155,11 @@ static int enable_slot(struct hotplug_sl
static int disable_slot(struct hotplug_slot *hotplug_slot)
{
struct slot *slot = hotplug_slot->private;
- int retval;
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
/* disable the specified slot */
- retval = acpiphp_disable_slot(slot->acpi_slot);
- if (!retval)
- retval = acpiphp_eject_slot(slot->acpi_slot);
- return retval;
+ return acpiphp_disable_and_eject_slot(slot->acpi_slot);
}
===================================================================
@@ -777,38 +777,6 @@ static unsigned int get_slot_status(stru
}
/**
- * acpiphp_eject_slot - physically eject the slot
- * @slot: ACPI PHP 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_to_handle(func),
- "_EJ0", &arg_list, NULL);
- if (ACPI_FAILURE(status)) {
- warn("%s: _EJ0 failed\n", __func__);
- return -1;
- } else
- break;
- }
- }
- return 0;
-}
-
-/**
* acpiphp_check_bridge - re-enumerate devices
* @bridge: where to begin re-enumeration
*
@@ -828,13 +796,11 @@ static int acpiphp_check_bridge(struct a
if (slot->flags & SLOT_ENABLED) {
if (status == ACPI_STA_ALL)
continue;
- retval = acpiphp_disable_slot(slot);
- if (retval) {
- err("Error occurred in disabling\n");
+
+ retval = acpiphp_disable_and_eject_slot(slot);
+ if (retval)
goto err_exit;
- } else {
- acpiphp_eject_slot(slot);
- }
+
disabled++;
} else {
if (status != ACPI_STA_ALL)
@@ -974,9 +940,7 @@ static void hotplug_event(acpi_handle ha
case ACPI_NOTIFY_EJECT_REQUEST:
/* request device eject */
dbg("%s: Device eject notify on %s\n", __func__, objname);
- if (!(acpiphp_disable_slot(func->slot)))
- acpiphp_eject_slot(func->slot);
-
+ acpiphp_disable_and_eject_slot(func->slot);
break;
case ACPI_NOTIFY_FREQUENCY_MISMATCH:
@@ -1171,11 +1135,14 @@ int acpiphp_enable_slot(struct acpiphp_s
}
/**
- * acpiphp_disable_slot - power off slot
+ * acpiphp_disable_and_eject_slot - power off and eject slot
* @slot: ACPI PHP slot
*/
-int acpiphp_disable_slot(struct acpiphp_slot *slot)
+int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot)
{
+ struct acpiphp_func *func;
+ struct acpi_object_list arg_list;
+ union acpi_object arg;
int retval = 0;
mutex_lock(&slot->crit_sect);
@@ -1190,6 +1157,27 @@ int acpiphp_disable_slot(struct acpiphp_
if (retval)
goto err_exit;
+ 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) {
+ acpi_handle handle = func_to_handle(func);
+ acpi_status status;
+
+ /* _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(handle, "_EJ0", &arg_list,
+ NULL);
+ if (ACPI_FAILURE(status))
+ acpi_handle_err(handle, "_EJ0 failed\n");
+
+ break;
+ }
+ }
+
err_exit:
mutex_unlock(&slot->crit_sect);
return retval;