lkml.org 
[lkml]   [2015]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/6] ACPI / EC: Cleanup _Qxx evaluation work item.
Date
The _Qxx evaluation work item can be eliminated and _Qxx can be evaluated
right in the same work item as the QR_EC transaction. This patch cleans up
the code to achieve this.

Originally, QR_EC transaction and _Qxx evaluation were all done in the same
work queue flushed by acpi_os_wait_events_complete(). Though the QR_EC
transaction (previous commit) and _Qxx evaluation (this commmit) are now
moved to the work queue that is not covered by
acpi_os_wait_events_complete(), there is no issue can be seen in the
suspend/resume tests.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
drivers/acpi/ec.c | 35 ++++++++++++-----------------------
1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 0ce8b6e8..b956dbc 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -904,27 +904,12 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
}
EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler);

-static void acpi_ec_run(void *cxt)
-{
- struct acpi_ec_query_handler *handler = cxt;
-
- if (!handler)
- return;
- ec_dbg_evt("Query(0x%02x) started", handler->query_bit);
- if (handler->func)
- handler->func(handler->data);
- else if (handler->handle)
- acpi_evaluate_object(handler->handle, NULL, NULL, NULL);
- ec_dbg_evt("Query(0x%02x) stopped", handler->query_bit);
- acpi_ec_put_query_handler(handler);
-}
-
static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
{
u8 value = 0;
int result;
- acpi_status status;
struct acpi_ec_query_handler *handler;
+ bool handler_found = false;
struct transaction t = {.command = ACPI_EC_COMMAND_QUERY,
.wdata = NULL, .rdata = &value,
.wlen = 0, .rlen = 1};
@@ -947,17 +932,21 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
if (value == handler->query_bit) {
/* have custom handler for this bit */
handler = acpi_ec_get_query_handler(handler);
- ec_dbg_evt("Query(0x%02x) scheduled",
- handler->query_bit);
- status = acpi_os_execute((handler->func) ?
- OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER,
- acpi_ec_run, handler);
- if (ACPI_FAILURE(status))
- result = -EBUSY;
+ handler_found = true;
break;
}
}
mutex_unlock(&ec->mutex);
+
+ if (handler_found) {
+ ec_dbg_evt("Query(0x%02x) started", handler->query_bit);
+ if (handler->func)
+ handler->func(handler->data);
+ else if (handler->handle)
+ acpi_evaluate_object(handler->handle, NULL, NULL, NULL);
+ ec_dbg_evt("Query(0x%02x) stopped", handler->query_bit);
+ acpi_ec_put_query_handler(handler);
+ }
return result;
}

--
1.7.10


\
 
 \ /
  Last update: 2015-06-08 07:41    [W:1.699 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site