Commit a105acd7 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

ACPI: EC: Simplify locking in acpi_ec_event_handler()

Because acpi_ec_event_handler() is a work function, it always
runs in process context with interrupts enabled, so it can use
spin_lock_irq() and spin_unlock_irq() for the locking.

Make it do so and adjust white space around those calls.

No expected functional impact.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 388fb77d
...@@ -1217,18 +1217,18 @@ static int acpi_ec_query(struct acpi_ec *ec) ...@@ -1217,18 +1217,18 @@ static int acpi_ec_query(struct acpi_ec *ec)
static void acpi_ec_event_handler(struct work_struct *work) static void acpi_ec_event_handler(struct work_struct *work)
{ {
unsigned long flags;
struct acpi_ec *ec = container_of(work, struct acpi_ec, work); struct acpi_ec *ec = container_of(work, struct acpi_ec, work);
ec_dbg_evt("Event started"); ec_dbg_evt("Event started");
spin_lock_irqsave(&ec->lock, flags); spin_lock_irq(&ec->lock);
while (ec->nr_pending_queries) { while (ec->nr_pending_queries) {
spin_unlock_irqrestore(&ec->lock, flags); spin_unlock_irq(&ec->lock);
acpi_ec_query(ec); acpi_ec_query(ec);
spin_lock_irqsave(&ec->lock, flags); spin_lock_irq(&ec->lock);
ec->nr_pending_queries--; ec->nr_pending_queries--;
} }
...@@ -1241,23 +1241,23 @@ static void acpi_ec_event_handler(struct work_struct *work) ...@@ -1241,23 +1241,23 @@ static void acpi_ec_event_handler(struct work_struct *work)
ec_event_clearing == ACPI_EC_EVT_TIMING_QUERY) ec_event_clearing == ACPI_EC_EVT_TIMING_QUERY)
acpi_ec_complete_query(ec); acpi_ec_complete_query(ec);
spin_unlock_irqrestore(&ec->lock, flags); spin_unlock_irq(&ec->lock);
ec_dbg_evt("Event stopped"); ec_dbg_evt("Event stopped");
if (ec_event_clearing == ACPI_EC_EVT_TIMING_EVENT && ec_guard(ec)) { if (ec_event_clearing == ACPI_EC_EVT_TIMING_EVENT && ec_guard(ec)) {
spin_lock_irqsave(&ec->lock, flags); spin_lock_irq(&ec->lock);
/* Take care of SCI_EVT unless someone else is doing that. */ /* Take care of SCI_EVT unless someone else is doing that. */
if (!ec->curr) if (!ec->curr)
advance_transaction(ec, false); advance_transaction(ec, false);
spin_unlock_irqrestore(&ec->lock, flags); spin_unlock_irq(&ec->lock);
} }
spin_lock_irqsave(&ec->lock, flags); spin_lock_irq(&ec->lock);
ec->events_in_progress--; ec->events_in_progress--;
spin_unlock_irqrestore(&ec->lock, flags); spin_unlock_irq(&ec->lock);
} }
static void acpi_ec_handle_interrupt(struct acpi_ec *ec) static void acpi_ec_handle_interrupt(struct acpi_ec *ec)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment