Skip to content

Commit

Permalink
ACPI / EC: Fix returning values in acpi_ec_sync_query()
Browse files Browse the repository at this point in the history
The returning value of acpi_os_execute() is erroneously handled as errno.
This patch corrects it by returning EBUSY to indicate the work queue item
creation failure.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Lv Zheng authored and Rafael J. Wysocki committed Jan 23, 2015
1 parent 01305d4 commit c2cf576
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,27 +660,31 @@ static void acpi_ec_run(void *cxt)
static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data)
{
u8 value = 0;
int status;
int result;
acpi_status status;
struct acpi_ec_query_handler *handler;

status = acpi_ec_query_unlocked(ec, &value);
result = acpi_ec_query_unlocked(ec, &value);
if (data)
*data = value;
if (status)
return status;
if (result)
return result;

list_for_each_entry(handler, &ec->list, node) {
if (value == handler->query_bit) {
/* have custom handler for this bit */
handler = acpi_ec_get_query_handler(handler);
pr_debug("##### Query(0x%02x) scheduled #####\n",
handler->query_bit);
return acpi_os_execute((handler->func) ?
status = acpi_os_execute((handler->func) ?
OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER,
acpi_ec_run, handler);
if (ACPI_FAILURE(status))
result = -EBUSY;
break;
}
}
return 0;
return result;
}

static void acpi_ec_gpe_query(void *ec_cxt)
Expand Down

0 comments on commit c2cf576

Please sign in to comment.