ACPI: EC: Pass one argument to acpi_ec_query()
Notice that the second argument to acpi_ec_query() is redundant, because in the only case when it is not NULL, the value passed through it is only checked against 0 and it can only be 0 when acpi_ec_query() returns an error code, but its return value is checked along with the value passed through its second argument. Accordingly, modify acpi_ec_query() to take only one argument and while at it, change its handling of the case when acpi_ec_transaction() returns an error so as to return that error value to the caller right away. No expected functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
ca8283dcd9
commit
1f2350443d
@ -169,7 +169,7 @@ struct acpi_ec_query {
|
|||||||
struct acpi_ec *ec;
|
struct acpi_ec *ec;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int acpi_ec_query(struct acpi_ec *ec, u8 *data);
|
static int acpi_ec_query(struct acpi_ec *ec);
|
||||||
static bool advance_transaction(struct acpi_ec *ec, bool interrupt);
|
static bool advance_transaction(struct acpi_ec *ec, bool interrupt);
|
||||||
static void acpi_ec_event_handler(struct work_struct *work);
|
static void acpi_ec_event_handler(struct work_struct *work);
|
||||||
static void acpi_ec_event_processor(struct work_struct *work);
|
static void acpi_ec_event_processor(struct work_struct *work);
|
||||||
@ -496,12 +496,10 @@ static inline void __acpi_ec_disable_event(struct acpi_ec *ec)
|
|||||||
*/
|
*/
|
||||||
static void acpi_ec_clear(struct acpi_ec *ec)
|
static void acpi_ec_clear(struct acpi_ec *ec)
|
||||||
{
|
{
|
||||||
int i, status;
|
int i;
|
||||||
u8 value = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) {
|
for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) {
|
||||||
status = acpi_ec_query(ec, &value);
|
if (acpi_ec_query(ec))
|
||||||
if (status || !value)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (unlikely(i == ACPI_EC_CLEAR_MAX))
|
if (unlikely(i == ACPI_EC_CLEAR_MAX))
|
||||||
@ -1164,11 +1162,11 @@ static void acpi_ec_event_processor(struct work_struct *work)
|
|||||||
acpi_ec_delete_query(q);
|
acpi_ec_delete_query(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
|
static int acpi_ec_query(struct acpi_ec *ec)
|
||||||
{
|
{
|
||||||
|
struct acpi_ec_query *q;
|
||||||
u8 value = 0;
|
u8 value = 0;
|
||||||
int result;
|
int result;
|
||||||
struct acpi_ec_query *q;
|
|
||||||
|
|
||||||
q = acpi_ec_create_query(ec, &value);
|
q = acpi_ec_create_query(ec, &value);
|
||||||
if (!q)
|
if (!q)
|
||||||
@ -1180,11 +1178,14 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
|
|||||||
* bit to be cleared (and thus clearing the interrupt source).
|
* bit to be cleared (and thus clearing the interrupt source).
|
||||||
*/
|
*/
|
||||||
result = acpi_ec_transaction(ec, &q->transaction);
|
result = acpi_ec_transaction(ec, &q->transaction);
|
||||||
if (!value)
|
|
||||||
result = -ENODATA;
|
|
||||||
if (result)
|
if (result)
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
result = -ENODATA;
|
||||||
|
goto err_exit;
|
||||||
|
}
|
||||||
|
|
||||||
q->handler = acpi_ec_get_query_handler_by_value(ec, value);
|
q->handler = acpi_ec_get_query_handler_by_value(ec, value);
|
||||||
if (!q->handler) {
|
if (!q->handler) {
|
||||||
result = -ENODATA;
|
result = -ENODATA;
|
||||||
@ -1210,8 +1211,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
|
|||||||
err_exit:
|
err_exit:
|
||||||
if (result)
|
if (result)
|
||||||
acpi_ec_delete_query(q);
|
acpi_ec_delete_query(q);
|
||||||
if (data)
|
|
||||||
*data = value;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,7 +1243,9 @@ static void acpi_ec_event_handler(struct work_struct *work)
|
|||||||
spin_lock_irqsave(&ec->lock, flags);
|
spin_lock_irqsave(&ec->lock, flags);
|
||||||
while (ec->nr_pending_queries) {
|
while (ec->nr_pending_queries) {
|
||||||
spin_unlock_irqrestore(&ec->lock, flags);
|
spin_unlock_irqrestore(&ec->lock, flags);
|
||||||
(void)acpi_ec_query(ec, NULL);
|
|
||||||
|
acpi_ec_query(ec);
|
||||||
|
|
||||||
spin_lock_irqsave(&ec->lock, flags);
|
spin_lock_irqsave(&ec->lock, flags);
|
||||||
ec->nr_pending_queries--;
|
ec->nr_pending_queries--;
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user