diff options
author | Alexey Starikovskiy <astarikovskiy@suse.de> | 2008-10-16 02:02:33 +0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-10-16 18:14:07 -0400 |
commit | c0ff17720ec5f42205b3d2ca03a18da0a8272976 (patch) | |
tree | 3cbe691631cef08ab38ffe61ea442d49ebc013d3 /drivers/acpi | |
parent | 455c8793d2c49eaecad038c8de83dade9fc3759f (diff) | |
download | kernel_goldelico_gta04-c0ff17720ec5f42205b3d2ca03a18da0a8272976.zip kernel_goldelico_gta04-c0ff17720ec5f42205b3d2ca03a18da0a8272976.tar.gz kernel_goldelico_gta04-c0ff17720ec5f42205b3d2ca03a18da0a8272976.tar.bz2 |
ACPI: EC: Check for IBF=0 periodically if not in GPE mode
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Tested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | 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 453ba1e..444cd9e 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -298,6 +298,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) { @@ -315,8 +327,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; |