提交 882fd12e 编写于 作者: T Toshi Kani 提交者: Rafael J. Wysocki

ACPI: Verify device status after eject

ACPI spec states that the OS evaluates _STA after calling _EJ0
in order to verify if eject was successful.  Added a check to
verify if the enabled bit of the status value is cleared after
_EJ0.

Note, the present bit is not checked since some FW implementations
do not clear the present bit until the hardware is physically
removed.
Signed-off-by: NToshi Kani <toshi.kani@hp.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 ea6a4581
...@@ -127,6 +127,7 @@ static int acpi_scan_hot_remove(struct acpi_device *device) ...@@ -127,6 +127,7 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
struct acpi_object_list arg_list; struct acpi_object_list arg_list;
union acpi_object arg; union acpi_object arg;
acpi_status status; acpi_status status;
unsigned long long sta;
/* If there is no handle, the device node has been unregistered. */ /* If there is no handle, the device node has been unregistered. */
if (!handle) { if (!handle) {
...@@ -164,10 +165,25 @@ static int acpi_scan_hot_remove(struct acpi_device *device) ...@@ -164,10 +165,25 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
return -ENODEV; return -ENODEV;
} else { } else {
acpi_handle_warn(handle, "Eject failed\n"); acpi_handle_warn(handle, "Eject failed (0x%x)\n",
status);
return -EIO; return -EIO;
} }
} }
/*
* Verify if eject was indeed successful. If not, log an error
* message. No need to call _OST since _EJ0 call was made OK.
*/
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status)) {
acpi_handle_warn(handle,
"Status check after eject failed (0x%x)\n", status);
} else if (sta & ACPI_STA_DEVICE_ENABLED) {
acpi_handle_warn(handle,
"Eject incomplete - status 0x%llx\n", sta);
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册