Skip to content

Commit 13a62d0

Browse files
committed
ACPI: EC: Rearrange code in acpi_ec_submit_event()
Rearange acpi_ec_event_handler() so as to avoid releasing ec->lock and acquiring it again right away in the case when ec_event_clearing is not ACPI_EC_EVT_TIMING_EVENT. This also reduces the number of checks done by acpi_ec_event_handler() in that case. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 54b8614 commit 13a62d0

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

drivers/acpi/ec.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ static void acpi_ec_event_handler(struct work_struct *work)
12381238
acpi_ec_submit_query(ec);
12391239

12401240
spin_lock_irq(&ec->lock);
1241+
12411242
ec->events_to_process--;
12421243
}
12431244

@@ -1246,27 +1247,30 @@ static void acpi_ec_event_handler(struct work_struct *work)
12461247
* event handling work again regardless of whether or not the query
12471248
* queued up above is processed successfully.
12481249
*/
1249-
if (ec_event_clearing == ACPI_EC_EVT_TIMING_EVENT)
1250+
if (ec_event_clearing == ACPI_EC_EVT_TIMING_EVENT) {
1251+
bool guard_timeout;
1252+
12501253
acpi_ec_complete_event(ec);
1251-
else
1252-
acpi_ec_close_event(ec);
12531254

1254-
spin_unlock_irq(&ec->lock);
1255+
ec_dbg_evt("Event stopped");
1256+
1257+
spin_unlock_irq(&ec->lock);
12551258

1256-
ec_dbg_evt("Event stopped");
1259+
guard_timeout = !!ec_guard(ec);
12571260

1258-
if (ec_event_clearing == ACPI_EC_EVT_TIMING_EVENT && ec_guard(ec)) {
12591261
spin_lock_irq(&ec->lock);
12601262

12611263
/* Take care of SCI_EVT unless someone else is doing that. */
1262-
if (!ec->curr)
1264+
if (guard_timeout && !ec->curr)
12631265
advance_transaction(ec, false);
1266+
} else {
1267+
acpi_ec_close_event(ec);
12641268

1265-
spin_unlock_irq(&ec->lock);
1269+
ec_dbg_evt("Event stopped");
12661270
}
12671271

1268-
spin_lock_irq(&ec->lock);
12691272
ec->events_in_progress--;
1273+
12701274
spin_unlock_irq(&ec->lock);
12711275
}
12721276

0 commit comments

Comments
 (0)