public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Starikovskiy <astarikovskiy@suse.de>
To: LenBrown <lenb@kernel.org>
Cc: Linux-acpi@vger.kernel.org
Subject: [PATCH] ACPI: EC: Check for IBF=0 periodically if not in GPE mode
Date: Thu, 16 Oct 2008 02:02:33 +0400	[thread overview]
Message-ID: <20081015220232.32042.36999.stgit@thinkpad> (raw)
In-Reply-To: <48F379C4.9070105@tuffmail.co.uk>

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---

 drivers/acpi/ec.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)


diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 69f5f78..f9c0782 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -300,6 +300,18 @@ static int ec_check_ibf0(struct acpi_ec *ec)
 	return (status & ACPI_EC_FLAG_IBF) == 0;
 }
 
+static int ec_wait_ibf0(struct acpi_ec *ec)
+{
+	unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
+	/* interrupt wait manually if GPE mode is not active */
+	unsigned long timeout = test_bit(EC_FLAGS_GPE_MODE, &ec->flags) ?
+		msecs_to_jiffies(ACPI_EC_DELAY) : msecs_to_jiffies(1);
+	while (time_before(jiffies, delay))
+		if (wait_event_timeout(ec->wait, ec_check_ibf0(ec), timeout))
+			return 0;
+	return -ETIME;
+}
+
 static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t,
 			       int force_poll)
 {
@@ -317,8 +329,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t,
 			goto unlock;
 		}
 	}
-	if (!wait_event_timeout(ec->wait, ec_check_ibf0(ec),
-				msecs_to_jiffies(ACPI_EC_DELAY))) {
+	if (ec_wait_ibf0(ec)) {
 		pr_err(PREFIX "input buffer is not empty, "
 				"aborting transaction\n");
 		status = -ETIME;


  reply	other threads:[~2008-10-15 22:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-11 16:57 acpi-test tree on eeepc: EC error message on second resume Alan Jenkins
2008-10-11 17:09 ` Rafael J. Wysocki
2008-10-11 17:12   ` Alan Jenkins
2008-10-11 17:53     ` Rafael J. Wysocki
2008-10-11 18:15       ` Alan Jenkins
2008-10-11 18:39         ` Alexey Starikovskiy
2008-10-11 19:30           ` Rafael J. Wysocki
2008-10-11 19:31             ` Alexey Starikovskiy
2008-10-11 19:40               ` Rafael J. Wysocki
2008-10-11 19:38                 ` Alexey Starikovskiy
2008-10-11 20:54                   ` Rafael J. Wysocki
2008-10-12  9:13                     ` Alan Jenkins
2008-10-12 19:23                       ` Alexey Starikovskiy
2008-10-13  5:56                         ` Zhao Yakui
2008-10-13  8:22                         ` Alan Jenkins
2008-10-13 16:39                           ` Alan Jenkins
2008-10-15 22:02                             ` Alexey Starikovskiy [this message]
2008-10-16 22:14                               ` [PATCH] ACPI: EC: Check for IBF=0 periodically if not in GPE mode Len Brown

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=20081015220232.32042.36999.stgit@thinkpad \
    --to=astarikovskiy@suse.de \
    --cc=Linux-acpi@vger.kernel.org \
    --cc=lenb@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