From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757839AbaGODPW (ORCPT ); Mon, 14 Jul 2014 23:15:22 -0400 Received: from mga01.intel.com ([192.55.52.88]:37903 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757802AbaGODPS (ORCPT ); Mon, 14 Jul 2014 23:15:18 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,662,1400050800"; d="scan'208";a="561822846" From: Lv Zheng To: "Rafael J. Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , , linux-acpi@vger.kernel.org Subject: [PATCH v2 06/10] ACPI/EC: Add a warning message to indicate event storms. Date: Tue, 15 Jul 2014 11:15:00 +0800 Message-Id: X-Mailer: git-send-email 1.7.10 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, &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