Skip to content

Commit 1f23504

Browse files
committed
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>
1 parent ca8283d commit 1f23504

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

drivers/acpi/ec.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ struct acpi_ec_query {
169169
struct acpi_ec *ec;
170170
};
171171

172-
static int acpi_ec_query(struct acpi_ec *ec, u8 *data);
172+
static int acpi_ec_query(struct acpi_ec *ec);
173173
static bool advance_transaction(struct acpi_ec *ec, bool interrupt);
174174
static void acpi_ec_event_handler(struct work_struct *work);
175175
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)
496496
*/
497497
static void acpi_ec_clear(struct acpi_ec *ec)
498498
{
499-
int i, status;
500-
u8 value = 0;
499+
int i;
501500

502501
for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) {
503-
status = acpi_ec_query(ec, &value);
504-
if (status || !value)
502+
if (acpi_ec_query(ec))
505503
break;
506504
}
507505
if (unlikely(i == ACPI_EC_CLEAR_MAX))
@@ -1164,11 +1162,11 @@ static void acpi_ec_event_processor(struct work_struct *work)
11641162
acpi_ec_delete_query(q);
11651163
}
11661164

1167-
static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
1165+
static int acpi_ec_query(struct acpi_ec *ec)
11681166
{
1167+
struct acpi_ec_query *q;
11691168
u8 value = 0;
11701169
int result;
1171-
struct acpi_ec_query *q;
11721170

11731171
q = acpi_ec_create_query(ec, &value);
11741172
if (!q)
@@ -1180,11 +1178,14 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
11801178
* bit to be cleared (and thus clearing the interrupt source).
11811179
*/
11821180
result = acpi_ec_transaction(ec, &q->transaction);
1183-
if (!value)
1184-
result = -ENODATA;
11851181
if (result)
11861182
goto err_exit;
11871183

1184+
if (!value) {
1185+
result = -ENODATA;
1186+
goto err_exit;
1187+
}
1188+
11881189
q->handler = acpi_ec_get_query_handler_by_value(ec, value);
11891190
if (!q->handler) {
11901191
result = -ENODATA;
@@ -1210,8 +1211,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
12101211
err_exit:
12111212
if (result)
12121213
acpi_ec_delete_query(q);
1213-
if (data)
1214-
*data = value;
1214+
12151215
return result;
12161216
}
12171217

@@ -1243,7 +1243,9 @@ static void acpi_ec_event_handler(struct work_struct *work)
12431243
spin_lock_irqsave(&ec->lock, flags);
12441244
while (ec->nr_pending_queries) {
12451245
spin_unlock_irqrestore(&ec->lock, flags);
1246-
(void)acpi_ec_query(ec, NULL);
1246+
1247+
acpi_ec_query(ec);
1248+
12471249
spin_lock_irqsave(&ec->lock, flags);
12481250
ec->nr_pending_queries--;
12491251
/*

0 commit comments

Comments
 (0)