From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Alexey Starikovskiy <astarikovskiy@suse.de>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] acpi: Rip out EC_FLAGS_QUERY_PENDING (prevent race condition)
Date: Sat, 19 Jul 2008 12:38:33 +0100 [thread overview]
Message-ID: <4881D239.4010402@tuffmail.co.uk> (raw)
In-Reply-To: <4881CE72.1090401@tuffmail.co.uk>
From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
If several GPE interrupts arrive at a time, then perform an equal number of
queries in the workqueue. It doesn't matter if there are excess interrupts;
the queries will just come back with nothing.
This won't fix anything, because it still switches to polling GPEs if more
than five interrupts arrive at a time. But it simplifies the code, and makes
it easier to modify further without introducing race conditions.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Tested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 5622aee..8e4b1a4 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -77,7 +77,6 @@ enum ec_event {
enum {
EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */
- EC_FLAGS_QUERY_PENDING, /* Query is pending */
EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */
EC_FLAGS_NO_GPE, /* Don't use GPE mode */
EC_FLAGS_RESCHEDULE_POLL /* Re-schedule poll */
@@ -230,8 +229,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
"finish-write timeout, command = %d\n", command);
goto end;
}
- } else if (command == ACPI_EC_COMMAND_QUERY)
- clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
+ }
for (; rdata_len > 0; --rdata_len) {
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll);
@@ -502,7 +508,7 @@ static u32 acpi_ec_gpe_handler(void *data)
wake_up(&ec->wait);
if (state & ACPI_EC_FLAG_SCI) {
- if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
+ if (ec->handlers_installed)
status = acpi_os_execute(OSL_EC_BURST_HANDLER,
acpi_ec_gpe_query, ec);
} else if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) &&
@@ -665,7 +671,6 @@ static struct acpi_ec *make_acpi_ec(void)
struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
if (!ec)
return NULL;
- ec->flags = 1 << EC_FLAGS_QUERY_PENDING;
mutex_init(&ec->lock);
init_waitqueue_head(&ec->wait);
INIT_LIST_HEAD(&ec->list);
@@ -858,8 +863,6 @@ static int acpi_ec_start(struct acpi_device *device)
ret = ec_install_handlers(ec);
- /* EC is fully operational, allow queries */
- clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
ec_schedule_ec_poll(ec);
return ret;
}
next prev parent reply other threads:[~2008-07-19 11:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-15 22:25 [PATCH] acpi: Avoid dropping rapid hotkey events (or other GPEs) on Asus EeePC Alan Jenkins
2008-07-17 11:49 ` Alexey Starikovskiy
2008-07-17 12:13 ` Henrique de Moraes Holschuh
2008-07-17 12:30 ` Alexey Starikovskiy
2008-07-17 16:26 ` Henrique de Moraes Holschuh
2008-07-17 16:45 ` Alan Jenkins
2008-07-17 18:50 ` Henrique de Moraes Holschuh
2008-07-17 19:07 ` Alan Jenkins
2008-07-19 11:37 ` [PATCH 0/3] acpi: GPE fixes Alan Jenkins
2008-07-19 14:07 ` Vegard Nossum
[not found] ` <4881CE72.1090401@tuffmail.co.uk>
2008-07-19 11:38 ` Alan Jenkins [this message]
2008-07-19 16:59 ` [PATCH 1/3] acpi: Rip out EC_FLAGS_QUERY_PENDING (prevent race condition) Alexey Starikovskiy
2008-07-19 20:41 ` Alan Jenkins
2008-07-19 21:12 ` Alexey Starikovskiy
2008-07-20 14:55 ` Alan Jenkins
2008-07-19 11:39 ` [PATCH 2/3] acpi: Avoid dropping rapid GPEs on Asus EeePC and others Alan Jenkins
2008-07-19 11:39 ` [PATCH 3/3] acpi: remove GPE polling Alan Jenkins
2008-07-17 14:35 ` [PATCH] acpi: Avoid dropping rapid hotkey events (or other GPEs) on Asus EeePC Alexey Starikovskiy
2008-07-17 16:02 ` Alan Jenkins
2008-07-17 16:45 ` Alexey Starikovskiy
2008-07-17 18:55 ` Alan Jenkins
2008-07-17 18:59 ` Alexey Starikovskiy
2008-08-12 23:28 ` Andrew Morton
2008-08-13 10:21 ` Alan Jenkins
2008-08-13 10:46 ` Andrew Morton
2008-08-13 11:45 ` Alan Jenkins
2008-08-13 11:51 ` Alan Jenkins
2008-08-13 13:36 ` Maximilian Engelhardt
2008-08-13 14:39 ` Alan Jenkins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4881D239.4010402@tuffmail.co.uk \
--to=alan-jenkins@tuffmail.co.uk \
--cc=astarikovskiy@suse.de \
--cc=hmh@hmh.eng.br \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).