Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95497
b: refs/heads/master
c: fa95ba0
h: refs/heads/master
i:
  95495: 3deff67
v: v3
  • Loading branch information
Alexey Starikovskiy authored and Len Brown committed Mar 25, 2008
1 parent 507f7ac commit 02859e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 223883b7aafa02410ed2e571d6032c876d0b23b8
refs/heads/master: fa95ba04e6ba11d71e1b87becd054b38faf546c8
11 changes: 11 additions & 0 deletions trunk/drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static struct acpi_ec {
wait_queue_head_t wait;
struct list_head list;
struct delayed_work work;
atomic_t irq_count;
u8 handlers_installed;
} *boot_ec, *first_ec;

Expand Down Expand Up @@ -171,6 +172,7 @@ static void ec_switch_to_poll_mode(struct acpi_ec *ec)

static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
{
atomic_set(&ec->irq_count, 0);
if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) &&
likely(!force_poll)) {
if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event),
Expand Down Expand Up @@ -489,6 +491,12 @@ static u32 acpi_ec_gpe_handler(void *data)
u8 state = acpi_ec_read_status(ec);

pr_debug(PREFIX "~~~> interrupt\n");
atomic_inc(&ec->irq_count);
if (atomic_read(&ec->irq_count) > 5) {
pr_err(PREFIX "GPE storm detected, disabling EC GPE\n");
ec_switch_to_poll_mode(ec);
goto end;
}
clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))
wake_up(&ec->wait);
Expand All @@ -507,6 +515,7 @@ static u32 acpi_ec_gpe_handler(void *data)
set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
clear_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags);
}
end:
ec_schedule_ec_poll(ec);
return ACPI_SUCCESS(status) ?
ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
Expand All @@ -515,6 +524,7 @@ static u32 acpi_ec_gpe_handler(void *data)
static void do_ec_poll(struct work_struct *work)
{
struct acpi_ec *ec = container_of(work, struct acpi_ec, work.work);
atomic_set(&ec->irq_count, 0);
(void)acpi_ec_gpe_handler(ec);
}

Expand Down Expand Up @@ -679,6 +689,7 @@ static struct acpi_ec *make_acpi_ec(void)
init_waitqueue_head(&ec->wait);
INIT_LIST_HEAD(&ec->list);
INIT_DELAYED_WORK_DEFERRABLE(&ec->work, do_ec_poll);
atomic_set(&ec->irq_count, 0);
return ec;
}

Expand Down

0 comments on commit 02859e9

Please sign in to comment.