Skip to content

Commit 388fb77

Browse files
committed
ACPI: EC: Rearrange the loop in acpi_ec_event_handler()
It is not necessary to check ec->nr_pending_queries against 0 in the while () loop in acpi_ec_event_handler(), because that loop terminates when ec->nr_pending_queries is 0 and the code depending on that can be run after the loop has ended. Modify the code accordingly and while at it rewrite the comment regarding that code to make it clearer. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 98d3645 commit 388fb77

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

drivers/acpi/ec.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,18 +1230,17 @@ static void acpi_ec_event_handler(struct work_struct *work)
12301230

12311231
spin_lock_irqsave(&ec->lock, flags);
12321232
ec->nr_pending_queries--;
1233-
/*
1234-
* Before exit, make sure that this work item can be
1235-
* scheduled again. There might be QR_EC failures, leaving
1236-
* EC_FLAGS_QUERY_PENDING uncleared and preventing this work
1237-
* item from being scheduled again.
1238-
*/
1239-
if (!ec->nr_pending_queries) {
1240-
if (ec_event_clearing == ACPI_EC_EVT_TIMING_STATUS ||
1241-
ec_event_clearing == ACPI_EC_EVT_TIMING_QUERY)
1242-
acpi_ec_complete_query(ec);
1243-
}
12441233
}
1234+
1235+
/*
1236+
* Before exit, make sure that the it will be possible to queue up the
1237+
* event handling work again regardless of whether or not the query
1238+
* queued up above is processed successfully.
1239+
*/
1240+
if (ec_event_clearing == ACPI_EC_EVT_TIMING_STATUS ||
1241+
ec_event_clearing == ACPI_EC_EVT_TIMING_QUERY)
1242+
acpi_ec_complete_query(ec);
1243+
12451244
spin_unlock_irqrestore(&ec->lock, flags);
12461245

12471246
ec_dbg_evt("Event stopped");

0 commit comments

Comments
 (0)