aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi Kani <toshi.kani@hp.com>2013-03-13 15:29:26 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-03-24 19:18:43 -0400
commit882fd12e641b612bcf31620f9b1b7bb03f8e9ab5 (patch)
treee9814f8c21c4f07a7a028c6c872c5fefc4d0d9ef
parentea6a4581ce11bd1a5dca421c01b11d1ff2867c2f (diff)
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: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/scan.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index dfdbcfdd9def..8cacc16af6e7 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -127,6 +127,7 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
127 struct acpi_object_list arg_list; 127 struct acpi_object_list arg_list;
128 union acpi_object arg; 128 union acpi_object arg;
129 acpi_status status; 129 acpi_status status;
130 unsigned long long sta;
130 131
131 /* If there is no handle, the device node has been unregistered. */ 132 /* If there is no handle, the device node has been unregistered. */
132 if (!handle) { 133 if (!handle) {
@@ -164,10 +165,25 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
164 if (status == AE_NOT_FOUND) { 165 if (status == AE_NOT_FOUND) {
165 return -ENODEV; 166 return -ENODEV;
166 } else { 167 } else {
167 acpi_handle_warn(handle, "Eject failed\n"); 168 acpi_handle_warn(handle, "Eject failed (0x%x)\n",
169 status);
168 return -EIO; 170 return -EIO;
169 } 171 }
170 } 172 }
173
174 /*
175 * Verify if eject was indeed successful. If not, log an error
176 * message. No need to call _OST since _EJ0 call was made OK.
177 */
178 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
179 if (ACPI_FAILURE(status)) {
180 acpi_handle_warn(handle,
181 "Status check after eject failed (0x%x)\n", status);
182 } else if (sta & ACPI_STA_DEVICE_ENABLED) {
183 acpi_handle_warn(handle,
184 "Eject incomplete - status 0x%llx\n", sta);
185 }
186
171 return 0; 187 return 0;
172} 188}
173 189