Subject: [PATCH] [acpi ec] Implement polling wait method - Set method pointer in ec_poll_init() - Based on acpi_ec_poll_wait() from old school driver (few changes) Signed-off-by: Patrick Mochel --- drivers/acpi/drivers/ec/poll.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) applies-to: bc0fe0419b8513fc0928f3ce8993f114be0ae728 11d9963b8db87c49ede809b82b81be46600eb128 diff --git a/drivers/acpi/drivers/ec/poll.c b/drivers/acpi/drivers/ec/poll.c index 0ecabcb..c7f49d3 100644 --- a/drivers/acpi/drivers/ec/poll.c +++ b/drivers/acpi/drivers/ec/poll.c @@ -14,7 +14,36 @@ #include "ec.h" +static int wait_poll(struct acpi_ec * ec, u32 event) +{ + u32 status; + u32 i = ACPI_EC_UDELAY_COUNT; + int ret = 0; + + /* + * Poll the EC status register waiting for the event to occur + */ + if (event == ACPI_EC_EVENT_OBF) { + do { + status = ec_read_status(ec); + if (status & ACPI_EC_FLAG_OBF) + goto Done; + } while (--i > 0); + } else if (event == ACPI_EC_EVENT_IBE) { + do { + status = ec_read_status(ec); + if (!(status & ACPI_EC_FLAG_IBF)) + goto Done; + } while (--i > 0); + } else + ret = -EINVAL; + ret = -ETIME; + Done: + return ret; +} + int ec_poll_init(struct acpi_ec * ec) { + ec->e_wait = wait_poll; return 0; } --- 0.99.9.GIT