[PATCH v2 06/10] ACPI/EC: Add a warning message to indicate event storms.

2014-07-14 Thread Lv Zheng
This patch splits query handler scheduling into a new seperate function
acpi_ec_notify_query_handlers() and adds a warning message in it to
indicate a BIOS bug. It is reported that EC event storm can happen in case
there is no handler prepared for the event. No functional changes.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=78091
Reported-by: Steffen Weber 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/ec.c |   29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index cf83872..8817836 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -669,32 +669,39 @@ static void acpi_ec_run(void *cxt)
acpi_ec_put_query_handler(handler);
 }
 
-static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data)
+static int acpi_ec_notify_query_handlers(struct acpi_ec *ec, u8 query_bit)
 {
-   u8 value = 0;
-   int status;
struct acpi_ec_query_handler *handler;
 
-   status = acpi_ec_query_unlocked(ec, );
-   if (data)
-   *data = value;
-   if (status)
-   return status;
-
list_for_each_entry(handler, >list, node) {
-   if (value == handler->query_bit) {
+   if (query_bit == handler->query_bit) {
/* have custom handler for this bit */
handler = acpi_ec_get_query_handler(handler);
pr_debug("push query execution (0x%2x) on queue\n",
-   value);
+query_bit);
return acpi_os_execute((handler->func) ?
OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER,
acpi_ec_run, handler);
}
}
+   pr_warn_once("BIOS bug: no handler for query (0x%02x)\n", query_bit);
return 0;
 }
 
+static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data)
+{
+   u8 value = 0;
+   int status;
+
+   status = acpi_ec_query_unlocked(ec, );
+   if (data)
+   *data = value;
+   if (status)
+   return status;
+
+   return acpi_ec_notify_query_handlers(ec, value);
+}
+
 static void acpi_ec_gpe_query(void *ec_cxt)
 {
struct acpi_ec *ec = ec_cxt;
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 06/10] ACPI/EC: Add a warning message to indicate event storms.

2014-07-14 Thread Lv Zheng
This patch splits query handler scheduling into a new seperate function
acpi_ec_notify_query_handlers() and adds a warning message in it to
indicate a BIOS bug. It is reported that EC event storm can happen in case
there is no handler prepared for the event. No functional changes.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=78091
Reported-by: Steffen Weber steffen.we...@gmail.com
Signed-off-by: Lv Zheng lv.zh...@intel.com
---
 drivers/acpi/ec.c |   29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index cf83872..8817836 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -669,32 +669,39 @@ static void acpi_ec_run(void *cxt)
acpi_ec_put_query_handler(handler);
 }
 
-static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data)
+static int acpi_ec_notify_query_handlers(struct acpi_ec *ec, u8 query_bit)
 {
-   u8 value = 0;
-   int status;
struct acpi_ec_query_handler *handler;
 
-   status = acpi_ec_query_unlocked(ec, value);
-   if (data)
-   *data = value;
-   if (status)
-   return status;
-
list_for_each_entry(handler, ec-list, node) {
-   if (value == handler-query_bit) {
+   if (query_bit == handler-query_bit) {
/* have custom handler for this bit */
handler = acpi_ec_get_query_handler(handler);
pr_debug(push query execution (0x%2x) on queue\n,
-   value);
+query_bit);
return acpi_os_execute((handler-func) ?
OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER,
acpi_ec_run, handler);
}
}
+   pr_warn_once(BIOS bug: no handler for query (0x%02x)\n, query_bit);
return 0;
 }
 
+static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data)
+{
+   u8 value = 0;
+   int status;
+
+   status = acpi_ec_query_unlocked(ec, value);
+   if (data)
+   *data = value;
+   if (status)
+   return status;
+
+   return acpi_ec_notify_query_handlers(ec, value);
+}
+
 static void acpi_ec_gpe_query(void *ec_cxt)
 {
struct acpi_ec *ec = ec_cxt;
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/