From: Toshi Kani <toshi.kani@hp.com>
To: rjw@sisk.pl
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
yinghai@kernel.org, jiang.liu@huawei.com,
isimatu.yasuaki@jp.fujitsu.com, Toshi Kani <toshi.kani@hp.com>
Subject: [PATCH] ACPI: Verify device status after eject
Date: Wed, 13 Mar 2013 13:29:26 -0600 [thread overview]
Message-ID: <1363202966-28436-1-git-send-email-toshi.kani@hp.com> (raw)
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>
---
This patch is based on linux-pm.git/bleeding-edge.
---
drivers/acpi/scan.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 4f2265e..31d1242 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)
struct acpi_object_list arg_list;
union acpi_object arg;
acpi_status status;
+ unsigned long long sta;
/* If there is no handle, the device node has been unregistered. */
if (!handle) {
@@ -164,10 +165,25 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
if (status == AE_NOT_FOUND) {
return -ENODEV;
} else {
- acpi_handle_warn(handle, "Eject failed\n");
+ acpi_handle_warn(handle, "Eject failed (0x%x)\n",
+ status);
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;
}
next reply other threads:[~2013-03-13 19:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-13 19:29 Toshi Kani [this message]
2013-03-26 13:28 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1363202966-28436-1-git-send-email-toshi.kani@hp.com \
--to=toshi.kani@hp.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=jiang.liu@huawei.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®